Jump to content
Sign in to follow this  
Delta

Header Grabber

Recommended Posts

Delta

What does it do?

Grabs and displays HTTP headers sent from your web browser to a web server.

Whats it for?

Several things actually.

* Find out exactly what information your sending to a website.

* Find out any cookie information that is being sent to a website.

* I'm sure you can find other implements for it.

Why i wrote it?

There is a program called "The Proxomitron". Basically its a proxy server but with a few advantages. You can modify and send HTTP headers, Cookie's, ECT. I use it to bypass logging into sites that don't store the cookie information after the session has ended. However in order to send the cookie information you need to know what it looks like. Thats where this script comes into play.

What i plan on using it for.

Users connecting to sites through my proxy (The Proxomitron) will not have to sign up/login to certain sites just to download their content.

How it works?

1) Login to a site.

2) Set browser's proxy settings to your internal ip and the port you choose (default 8080).

3) Browse to another page on the site you just logged into.

The header information will be displayed in an edit box and written to a log file.

* If the page does not load almost immediately stop the page and refresh *

The Code!

#include <GUIConstants.au3>
#Include <GuiEdit.au3>
#include <INet.au3>

$internalip = @IPAddress1
$externalip = _GetIP()
$port = 8080

$gui = GUICreate('Header Grabber' ,600,400)
$text_internalip = GUICtrlCreateLabel("(You proxy connect to this) Internal IP: " & $internalip, 10, 5)
$text_externalip = GUICtrlCreateLabel("(They proxy connect to this) External IP: " & $externalip, 10, 20)
$edit = GUICtrlCreateEdit('',10,40,580,350)
GUISetState()

TCPStartUp()
$MainSocket = TCPListen($internalip, $port)

While 1
    $msg = GUIGetMsg()
    $ConnectedSocket = TCPAccept($MainSocket)
    If $msg = $GUI_EVENT_CLOSE Then close()
    If $ConnectedSocket >= 0 Then
        $recv = TCPRecv($ConnectedSocket, 2048)
        While $recv <> ''
            GUICtrlSetData($edit, GUICtrlRead($edit) & '<--- START COPY --->' & @CRLF & @CRLF & $recv & @CRLF & '<--- END COPY --->' & @CRLF & @CRLF)
            FileWrite("HGLog.txt", GUICtrlRead($edit))
            _GUICtrlEditScroll ($edit, $SB_PAGEDOWN)
            _GUICtrlEditScroll ($edit, $SB_PAGEDOWN)
            _GUICtrlEditScroll ($edit, $SB_PAGEDOWN)
            TCPSend($ConnectedSocket, '<html>')
            TCPSend($ConnectedSocket, '<head>')
            TCPSend($ConnectedSocket, '<title>Header Grabbed</title>')
            TCPSend($ConnectedSocket, '</head>')
            TCPSend($ConnectedSocket, '<body>')
            TCPSend($ConnectedSocket, '<center><strong><font size="5" color="red">Header information was grabbed</font></strong></center>')
            TCPSend($ConnectedSocket, '<center><strong><font size="5">Thank you for your support!</font></strong></center>')
            TCPSend($ConnectedSocket, '</body>')
            TCPSend($ConnectedSocket, '</html>')
            TCPCloseSocket($ConnectedSocket)
            ExitLoop
        WEnd
    EndIf
WEnd

Func close()
    If $ConnectedSocket >= 0 Then TCPCloseSocket($ConnectedSocket)
    TCPShutDown()
    Exit
EndFunc

header.au3

Edited by Deltaforce229

[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites
GEOSoft

What does it do?

Grabs and displays HTTP headers sent from your web browser to a web server.

Whats it for?

Several things actually.

* Find out exactly what information your sending to a website.

* Find out any cookie information that is being sent to a website.

* I'm sure you can find other implements for it.

Why i wrote it?

There is a program called "The Proxomitron". Basically its a proxy server but with a few advantages. You can modify and send HTTP headers, Cookie's, ECT. I use it to bypass logging into sites that don't store the cookie information after the session has ended. However in order to send the cookie information you need to know what it looks like. Thats where this script comes into play.

What i plan on using it for.

Users connecting to sites through my proxy (The Proxomitron) will not have to sign up/login to certain sites just to download their content.

How it works?

1) Login to a site.

2) Set browser's proxy settings to your internal ip and the port you choose (default 8080).

3) Browse to another page on the site you just logged into.

The header information will be displayed in an edit box and written to a log file.

* If the page does not load almost immediately stop the page and refresh *

The Code!

#include <GUIConstants.au3>
#Include <GuiEdit.au3>
#include <INet.au3>

$internalip = @IPAddress1
$externalip = _GetIP()
$port = 8080

$gui = GUICreate('Header Grabber' ,600,400)
$text_internalip = GUICtrlCreateLabel("(You proxy connect to this) Internal IP: " & $internalip, 10, 5)
$text_externalip = GUICtrlCreateLabel("(They proxy connect to this) External IP: " & $externalip, 10, 20)
$edit = GUICtrlCreateEdit('',10,40,580,350)
GUISetState()

TCPStartUp()
$MainSocket = TCPListen($internalip, $port)

While 1
    $msg = GUIGetMsg()
    $ConnectedSocket = TCPAccept($MainSocket)
    If $msg = $GUI_EVENT_CLOSE Then close
    If $ConnectedSocket >= 0 Then
        $recv = TCPRecv($ConnectedSocket, 2048)
        While $recv <> ''
            GUICtrlSetData($edit, GUICtrlRead($edit) & '<--- START COPY --->' & @CRLF & @CRLF & $recv & @CRLF & '<--- END COPY --->' & @CRLF & @CRLF)
            FileWrite("HGLog.txt", GUICtrlRead($edit))
            _GUICtrlEditScroll ($edit, $SB_PAGEDOWN)
            _GUICtrlEditScroll ($edit, $SB_PAGEDOWN)
            _GUICtrlEditScroll ($edit, $SB_PAGEDOWN)
            TCPSend($ConnectedSocket, '<html>')
            TCPSend($ConnectedSocket, '<head>')
            TCPSend($ConnectedSocket, '<title>Header Grabbed</title>')
            TCPSend($ConnectedSocket, '</head>')
            TCPSend($ConnectedSocket, '<body>')
            TCPSend($ConnectedSocket, '<center><strong><font size="5" color="red">Header information was grabbed</font></strong></center>')
            TCPSend($ConnectedSocket, '<center><strong><font size="5">Thank you for your support!</font></strong></center>')
            TCPSend($ConnectedSocket, '</body>')
            TCPSend($ConnectedSocket, '</html>')
            TCPCloseSocket($ConnectedSocket)
            ExitLoop
        WEnd
    EndIf
WEnd

Func close()
    If $ConnectedSocket >= 0 Then TCPCloseSocket($ConnectedSocket)
    TCPShutDown()
    Exit
EndFuncoÝ÷ Ûú®¢×Ǻح$²X¤zØ^­è¬jw«®âØ^r^jëh×6If $msg = $GUI_EVENT_CLOSE Then closeoÝ÷ Ù(hºW[y«­¢+Ù%ÀÌØíµÍôÀÌØíU%}Y9Q}
1=MQ¡¸±½Í ¤

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Delta

Does it work with secure sites? (https)

I haven't tried it yet but i as soon as I get home I will. I'm sure it would work. If it doesn't give me info like whats below I know it will at least grab some sort of encrypted information.

GET http://df-apps.sittingonair.com/ HTTP/1.1

Host: df-apps.sittingonair.com

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Proxy-Connection: keep-alive

Cookie: Removed because its an admin cookie

Edit: Ok i tried it and this is what it came up with.

CONNECT df-apps.sittingonair.com:2083 HTTP/1.1

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Proxy-Connection: keep-alive

Host: df-apps.sittingonair.com:2083

Nice but it looks like there is an error in the code.

If $msg = $GUI_EVENT_CLOSE Then closeoÝ÷ Ù(hºW[y«­¢+Ù%ÀÌØíµÍôÀÌØíU%}Y9Q}
1=MQ¡¸±½Í ¤
Thanks for pointing that out. Fixed and re uploaded script and compiled version Edited by Deltaforce229

[size="1"]Please stop confusing "how to" with "how do"[/size]

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  

×