Jump to content

Using a Socks Proxy


piccaso
 Share

Recommended Posts

Who sayd "AutoIt doesent support Socks proxy's" ? :whistle:

TCPStartup()
 
$hc = TCPConnect("192.168.0.100",9050)                  ; Socks4a Proxy Server
 
$sReq = Chr(0x04) _                                     ; Protocol version  4
      & Chr(0x01) _                                     ; Command Code      1 - establish a tcp/ip stream connection
      & Chr(0x00) & Chr(0x50) _                         ; Port              80
      & Chr(0x00) & Chr(0x00) & Chr(0x00) & Chr(0xFF) _ ; Ip Adress         Invalid - 0.0.0.255
      & "" & Chr(0x00) _                                ; User Id           Empty
      & "www.mamma.com" & Chr(0x00)                     ; Host Name         www.mamma.com

; Send Request to Proxy
ConsoleWrite("! Request: " & Hex(BinaryString($sReq)) & @CR)
TCPSend($hc,$sReq)

; Wait for the Reply
While 1
    $sBuff = TCPRecv($hc,1)
    If @error Then Exit @ScriptLineNumber
    If StringLen($sBuff) > 0 Then ExitLoop
    Sleep(100)
WEnd

$sBuff &= TCPRecv($hc,8)
ConsoleWrite("!   Reply: " & Hex(BinaryString($sBuff)) & @CR)

; Check for errors
Switch StringMid(Hex(BinaryString($sBuff)),3,2)
    Case "5A"
        ConsoleWrite("> request granted" & @CR)
    Case "5B"
        ConsoleWrite("> request rejected or failed" & @CR)
        Exit @ScriptLineNumber
    Case "5C"
        ConsoleWrite("> request failed because client is not running identd (or not reachable from the server)" & @CR)
        Exit @ScriptLineNumber
    Case "5D"
        ConsoleWrite("> request failed because client's identd could not confirm the user id string in the request" & @CR)
        Exit @ScriptLineNumber
EndSwitch

; Send Http Request to mamma and Search for "AutoIt"
$sReq  = "GET /Mamma?query=AutoIt HTTP/1.0" & @CRLF & @CRLF
ConsoleWrite("! Request:" & @CR & $sReq & "---------------------------------" & @CR)
TCPSend($hc,$sReq)

; Wait for the Reply
ConsoleWrite("Receiving Data ")
$sRepy = ""
While 1
    $sBuff = TCPRecv($hc,1024*5)
    If @error Then ExitLoop
    If StringLen($sBuff) > 0 Then
        $sRepy &= $sBuff
        ConsoleWrite(".")
    EndIf
    Sleep(100)
WEnd

; Parse Reply
$iHeadEnd = StringInStr($sRepy,@CRLF & @CRLF) + 2
$sRepyHead = StringMid($sRepy,1,$iHeadEnd)
$sRepyBody = StringMid($sRepy,$iHeadEnd)

ConsoleWrite(@CR & "! Reply:" & @CR & $sRepyHead & "---------------------------------" & @CR)

; Save Result to disk
$hFile = FileOpen("socks.htm",2)
FileWrite($hFile,$sRepyBody)
FileClose($hFile)

ConsoleWrite("Reply Body stored in .\socks.htm (" & Round(StringLen($sRepyBody)/1024,2) & "Kb)" & @CR)
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

  • 7 months later...
Link to comment
Share on other sites

@piccaso

kein Problem !! :)

In fact my question does not relate to the Proxy Socks scripts. So I can understand why I need to restart again.

I was thinking since you were able to get a Proxy running through using AU3.

That you my be able to help me get the AuCGI handler running on an IIS server.

CGI handler

It seems that it is running on APACHE and ABYSS, but no one got it running on an IIS ?

Nevertheless IIS supports CGI extentions.

I am breaking my head on this for a long time now, but no success yet.

Maybe you have a different view on the problem and are willing to give it a try.

Thanks in advance

ptrex

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 2 months later...

out-dated?

-> BinaryString(), not working...

What is the difference between normal proxies and SOCK proxies ?!

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

  • 4 months later...

This has the above script translated to latest beta, however i still can't get SOCK5...

http://www.autoitscript.com/forum/index.ph...3&hl=armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to comment
Share on other sites

  • 5 years later...

You do realize that this topic is over 6 years old right? 

BTW, the 0x0050 is the port number, not the char P, you'd need to convert 6667 to hex and set the port accordingly.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

well that makes a lot more sense, also your 6 year old topic here is the only thing anywhere ever that references this topic so of course people are going to bump it. also thanks for that. seems like kind of a coincidence the P converts to 80 though. confused me. alright thanks

Link to comment
Share on other sites

also im confused 0x50 = char P converted to string and thus chr(0x50) returns P so im still confuses where you get 0x0050 from i dont think you actually know whats going on here, that or this is fairy unicorn logic but dont take my word for it see for yourself, you arent specifying the value 0x0050 (null P) as the port value youre specifying the Chr value that the binary string converts to. see for yourself

Edited by lionfaggot
Link to comment
Share on other sites

& Chr(0x00) & Chr(0x50) _                         ; Port              80

It appears that it's taking the character 0x00 (Null), and appending the port number to that (in char form) 0x50 = 80 decimal = port 80 in the code that I'm reading.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Hex 50 is 80 decimal, I don't really care what character it returns as it's not relevant.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

so its just a coincidence that P happens to be char value 80? i somewhat follow here. maybe im just retarded also the max value is FF which is 255 which still i am still confused as to how i output 6667 if the max range is FF :(

Edited by lionfaggot
Link to comment
Share on other sites

i figured it out i think, this is how you do values larger than 255, you just append each digit seperately so for 6667 you do Chr(0x00) & Chr(0x06) & Chr(0x06) & Chr(0x06) & Chr(0x07) - no i was incorrect that isnt working either

Edited by lionfaggot
Link to comment
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
 Share

  • Recently Browsing   0 members

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