Jump to content

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

Link to comment
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

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...
  • 1 year later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...