Jump to content
Sign in to follow this  
wakillon

HttpHeaderWatcher v1.0.1.3 recreate full WinHttp Request in au3 format

Recommended Posts

wakillon

HttpHeaderWatcher v1.0.1.3

 

201402131358371.jpg

Some time ago, some members asked how to see the Http Requests.
There are quite a few external applications but not in AutoIt!
HttpHeaderWatcher in association with WinPcap, very modestly solves this lack.

 

Once done this http watcher, i asked me : why not Re-build a WinHttp Request in AutoIt from a selected Request in one Click ?
So i have added a "Create au3" button who open the WinHttp Request of your choice in AutoIt format in SciTE Editor.

Voila voila, hope it can help !  :)

Buttons were made online with chimply.com the easy and free buttons generator !

See Help for more infos.

previous downloads : 253

source and executable are available in the Download Section

Hope you like it !

Edited by wakillon
  • Like 1

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
nend

I've tryd it but.... ill get a error and it is'nt possible to select a device (the list is empty).

(614) : ==> Array variable subscript badly formatted.:
$pCap = _PcapStartCapture ( $aPcapDevices[$int][0], 'host ' & $aPcapDevices[$int][7] & ' and tcp port (80 or 8080)', 0, 65536, 2^24, 0 )
$pCap = _PcapStartCapture ( $aPcapDevices[^ ERROR
 
I'm not using the latest version of Autoit (i'm using 3.3.8.1) mabey that is the problem?
I've installed the lattest Win pcap.
 
EDIT:
 
I've found it:
 
On line number 321 it sets $ipv4 = 0
On line number 331 it won't come by this: If $ipv4 > 1 Then
I've I comment out this line al thing works greate.
 
 
Thanks for this nice program
Edited by nend

Share this post


Link to post
Share on other sites
wakillon

Hi nend

You are right, it should be : If $ipv4 >= 1 Then

You had an error because you only have a unique device detected.

Say me if i'm wrong. :)

Thanks for your feedback.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
nend

No The problem was that I just can't select a device.

So I've tryd to start it without selecting a device and that produce a error.

This is a good program for me to learn WinPcap, I wan't to make a program that capture streaming audiolinks.

Edited by nend

Share this post


Link to post
Share on other sites
wakillon

So, how many items are in the combobox ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
nend

The first time when I started this program nothing was showing in the combobox until I comment out line 331.

Every next time it's showning 1 ethernetcard (the only one in this pc).

And I works perfectly so far.

Share this post


Link to post
Share on other sites
wakillon

Ok, so i was right.

$ipv4 indicate the number of detected devices

and as i set the condition to be superior to 1 for set datas to the combo (who is logic for a combo to have several items),

it didn't set anything in your case, cause you only have 1 device.

Instead of comment the line, replace it by : If $ipv4 >= 1 Then 

and it should work.  ;)

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
wakillon

Hi JohnOne  ;)

It's normal that line 321 the variable $ipv4 is declared and set to 0

I suggest to modify the line 330 :  If $ipv4 > 1 Then  to  If $ipv4 >= 1 Then

I have made some tries on several computers and i always get 2 devices, that's why i set a combo.

Did you try it ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
wakillon

Yes tried it, all works fine for me, I have a number of devices.

 

Cool !

I 'm waiting for nend confirmation for update script.

Thanks  ;)


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
nend

@ Wakillon,

All works well with "If $ipv4 >= 1 Then"

Edited by nend

Share this post


Link to post
Share on other sites
DeltaRocked

Hi ,

Downloaded and installed WinPcap , getting the list of NICs in the dropdown list . When I click on start and then via a browser trying to browse --- nothing shows up on the Application console.

Are there any pre-requisites ?

Rgds

Share this post


Link to post
Share on other sites
wakillon

Hi ,

Downloaded and installed WinPcap , getting the list of NICs in the dropdown list . When I click on start and then via a browser trying to browse --- nothing shows up on the Application console.

Are there any pre-requisites ?

Rgds

 

No.

1 - May be your browser use his cache, in this case try to actualize the page.

2 - May be you use a "https" url and as this type of request are ssl encrypted and on port 443, script do not support them.

3 - May be you can try by selecting an other device.

Do you have a device who look as mine in the picture of the first post ?

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
wakillon

@ Wakillon,

All works well with "If $ipv4 >= 1 Then"

 

Cool !

i will update script and by the same occasion disable the combo if there is only one device.  

Thanks.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
wakillon

Updated for correct the bug that nend have found !

@DeltaRocked : Have you managed to make it work ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
DeltaRocked

Hi Wakillon,

Downloaded the latest version and now it works as per the documentation. thanks.

Regards

Share this post


Link to post
Share on other sites
wakillon

Hi Wakillon,

Downloaded the latest version and now it works as per the documentation. thanks.

Regards

 

Glad it works well now.

Thanks for your feedback.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
DeltaRocked

There is one more request :

During my testing , I was working on a local server ie. 127.0.0.1 and wanted to look into the headers , but since the LAN IP is tapped , I wassnt able to look into the https headers from the local machine and had to utilise another resource.

1: Would it be possible to tap into 127.0.0.1 

rgds

Share this post


Link to post
Share on other sites
wakillon

Hi DeltaRocked

 

Sorry but "Https" requests are ssl encrypted and i do not know how use the "man in the middle" method for be able to "decrypt" them.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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  

  • Similar Content

    • Melque_Lima
      By Melque_Lima
      A little help here please !?
      I'm trying to parse a file but the function is not working well! i think there is some thind doing wrong at FileRead()
      Obs: username,password and API link below is fictitious
      ConsoleWrite(">POST METHOD UPLOADING LOCAL IMAGE<" & @CRLF) _PostMethodTest() Func _PostMethodTest() Local Const $sAPIKey = '8f1e0a750088957' Local $sBoundary = "--------Boundary" Local $sHeaders = "Content-Type: multipart/form-data; boundary=" & $sBoundary & @CRLF Local $sData = '' Local $sFileName="image.jpg" Local $sFilePath="C:\Users\DELL\Desktop\" & $sFileName Local $hFile=FileOpen($sFilePath,16);16=$FO_BINARY Local $sFileData=FileRead($hFile) FileClose($hFile) $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="myImage"; filename="' & $sFileName & '"' & @CRLF $sData &= 'Content-Type: application/upload' & @CRLF & @CRLF $sData &= BinaryToString($sFileData,0) & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="username"' & @CRLF & @CRLF $sData &="myuserName" & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="password"' & @CRLF & @CRLF $sData &="MyPassword" & @CRLF $sData &=$sBoundary & "--" ConsoleWrite($sData) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://myapi", False) $oHTTP.SetRequestHeader("Content-Type", "multipart/form-data; " & "boundary=" & $sBoundary) $oHTTP.SetRequestHeader("apikey", $sAPIKey) $oHTTP.Send(StringToBinary($sData,1)) Local $sReceived = $oHTTP.ResponseText ConsoleWrite($sReceived & @CRLF) EndFunc ;==>_PostMethodTest  

    • Surya
      By Surya
      Hi everyone its been loooong since I posted here 
      I have been trying to convert this curl executable parameters into autoit using the winhttp com object;
      curl -F data_file=@my_audio_file.mp3 -F model=en-US "https://api.speechmatics.com/v1.0/user/41049/jobs/?auth_token=MmQ5MTk4jdsgjhgghstOGU5YS00OWFhLWghdgjshgdhbshj017###" any ideas guys
       
      PS: I am excited to post here after a looong time
    • Seminko
      By Seminko
      I'm trying to get data from http://poe.trade/ - disclaimer, although this site is about a game, my script will not in any way interact directly with the game in any way. The script is just to get data from the site.
      To explain how it works - you submit a POST request and a custom URL is returned, then you do a GET request on that URL and you get the final URL you want.
       
      First issue:
      Now, I've tried doing so by using https://apitester.com/ and the first phase works. Here's how it looks like at APITester:
      Request Headers POST /search HTTP/1.1 Host: poe.trade Accept: */* User-Agent: Rigor API Tester Content-Length: 43 Content-Type: application/x-www-form-urlencoded Request Body online=x&name=kaom%27s%20heart&league=incursion When I submit this, the response I get is this:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="http://poe.trade/search/ioritewoteteme">http://poe.trade/search/ioritewoteteme</a>. If not click the link. So I then do a GET request for 'http://poe.trade/search/ioritewoteteme', which results in this response:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="http://poe.trade/search/inamotezuakito">http://poe.trade/search/inamotezuakito</a>. If not click the link. Great, this link (http://poe.trade/search/inamotezuakito) is exactly what we want.
      However, when I try to do the same in autoit, the result is quite different:
      Global Const $HTTP_STATUS_OK = 200 $test = HttpPost("http://poe.trade/search", "/online=x&name=kaom%27s%20heart&league=incursion") ClipPut($test) MsgBox(1, "", $test) Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.SetRequestHeader("Host", "poe.trade") $oHTTP.SetRequestHeader("User-Agent", "Rigor API Tester") $oHTTP.SetRequestHeader("Accept", "*/*") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sData) If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc The code above returns: ' 謟 '
      Any ideas as to what I am doing incorrectly?
       
      Second issue:
      Once I get the final link using APITester and do a GET on that i get a bunch of hieroglyphs. A friend of mine advised that the data is GZiped, which is a pain in the butt to be honest. However, apparently curl can uncompres that.
      How would I go about it?
       
      Thanks
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I was trying to insert function header to the functions of my script, but, in the SciTE console, this appears:
      Function or struct definition not found, unable to insert header. @Jos Any suggestion?
      Thanks in advance.

      Best Regards.
×