怎么找到正确的post数据?从没接触过抓包,汗! post用户名密码总是出错,望大大指点下我这个新手吧。想抓取单位内网联网核查系统的处理结果,需要先登陆。网址:http://202.168.1.149/picp
先附上该网页的html:
[HTML] 纯文本查看 复制代码 <form action="SecurityAction.do?method=login" method="post">
<table width="1001" border="0" cellpadding="0" cellspacing="0">
<tr><td height="70" background="/picp/image/logo.jpg;jsessionid=0000fDRExPhFiM1FkENuRi-cbTN:16pltg75b"></td>
</tr><tr><td height="30" background="/picp/image/menu_bar.jpg;jsessionid=0000fDRExPhFiM1FkENuRi-cbTN:16pltg75b"> <span class="STYLE2">欢迎进入联网核查公民身份信息系统,请登录。</span></td>
</tr><tr><td height="467" background="/picp/image/log.jpg;jsessionid=0000fDRExPhFiM1FkENuRi-cbTN:16pltg75b"><div id="Layer1">
<input name="piUsersDto.usercode" type="text" class="log" maxlength="10"/><br /><br />
<input AUTOCOMPLETE="off" name="piUsersDto.password" type="password" class="log" maxlength="8"/>
<input type="submit" name="Submit" value="" style="width:1px;height:1px"></div>
<div id="Layer2"><img src="/picp/image/logbutton.jpg;jsessionid=0000fDRExPhFiM1FkENuRi-cbTN:16pltg75b" width="95" height="52" border="0"/></div></td></tr>
</table>
</form>
正常能登陆用户名:G1151002 密码:147258
照着站长的httphelper画了个登陆代码:
[C#] 纯文本查看 复制代码 string postdata = this.textbox1.Text;
MessageBox.Show(postdata);
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://202.168.1.149/picp/",//URL这里都是测试 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
Method = "get",//URL 可选项 默认为Get
};
//得到HTML代码
HttpResult result = http.GetHtml(item);
MessageBox.Show(result.Html);
item = new HttpItem()
{
URL = "http://202.168.1.149/picp/SecurityAction.do?method=login",//URL 必需项
Method = "post",//URL 可选项 默认为Get
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = result.Cookie,//字符串Cookie 可选项
Referer = "",//来源URL 可选项
Postdata = postdata,//Post数据 可选项GET时不需要写
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Allowautoredirect = false,//是否根据301跳转 可选项
//CerPath = "d:\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数
//Connectionlimit = 1024,//最大连接数 可选项 默认为1024
ProxyIp = "",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数
//ProxyPwd = "123456",//代理服务器密码 可选项
//ProxyUserName = "administrator",//代理服务器账户名 可选项
};
//得到新的HTML代码
result = http.GetHtml(item);
MessageBox.Show(result.Html);
postdata设置的是:piUsersDto.usercode=G1151002&piUsersDto.password=147258
运行后得到的html页面显示用户不存在,(正常应该是 欢迎xxx登陆)求大大看看是post的数据不对还是什么其它问题?
附上ieHTTPHeaders弄到的东东(这算不算抓包?实在是没接触过这些,望指点)
[C#] 纯文本查看 复制代码 HTTP/1.1 200 OK
Date: Tue, 07 Jan 2014 07:16:08 GMT
Server: IBM_HTTP_Server
Last-Modified: Wed, 08 Aug 2012 07:28:16 GMT
Content-Length: 15193
Keep-Alive: timeout=10
Connection: Keep-Alive
Content-Type: image/jpeg
Content-Language: zh-CN
Set-Cookie: BIGipServerpool_lwhc=434809024.20480.0000; expires=Wed, 08-Jan-2014 04:51:44 GMT; path=/
POST /picp/SecurityAction.do?method=login HTTP/1.1
Accept: image/pjpeg, image/jpeg, image/x-xbitmap, image/gif, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://202.168.1.149/picp/
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: 202.168.1.149
Content-Length: 55
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: BIGipServerpool_lwhc=434809024.20480.0000; JSESSIONID=0000XdbjOirbPxUs2Ie_27gVsxq:16pltg2gr
piUsersDto.usercode=G1151002&piUsersDto.password=1472584
HTTP/1.1 200 OK
Date: Tue, 07 Jan 2014 07:16:42 GMT
Server: IBM_HTTP_Server
Keep-Alive: timeout=10
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=GBK
Content-Language: zh-CN
|