Jump to content
Sign in to follow this  
fielmann

HTTP-POST Cookies read out sessionstore.js

Recommended Posts

use wininet dll: http://support.microsoft.com/kb/196062/en-us/

This works till you need javascript :)

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

OK, heres an example :)

#include <IE.au3>
; IE is just used to show the resulting HTML :)
$oIE = _IECreate()

;OPEN Internet
    Local $h_DLL = DllOpen("wininet.dll")
    
    Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "AutoIt v3", 'int', 0, 'int', 0, 'int', 0, 'int', 0)
    If @error Or $ai_IO[0] = 0 Then
        DllClose($h_DLL)
        SetError(1)
;~      Return ""
    EndIf
;-------------------------------


; OPen Page 1
    $s_URL = "http://progandy.pr.funpic.de/session/session1.php"
    $s_Header = ''


    Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)
    If @error Or $ai_IOU[0] = 0 Then
        DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
        DllClose($h_DLL)
        SetError(1)
;~      Return ""
    EndIf
;---------------------------

; Read Page content
Local $s_Buf = ""
    Local $v_Struct = DllStructCreate('udword')
    DllStructSetData($v_Struct, 1, 1)
    
    While DllStructGetData($v_Struct, 1) <> 0
        $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct))        
        $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1))
    WEnd
;----------------------
    MsgBox(0, '', $s_Buf)
_IEDocWriteHTML($oIE,$s_Buf)

; Read COOKIES
    Local $v2_Struct = DllStructCreate('char[500]')
    $TheCookie = DllCall($h_DLL,"int","InternetGetCookie","str",$s_URL,"str","","ptr",DllStructGetPtr($v2_Struct),"dword*",500)
    $AllcookiesInString = DllStructGetData($v2_Struct, 1)
; ---------------
    MsgBox(0, "Cookies", $AllcookiesInString)

; Close Handle to page
    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])
;--------------------

; The cookie stys there for the whole Script
; OPen Page 2
    $s_URL = "http://progandy.pr.funpic.de/session/session2.php"
    Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)
    If @error Or $ai_IOU[0] = 0 Then
        DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
        DllClose($h_DLL)
        SetError(1)
;~      Return ""
    EndIf
;-----------------------

; Read Page content
    Local $s_Buf = ""
    Local $v_Struct = DllStructCreate('udword')
    DllStructSetData($v_Struct, 1, 1)
    
    While DllStructGetData($v_Struct, 1) <> 0
        $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct))        
        $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1))
    WEnd
    MsgBox(0, '', $s_Buf)
_IEDocWriteHTML($oIE,$s_Buf)
; -------------------------------------

; Close Pge 2
    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])
; ------------



;######## OPen page2 again:
; The cookie stys there for the whole Script
; OPen Page 2
    $s_URL = "http://progandy.pr.funpic.de/session/session2.php"
    Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)
    If @error Or $ai_IOU[0] = 0 Then
        DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
        DllClose($h_DLL)
        SetError(1)
;~      Return ""
    EndIf
;-----------------------

; Read Page content
    Local $s_Buf = ""
    Local $v_Struct = DllStructCreate('udword')
    DllStructSetData($v_Struct, 1, 1)
    
    While DllStructGetData($v_Struct, 1) <> 0
        $ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct))        
        $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1))
    WEnd
    MsgBox(0, '', $s_Buf)
_IEDocWriteHTML($oIE,$s_Buf)
; -------------------------------------

; Close Pge 2
    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])
; ------------
;########################

; Close Internt
; THe cookie rests in System-Cookie Cache, if it has an expiration date, otherwise, it will be deleted.
    DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
    DllClose($h_DLL)
; ---------------

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

wininet.dll seems to be all I need :)

The example looks good :D

Where can I find all commands that I can call with wininet.dll ? :(

Can you also send me a link to documentation of wininet.dll ? :D

Share this post


Link to post
Share on other sites

Great Example of wininet.dll ProgAndy...

fielmann all documentation about wininet dll can be found in here

http://msdn.microsoft.com/en-us/library/aa383630(VS.85).aspx
Edited by oren

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...