Jump to content

Search the Community

Showing results for tags 'proxy'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 14 results

  1. What is the way to use proxy with authentication in automating IE? I managed to change proxy and port in registry, but I can't find a way to use login and password for proxy. Can anyone point to a working way?
  2. This script is based on algorithm code from EnrMa. Updated: January 22, 2018 Made improvements. Changes are in the script header. Known Issues: AutoIt x64 does not work properly with this script. Download: LocalProxyServer_v1.00.zip
  3. Hi, I tried a function by @kor here: But it does not work through a proxy. So I tried a bit. With some forum help months ago I had a www-solution through a proxy for some other stuff. But trying it with ntp didn't work. #include <WinHttp.au3> Global Const $sProxy = "http://prx01.xxx.de:8080" Global Const $sUserName = "UserName", $sPassword = "PassWord" $vOpen = _WinHttpOpen(Default, $WINHTTP_ACCESS_TYPE_NAMED_PROXY, $sProxy) $vConnect = _WinHttpConnect($vOpen, "pool.ntp.org", 123) ; Port 123 $vRequest = _WinHttpSimpleSendRequest_ProxyAuth($vConnect) Global $sSource = _WinHttpSimpleReadData($vRequest) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sSource = ' & $sSource & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Exit Func _WinHttpSimpleSendRequest_ProxyAuth($hConnect, $sType = Default, $sPath = Default, $sReferrer = Default, $sDta = Default, $sHeader = Default) Local $hRequest = _WinHttpSimpleSendRequest($hConnect, $sType, $sPath, $sReferrer, $sDta, $sHeader) If $hRequest Then Local $iStatusCode = _WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_STATUS_CODE) If $iStatusCode = $HTTP_STATUS_PROXY_AUTH_REQ Then Local $iSupportedSchemes, $iFirstScheme, $iAuthTarget ; Query Authorization scheme If _WinHttpQueryAuthSchemes($hRequest, $iSupportedSchemes, $iFirstScheme, $iAuthTarget) Then _WinHttpSetCredentials($hRequest, $iAuthTarget, $iFirstScheme, $sUserName, $sPassword) ; Set passed credentials _WinHttpSendRequest($hRequest) ; Set passed credentials _WinHttpReceiveResponse($hRequest) ; And wait for the response again EndIf EndIf EndIf Return $hRequest EndFunc (This snippet only tries to get raw data.) $sSource is "". With no port (instead of 123) I only get the informations I see when I type url into a browser - so it's not the information I seek. (There is not time included in http source code.) Some hints? Regards, Conrad
  4. #include "WinHttp.au3" #include <array.au3> #include <file.au3> #include <WinAPI.au3> #include <string.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <ListviewConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ; Learning HTTP Requests with WinHTTP ; Global $idOP, $usr, $list, $idEXIT, $call HotKeySet("{ESC}", "Terminate") Local $hGUI = GUICreate("Learning", 750, 500, 223, 202, $WS_BORDER) Local $idEXIT = GUICtrlCreateButton("Exit", 660, 440, 75, Default) Local $idCon = GUICtrlCreateButton("Start", 10, 10, 725, Default) Local $siteLab = GUICtrlCreateLabel("Select Test", 20, 48 ,Default, 35) GUICtrlSetFont (-1,9, 800); bold Local $IG = GUICtrlCreateCheckbox("test", 75, 45) Local $realm = GUICtrlCreateCheckbox("test1", 75, 65) Local $site3 = GUICtrlCreateCheckbox("test2", 200, 45) Local $site4 = GUICtrlCreateCheckbox("test3", 200, 65) $list = GUICtrlCreateListView( " PROXY | NAME1 | NAME2 | STATUS ", 20, 100, 710, 300, $LVS_NOSORTHEADER+$LVS_SINGLESEL) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idEXIT Exit Case $IG If _IsChecked($IG) Then $call = "test" EndIf Case $idCon Call($call) EndSwitch WEnd Func test() $url = "www.w3schools.com" $sPage = "/tags/demo_form.asp" Local $proxies Local $names _FileReadToArray("proxies.txt", $proxies) ; read the list of names to array _FileReadToArray("Okay.txt", $names) ; read the list of names to array For $i = 1 To UBound($proxies) - 1 $Read = $names[$i] $Datastring = ('') $newreadamount = _StringBetween($read,$Datastring, ':') $newreadamount[0] = StringReplace($newreadamount[0], ":", "") $name1 = $newreadamount[0] $Datastring2 = (':') $newreadamount2 = _StringBetween($read,$Datastring2, '') $newreadamount2[0] = StringReplace($newreadamount2[0], ":", "") $name2 = $newreadamount2[0] $sAdditionalData = "name1="&$name1&"&name2="&$name2 MsgBox(4096, "Test", $proxies[$i] & " - " & $name1&":"&$name2,1) ; Initialize and get session handle $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0", $WINHTTP_ACCESS_TYPE_NAMED_PROXY, $proxies[$i]) _WinHttpSetTimeouts($hOpen, 15, 15, 15, 15) ; Get connection handle $hConnect = _WinHttpConnect($hOpen, $url) ; Make a request $hRequest = _WinHttpOpenRequest($hConnect, "POST", $sPage) ; Send it. Specify additional data to send too. This is required by the Google API: _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $sAdditionalData) ; Wait for the response _WinHttpReceiveResponse($hRequest) ; See what's returned Dim $sReturned If _WinHttpQueryDataAvailable($hRequest) Then ; if there is data Do $sReturned &= _WinHttpReadData($hRequest) Until @error EndIf ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; See what's returned MsgBox(4096, "Returned", $sReturned, 1) If StringInStr($sReturned,'Input was received as:') Then GUICtrlCreateListViewItem($proxies[$i] & "|"&$name1&"|"&$name2&"|Success", $list) Sleep(500) ContinueLoop ElseIf $sReturned = "" Then FileWrite("nottested.txt",$name1&":"&$name2 & @CRLF) GUICtrlCreateListViewItem($proxies[$i] & "|"&$name1&"|"&$name2&"|Bad Proxy", $list) Sleep(500) ContinueLoop EndIf Next EndFunc Func Terminate() Exit 0 EndFunc Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked This is my code and it runs just fine. My problem is that if I receive Bad Proxy I need it to test the request again with the same array input $name1 / $name2 until I receive 'Input was received as:' So basically ElseIf $sReturned = "" Then FileWrite("nottested.txt",$name1&":"&$name2 & @CRLF) GUICtrlCreateListViewItem($proxies[$i] & "|"&$name1&"|"&$name2&"|Bad Proxy", $list) Sleep(500) TRY AGAIN WITH NEW PROXY AND SAME CREDENTIALS EndIf Is this possible and if so do you have either some example code and/or some helpfile I can read. Thanks in advance!
  5. I am coding a country specific IP checker with a buddy, he made the website/api and I am coding a client to run through IPs. i split my IPs so it doesn't read the port instead of IP:PORT just IP, however after reading through every IP I need to add all ports back in their right place again so it becomes IP:PORT again, but this part made my head spin a bit. Any help is highly appreciated! Thanks in advance. #include <ColorConstants.au3> ; Including required files #include <GUIConstantsEx.au3> #include <file.au3> #include <Array.au3> #include <string.au3> #include <StringConstants.au3> Example() Func Example() While 1 Local $ip Local $ips = "18k.txt" ;sets file path Local $strFileContents = FileRead($ips) $Arrayips = StringRegExp($strFileContents,'((?:\d+)(?:\.\d+){3})',3) For $i = 1 To UBound($Arrayips) - 1 ; Creating the object $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "http://mysite:8080/json/" & $Arrayips[$i], False) ; Post url ; Header data > $oHTTP.SetRequestHeader("Host", "mysite.xyz:8080") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0") $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.5") $oHTTP.SetRequestHeader("DNT", "1") $oHTTP.SetRequestHeader("Connection", "keep-alive") $oHTTP.SetRequestHeader("Cache-Control", "max-age=0") ; Header data < ; Performing the Request $oHTTP.Send() $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status If $oStatusCode <> 200 then MsgBox(4096, "Response code", $oStatusCode) ExitLoop EndIf $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists FileWrite($file, $oReceived) $read = FileRead("Received.html") ;read fil if StringInStr($read, '"US",') Then FileWrite("output.txt", $Arrayips[$i] & @CRLF) Else ContinueLoop EndIf ;Sends the post data with the given details Next WEnd EndFunc ;==>Example
  6. Hi there. I'm testing this code: #include "WinHttp.au3" ; http://www.w3schools.com/php/demo_form_validation_escapechar.php $sUserName = "SomeUserName" $sEmail = "some.email@something.com" $sDomain = "www.w3schools.com" $sPage = "/php/demo_form_validation_escapechar.php" ; Data to send $sAdditionalData = "name=" & $sUserName & "&email=" & $sEmail ; Initialize and get session handle $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hOpen = ' & $hOpen & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ; Get connection handle $hConnect = _WinHttpConnect($hOpen, $sDomain) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hConnect = ' & $hConnect & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ; Make a request $hRequest = _WinHttpOpenRequest($hConnect, "POST", $sPage) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hRequest = ' & $hRequest & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ; Send it. Specify additional data to send too. This is required by the Google API: $hSendRequest = _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $sAdditionalData) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hSendRequest = ' & $hSendRequest & @CRLF & '>Error code: ' & @error & @TAB & "@extended: " & @extended & @CRLF) ;### Debug Console ; Wait for the response $hReceiveResponse = _WinHttpReceiveResponse($hRequest) ; See what's returned Dim $sReturned If _WinHttpQueryDataAvailable($hRequest) Then ; if there is data Do $sReturned &= _WinHttpReadData($hRequest) Until @error EndIf ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; See what's returned ConsoleWrite("Returned: " & $sReturned & @CRLF) But sending a request fails. Console outputs this: >Running:(3.3.12.0) ... --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop @@ Debug(14) : $hOpen = 0x00000000007DF540 >Error code: 0 @@ Debug(18) : $hConnect = 0x00000000008271C0 >Error code: 0 @@ Debug(22) : $hRequest = 0x00000000008B88E0 >Error code: 0 @@ Debug(26) : $hSendRequest = 0 >Error code: 1 @extended: 0 Returned: +>17:00:18 AutoIt3.exe ended.rc:0 +>17:00:18 AutoIt3Wrapper Finished. >Exit code: 0    Time: 0.6003 I'm testing it at work. There, we always have to identify at a proxy to be allowed to go to internet. But requests via inet.au3 will work. Maybe our firewall will block the request? Any ideas? I don't have any possibilities to test at home, because of OSX. Regards, Conrad
  7. I have a script visiting a website of mine and I want it to change to a new proxy each run with an array(I think I got that covered and it should be working) but if this proxy is dead it gives me an error in AutoIT(Not so strange), but I want it to skip the proxy if its dead and go on the the next. I use $oHTTP.SetProxy(2, "proxy:port") everything works except for if proxy is dead or none responding etc.
  8. NetSession UDF 0.9d (Set embedded browser Internet options on a per-process basis) Welcome to NetSession UDF! With this UDF we provide you with previously unexposed Internet options for your autoit processes which will apply to embedded browser controls created with _IECreateEmbedded. For instance, you can now set a proxy and user-agent for all for your Autoit application's embedded browsers without using the registry settings. This means that you can now have multiple proxy settings for multiple programs/processses, giving each process it's own proxy/agent/other settings for your embedded browser controls and change them within each application as many times as you like. In other words, dynamic per-program (Not shared) Internet settings for any application containing an embedded browser control. There's also a function to clear all of your browser's cookies as well as all flash cookies. Versions: Version 0.9 includes the ability to set an HTTP/SOCKS4/SOCKS5 proxy and browser agent for individual AutoIt processes that can all be running at the same time with different settings. This is easy to use. This UDF started out as code that I worked on years ago and now we're bringing it back to life as a UDF with new features planned. Version 0.9b now has the new _ClearCookies function which will remove all IE and Flash cookies. Version 0.9c has added the "#include-once" directive as a UDF should and an optimization to the _ClearCookies function thanks to jdelaney. _ClearCookies has also been changed to return TRUE or FALSE rather than strings, not pause script execution when deleting IE cookies, and the hidden window flag added for Its shell command. Version 0.9d has the added function _UseTOR. This release comes just minutes after the last release because it slipped my mind that it was on the Planned Features list and is easy to add. This new function simply envokes _SetProxy with the proper parameters for TOR with the option to change the port if your install of TOR isn't using the default port number; otherwise, no parameter is necessary. This will likely be the last release until we have more updates to the DLL/Windows API calls. At the moment this UDF makes use of urlmon.dll to apply settings to your application executables. Our goal is to expose all functionality of this DLL as well as possibly expand into more functionality using other Windows API elements. Important: If you wish to change the settings of an IE control more than once during the life if your program you might have to refresh the IE control or GUI of your app before applying the next change. This was the case years ago. I'll do some testing on this and publish an update to the UDF or add an example of a refresh to the Example Usage. Example usage & notes: #include <NetSession-0.9d.au3> ; Let's include IE.au3 just for this example assuming you're making an embedded browser. #include <IE.au3> ; In this example you would create your embedded IE object and use as follows. _SetProxy('108.247.158.12:8080') ; Now your proxy is set. This would be an HTTP proxy. For SOCKS you would use: _SetProxy('socks=108.247.158.12:1080') ; Or if you have TOR running and would like to use it as your proxy simply use: _UseTOR() ; But if your TOR isn't running on default port 9150 (Like if you changed it to 9292) you must specify your TOR port: _UseTOR(9292) ; The following is an example of setting your user agent: _SetUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36') ; At this point any browsing you perform will use the previously set proxy and user agent. Such as: _IENavigate($ie,"http://www.ipchicken.com") ; If your proxy or SOCKS requires authentication you would add the proxy auth to the URL like this: _IENavigate($ie,"http://ProxyUser:ProxyPass@www.ipchicken.com") ; Let's clear all browser & Flash cookies _ClearCookies() ; Note that you can change these settings as many times as you need to in your application and these ; settings will only be applied to the .exe they were set from. This means you don't have to change ; the system-wide proxy or user-agent settings and can have per-.exe embedded browser settings. I welcome anyone who wants to contribute. Any suggestions will be much appreciated. The UDF NetSession-0.9d.au3 is attached to this post. The filename will always reflect the version number and this thread post will be kept up to date. I've chosen 0.9 because at this point we only need to figure out one more thing to consider it a complete 1.0. Version 1.0 will include an advanced authentication mechanism for proxies and socks servers (Better than passing proxy auth via the URL). The reason we want to use the authentication capabilities of the DLL is because when you pass authentication via the URL you can't access HTTPS sites through the proxy (You can if no proxy auth is required). If you can help make this UDF better by improving authentication as just previously mentioned or add any other functionality PLEASE don't hesitate to reply to this thread with some code. Here are the references to how this UDF came about and where you would look to help improve it: http://msdn.microsoft.com/en-us/library/ms775125%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa385148%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa385328%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa383630%28v=vs.85%29.aspx http://support.microsoft.com/kb/226473 Current Functions: _SetProxy(string $Proxy) - Sets an HTTP or SOCKS server for embedded IE browsers in the current process. _SetUserAgent(string $Agent) - Sets the user/browser agent for embedded IE browsers in the current process. _ClearCookies() - Deletes all IE and system Flash cookies. Returns a Boolean value. _UseTOR(int $TORPort = 9150) - Sets TOR as your proxy. You must have TOR running. $TORPort is only necessary if your TOR isn't using default 9150. TOR can be downloaded here: https://www.torproject.org/download/download-easy.html Planned Features: Proxy authentication via DLL rather than passing to URL. Function to set HTTP referrer. Support for other (Non-IE) embedded browsers. An ease-of-use function for setting TOR as the proxy server (This can currently be done manually). (Done) Compatability: All known versions of Windows since 2000/XP (Possibly earlier versions as well). Note: The settings applied by this UDF do not appear to affect functions such as InetGet. For those functions you would want to use HttpSetProxy. This UDF is for browser controls (which HttpSetProxy does not affect). Also, the browser must be embedded into the application as with _IECreateEmbedded. It will not work with a new window created with _IECreate. System Requirements: The existance of urlmon.dll on the system usually located in WindowsSystem32 Releases: NetSession-0.9.au3 {OLD} NetSession-0.9b.au3 {OLD} NetSession-0.9c.au3 {OLD} NetSession-0.9d.au3 {Newest} The changes in each version are detailed near the top of this post. !!! WE NEED HELP FOR THE NEXT RELEASE !!! Here's our current (not working) attempt to use a proxy's username & password without passing it in the URL. Without this capability we can't browse to HTTPS sites if proxy auth is required: Please help if you can Happy coding!
  9. You may have already seen the NetSession UDF thread. The code is really helpful for IE controls and there's no other known way to accomplish what it does. There are a few things that should be improved. The most important being able to pass proxy authentication to a proxy server using urlmon.dll or maybe some other windows API method alltogether. Here's our thread: '?do=embed' frameborder='0' data-embedContent>> Give it a read and be sure to check out the attempt to improve by SmOke_N: page-2#entry1220599'>page-2#entry1220599 Currently, since we have to pass proxy authentication via the URL, if the proxy requires authentication we can't access HTTPS sites with it (Apparently when using HTTPS you aren't allowed to pass auth in the URL). That's why we want to pass the auth through the DLL or any other method that will work with our embedded browser on a per-process basis. Thank you to anyone who can help make this UDF better.
  10. This problem has been figured out. Was very easy and no need for this thread anymore.
  11. Most of this code is from an similar project posted here. The difference is that this one uses 100% TCP. It is also just a skeleton of what it could achieve - and not limited like the other one was. So, what is meant by "Passive"? Unlike the other code... As the proxy receives data from the web server, it will immediately forward it to the browser. So, when you download a file, you will see it in real time from the browser, along with whatever progress dialog it may have. I consider this script a good start at what I'd like to see it become eventually -- If and when I find the time to work on it. Please let me know if any crashes, bugs or quirks. Thanks! Updated: August 31, 2014 - Various improvements. Known issues: - Some TCP functions do not work correctly in 64bit. I have not tried to track that down yet. - HTTPS is not supported yet. _TCP_PassiveProxyFilter_v0.3b.au3
  12. So I've been looking everywhere for an answer to this but I haven't managed to get anything to work. Below is the basic function to set a proxy for IE through the registry. Many say that I can simply write a proxy in the format "user:pass@server:port" to ProxyServer but that hasn't worked for me. I have also tried other suggestions such as creating a ProxyUser / ProxyPass key and writing credentials to those keys but still no dice. Func _IESetProxy($tProxy) If $tProxy="0" Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 0) Else RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $tProxy) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 1) EndIf EndFunc I believe this article from Microsoft may have something to do with it? http://support.microsoft.com/kb/834489/EN-US So I tried this (with 0 and 1 values): RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE") RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE", "iexplore.exe", "REG_DWORD", 0) RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE", "explorer.exe", "REG_DWORD", 0) and still no luck! Please! I desperately need help for this! Thanks a million in advance!
  13. Is it possible to use a different IP proxy before manipulating a web application or a web browser? If it is, then how can I achieve that? If not, then what is the alternative just to use a different IP proxy before web application manipulation? Thanks in advanced..
  14. Hi, I'm trying all day to write a working proxy server, but it still doesn't work correctly. I'm not good at network functions, so maybe I've forgot about something. It should receive, modify and send data between a browser and web server. Here is a code. I just added a short comments. I hope it will make the script more readably. #Region Tables #include <Array.au3> Global $sProxyIP = @IPAddress1, $iProxyPort = 8080, $iProxySocket = -1 Global $iNewSocket, $asLines[0], $sHost, $iLen Global $aiBrowserSocket[0], $asBrowserRecv[0], $aiServerSocket[0], $asServerRecv[0], $aiServerContentLen[0] #EndRegion Tables #Region Initialization If Not TCPStartup() Then Exit @ScriptLineNumber $iProxySocket = TCPListen($sProxyIP, $iProxyPort) If @error Then Exit @ScriptLineNumber #EndRegion Initialization While 1 ;Accepting new sockets $iNewSocket = TCPAccept($iProxySocket) If $iNewSocket >= 0 Then ProxyAddArray($iNewSocket) ;Browser --> Proxy For $socket = 0 To UBound($asBrowserRecv) - 1 $asBrowserRecv[$socket] = BinaryToString(TCPRecv($aiBrowserSocket[$socket], 1024 ^ 2)) If @error Then ProxyDeleteArray($socket) $socket += 1 ContinueLoop EndIf Next ;Browser data analyzing For $socket = 0 To UBound($asBrowserRecv) - 1 $sHost = '' $asLines = StringSplit($asBrowserRecv[$socket], @CRLF, 1) For $line = 1 To $asLines[0] If StringLeft($asLines[$line], 4) = 'Host' Then $sHost = StringTrimLeft($asLines[$line], 6) ExitLoop EndIf Next $aiServerSocket[$socket] = TCPConnect(TCPNameToIP($sHost), 80) If @error Then ProxyDeleteArray($socket) $socket += 1 ContinueLoop EndIf Next ;Proxy --> Web Page For $socket = 0 To UBound($aiServerSocket) - 1 If $aiServerSocket[$socket] < 0 Then ContinueLoop $asServerRecv[$socket] = TCPSend($aiServerSocket[$socket], $asBrowserRecv[$socket]) If @error Then $aiServerSocket[$socket] = -1 Next ;Web Page --> Proxy For $socket = 0 To UBound($aiServerSocket) - 1 If $aiServerSocket[$socket] < 0 Then ContinueLoop $iLen = 0 $asServerRecv[$socket] = BinaryToString(TCPRecv($aiServerSocket[$socket], 1024 ^ 2 * 10)) If StringLen($asServerRecv[$socket]) = 0 Then ContinueLoop $asLines = StringSplit($asServerRecv[$socket], @CRLF, 1) If @error Then $aiServerSocket[$socket] = -1 For $line = 1 To $asLines[0] ;Data lenght If StringLeft($asLines[$line], 14) = 'Content-Length' Then $iLen = StringTrimLeft($asLines[$line], 16) $aiServerContentLen[$socket] = $iLen ExitLoop EndIf Next Next ;Proxy --> Browser For $socket = 0 To UBound($aiBrowserSocket) - 1 If $aiServerContentLen[$socket] > StringLen($asBrowserRecv[$socket]) Then ContinueLoop TCPSend($aiBrowserSocket[$socket], $asServerRecv[$socket]) Next WEnd #Region Proxy Func ProxyAddArray($iSocket) _ArrayAdd($aiBrowserSocket, $iSocket) _ArrayAdd($asBrowserRecv, '') _ArrayAdd($aiServerSocket, -1) _ArrayAdd($asServerRecv, '') _ArrayAdd($aiServerContentLen, 0) EndFunc ;==>ProxyAddArray Func ProxyDeleteArray($iIndex) _ArrayAdd($aiBrowserSocket, $iIndex) _ArrayAdd($asBrowserRecv, $iIndex) _ArrayAdd($aiServerSocket, $iIndex) _ArrayAdd($asServerRecv, $iIndex) _ArrayAdd($aiServerContentLen, $iIndex) EndFunc ;==>ProxyDeleteArray #EndRegion Proxy Important: Before you will check this, you should change connection setting in your web browser. And please do not post links to other old proxy server from Autoit Forums. I've tried them all.
×
×
  • Create New...