同一个IE窗口,$Obj.cookie 得到的Cookie 比httpwatch里看到的要少,为什么,何解?
本帖最后由 fenhanxue 于 2017-3-12 14:47 编辑#include <IE.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ARRAY.AU3>
#include <WinAPI.au3>
$Form1 = GUICreate("Form1", 623, 600, 192, 114)
$ieobj = _IECreateEmbedded()
GUICtrlCreateObj($ieobj, 0, 0, 617, 393)
_IENavigate($ieobj, "https://passport.yhd.com/passport/login_input.do?")
$Ele = _IEGetObjById($ieobj,"un")
_IEFormElementSetValue($Ele,"13078480989")
$Ele = _IEGetObjById($ieobj,"pwd")
_IEFormElementSetValue($Ele,"9zuzz4yk9")
;账号:13078480989 密码:9zuzz4yk9
$Edit1 = GUICtrlCreateEdit("", 0, 400, 617, 140, $WS_VSCROLL)
$button = GUICtrlCreateButton("提交", 270, 560, 80, 30)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button
getjson()
EndSwitch
$cookies = _IEDocGetObj($ieobj).cookie
If GUICtrlRead($Edit1) <> $cookies Then GUICtrlSetData($Edit1, $cookies)
WEnd
Func getjson()
Global $INTERNET_COOKIE_HTTPONLY = 8192 ;Requires IE 8 or higher
Global $INTERNET_COOKIE_THIRD_PARTY = 131072
Global $INTERNET_FLAG_RESTRICTED_ZONE = 16
Global $sUrl = _IEPropertyGet($ieobj ,"locationurl")
Global $sCookieName = 'ut'
Global $tSize = DllStructCreate("dword")
Global $tBuffer = DllStructCreate('char')
Global $getcookies = DllCall("wininet.dll", _
"bool", "InternetGetCookieExW", _
'wstr', $sUrl, _
'wstr', $sCookieName, _
"ptr", DllStructGetPtr($tBuffer), _
"ptr", DllStructGetPtr($tSize), _
"dword", $INTERNET_COOKIE_HTTPONLY, _
"ptr", Null _
)
If Not _WinAPI_GetLastError() Then ConsoleWrite(DllStructGetData($tBuffer, 1) & @CRLF)
ConsoleWrite(_WinAPI_GetLastError() & @CRLF)
_ArrayDisplay($getcookies)
EndFunc ;==>getjson以一号店登陆为例,一号店登陆之后,用httpwatch, 能看到有下面这个叫做 ut的cookie
但是用_IEDocGetObj($ieobj).cookie却得到不这个ut
不知是为什么,如何才能获取到?
比如在这个页面:
http://cart.yhd.com/cart/cart.do?action=view
httpwatch 可以看到有 ut这个cookie
但是用$Cookie = $Obj.cookie得到的结果里面,却没有 ut http://autoitx.com/thread-53455-1-1.html HttpOnly属性的COOKIE好像用对象无法获取到的 楼上正解,基本很难获取。 ;账号:13078480989 密码:9zuzz4yk9
你不要发出来啊。。帐号安全问题
heavenm 发表于 2017-3-13 00:18 http://autoitx.com/images/common/back.gif
上面的源码就是参考这个帖子里来的,可惜获取不到,也不知道如何是好
页:
[1]