聘我网

新概念招聘3.0

如何telnet登陆网站?

vote up0vote downstar

登陆一般都是POST,不知道参数如何处理,

GET很简单没问题,POST该如何操作?

 

1 个答复

vote up0vote downcheck

请求:

[root@ test]$ telnet 51hired.com 80
Trying 67.23.27.187...
Connected to 51hired.com.
Escape character is '^]'.
POST /login.php HTTP/1.0
Content-Type: application/x-www-form-urlencoded
Content-Length: 22

user=abcde&psw=1234567

abcde/1234567需要相应更改)

然后服务器会返回这么一坨东西:

HTTP/1.1 302 Found
Date: Thu, 11 Aug 2011 08:29:41 GMT
Server: Apache/2.2.11 (Unix) PHP/5.2.8
X-Powered-By: PHP/5.2.8
Set-Cookie: PHPSESSID=r8d4bvgtiklkehjv5o12fhbqo6; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: fuid=179255; expires=Sat, 10-Sep-2011 08:29:55 GMT; path=/
Location: index.php
Vary: Accept-Encoding,User-Agent
Content-Length: 0
Connection: close
Content-Type: text/html

重要的是Set-Cookie: PHPSESSID=r8d4bvgtiklkehjv5o12fhbqo6; path=/

你可以手动修改浏览器PHPSESSIDCOOKIE值,这样就登陆了。或者telnet请求时头上带上这个COOKIE也是一样的。

更新

也可以使用HTTP/1.1,但是必须加上Host:

POST /login.php HTTP/1.0
Host: 51hired.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 22
链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.