找回密码
 加入
搜索
查看: 5078|回复: 13

熟悉post的朋友来帮个忙,THX

  [复制链接]
发表于 2009-9-23 13:46:05 | 显示全部楼层 |阅读模式
本帖最后由 maker 于 2009-9-28 23:53 编辑

抓包如下:
POST /CAS/Login.Validate.Account?service=http%3A%2F%2Fwww%2Esdo%2Ecom%2Fcenter%2Findex%2Easp HTTP/1.1
Accept: application/x-shockwave-flash, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://www.sdo.com/IndexIframeLogin.asp
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; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)
Host: cas.sdo.com
Content-Length: 243
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: SDO_REG_FROM=0; SNDA_ADRefererSystem_MachineTicket=f33acfc6-a5ca-4fb1-bfba-cf97c7af2ac6; ptid=makerbob04; sdid=1119198637; SDOTop_app=0; SDOLastLogin=97352A81B816B53DC64316694CF6A651%5E%24%5E166568564%5E%24%5E2009%2D09%2D23+12%3A35; HTTP%5FREFERER=http%3A%2F%2Fwww%2Esdo%2Ecom%2Fhome%2Ftop%2Easp; refererURL=http%253A%2F%2Fwww%2Esdo%2Ecom%2FIndexIframeLogin%2Easp; SDO_TOP_HTTP_REFERER=http%3A//www.sdo.com/IndexIframeLogin.asp; SDO_REFERER=http%3A//www.sdo.com/IndexIframeLogin.asp

warn=false&lt=Gauss-b2f1d061-6b81-4d49-b4f5-a25de65d5817-2009-09-23_12%3A41%3A51.000&_eventId=submit&idtype=0&gamearea=0&gametype=0&username=makerbob&password=makerbob&ekey=&challenge=&ptname=makerbob&ptpwd=makerbob&%B5%C7%C2%BC=+%B5%C7%C2%BC+


下面的代码还是登陆不成功,不熟悉这块,希望熟悉的朋友帮分析一下哪里出问题了,THX

#include <IE.au3>
FileDelete("log.txt")
Func _Post_Login()
$oHTTP = ObjCreate("Msxml2.xmlhttp")
$oHTTP.Open("Post","http://www.sdo.com/CAS/Login.Validate.Account?service=http%3A%2F%2Fwww%2Esdo%2Ecom%2Fcenter%2Findex%2Easp",false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")  
$oHTTP.setRequestHeader("Referer","http://www.sdo.com/IndexIframeLogin.asp")
$oHTTP.Send('warn=false&lt=Gauss-b2f1d061-6b81-4d49-b4f5-a25de65d5817-2009-09-23_12%3A41%3A51.000&_eventId=submit&idtype=0&gamearea=0&gametype=0&username=makerbob&password=makerbob&ekey=&challenge=&ptname=makerbob&ptpwd=makerbob&%B5%C7%C2%BC=+%B5%C7%C2%BC+')
$Log1 = BinaryToString($oHTTP.responseBody)
$html2 = $oHTTP.responseText
FileWrite("log.txt",$html2)
EndFunc

_Post_Login()
_IECreate ("http://www.sdo.com/IndexIframeLogin.asp",1,1,0)
 楼主| 发表于 2009-9-23 13:51:18 | 显示全部楼层
今天发烧,发错地方了
 楼主| 发表于 2009-9-24 12:24:32 | 显示全部楼层
responsebody后status值为404 。。。。。
 楼主| 发表于 2009-9-26 13:58:11 | 显示全部楼层
没有路过的高手?
发表于 2009-9-26 21:57:36 | 显示全部楼层
404错误,页面没找到!
你的请求有问题

warn=false&lt=Gauss-b2f1d061-6b81-4d49-b4f5-a25de65d5817-2009-09-23_12%3A41%3A51.000&_eventId=submit&idtype=0&gamearea=0&gametype=0&username=makerbob&password=makerbob&ekey=&challenge=&ptname=makerbob&ptpwd=makerbob&%B5%C7%C2%BC=+%B5%C7%C2%BC+

你多抓几次包,看看上面这段是不是一样的


 楼主| 发表于 2009-9-27 14:17:52 | 显示全部楼层
post地址不对返回404,修改后可以使200了,不过还是没有登录成功

#include <IE.au3>
FileDelete("log.txt")
Func _Post_Login()
$oHTTP = ObjCreate("Msxml2.xmlhttp")
$oHTTP.Open("Post","https://cas.sdo.com/CAS/Login.Validate.Account?service=http%3A%2F%2Fwww%2Esdo%2Ecom%2Fcenter%2Findex%2Easp",false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")  
$oHTTP.setRequestHeader("Referer","http://www.sdo.com/IndexIframeLogin.asp")
$oHTTP.Send('warn=false&lt=Gauss-7be45772-f7c9-44a6-8b32-a15215105c3a-2009-09-27_14%3A06%3A51.111&_eventId=submit&idtype=0&gamearea=0&gametype=0&username=makerbob&password=makerbob&ekey=&challenge=&ptname=makerbo&ptpwd=makerbob&%B5%C7%C2%BC=+%B5%C7%C2%BC+')
If @error <> 0 Then MsgBox(0,$oHTTP.Status,"登录失败!")
$Log1 = BinaryToString($oHTTP.responseBody)
TrayTip("responseBody状态",$oHTTP.status,3)
$html2 = $oHTTP.responseText
FileWrite("log.txt",$html2)
EndFunc

_Post_Login()
_IECreate ("http://www.sdo.com",1,1,0)
发表于 2009-9-28 18:40:47 | 显示全部楼层
#include "ie.au3"
$oIE = _IECreate("http://www.sdo.com/IndexIframeLogin.asp")
$oForm = _IEFormGetObjByName($oIE, "form")
$warn= _IEFormElementGetObjByName ($oForm, "warn")
$lt = _IEFormElementGetObjByName ($oForm, "lt")
;=======上面为获取表单lt的值   你可以使用其它的方法
Func _Post_Login()
$oHTTP = ObjCreate("Msxml2.xmlhttp")
$oHTTP.Open("Post","https://cas.sdo.com/CAS/Login.Validate.Account?service=http%3A%2F%2Fwww%2Esdo%2Ecom%2Fcenter%2Findex%2Easp",false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")  
;$oHTTP.Send('warn='&$warn.value&'<='&$lt.value&'&_eventId='&$_eventId.value&'&idtype='&$idtype.value&'&gamearea='&$gamearea.value&'&gametype='&$gametype.value&'&username=makerbob&password=makerbob&ekey=&challenge=&ptname=makerbo&ptpwd=makerbob&%B5%C7%C2%BC=+%B5%C7%C2%BC+')
$oHTTP.Send('warn=false<='&$lt.value&'&_eventId=submit&idtype=0&gamearea=0&gametype=0&username=makerbob&password=makerbob&ekey=&challenge=&ptname=makerbo&ptpwd=makerbob&%B5%C7%C2%BC=+%B5%C7%C2%BC+')
If @error <> 0 Then MsgBox(0,$oHTTP.Status,"登录失败!")
$Log1 = BinaryToString($oHTTP.responseBody)
;TrayTip("responseBody状态",$oHTTP.status,3)
$html2 = $oHTTP.responseText
_IEDocWriteHTML ($oIE, $html2)
EndFunc
_Post_Login()
使用表单方法
#include "ie.au3"
;原网页中使用javascript传递值username和password
$oIE = _IECreate("http://www.sdo.com/IndexIframeLogin.asp")
        $oForm = _IEFormGetObjByName($oIE, "form")
        $username = _IEGetObjById($oIE, "username")
        $username.value = 'makerbob' 
        $password = _IEGetObjById($oIE, "password")
        $password.value = 'makerbob'         
_IEFormSubmit ($oForm)
 楼主| 发表于 2009-9-28 23:35:46 | 显示全部楼层
本帖最后由 maker 于 2009-9-28 23:59 编辑

谢谢各位,特别是楼上,来看jhwl 晚了,不然不用费脑筋了,写的很好,谢谢,虽然我想用xmlhttp来做静默,做了个图:

自己闭门2天研究出来了,lt值是个关键,上网查资料才知道的,呵呵,不过不会正则,取lt和后面的登录连接有点傻瓜式,哎,好多要学的,愁

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-9-29 15:16:39 | 显示全部楼层
正则取法
$HTMLSource = StringRegExp(_XmlHttp("http://www.sdo.com/IndexIframeLogin.asp"),'(?<=var path    \=   ").*?(?=")',3)
$lt=StringRegExp(_XmlHttp($HTMLSource[0]),'(?<=lt" value=").*?(?=")',3)
ConsoleWrite($lt[0]) ;这里是得到的表单lt的值
Func _XmlHttp($url)
        Local $oHTTP, $sReturn
        $httpObj = ObjCreate("winhttp.winhttprequest.5.1")
        $httpObj.open("GET", $url)
        $httpObj.send()
        $HTMLSource = StringAddCR($httpObj.Responsetext)
        Return $HTMLSource
EndFunc   ;==>_XmlHttp

评分

参与人数 1金钱 +10 贡献 +5 收起 理由
maker + 10 + 5

查看全部评分

 楼主| 发表于 2009-9-30 16:18:27 | 显示全部楼层
Nice~~~Thx,  不常用,现学现卖了,不然就忘了代码了,
发表于 2009-10-2 23:36:30 | 显示全部楼层
想要楼主写的程序
发表于 2009-12-29 20:48:00 | 显示全部楼层
学习中,飞铲感谢
发表于 2010-1-1 19:13:47 | 显示全部楼层
收藏之.........
发表于 2010-4-25 00:34:55 | 显示全部楼层
jhwl  真厉害
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 19:36 , Processed in 0.079531 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表