Jump to content

Using HttpSetProxy or Setting IEProxy through registry


 Share

Recommended Posts

Hello!

Like it is said in the title i want to use HttpSetProxy or change the IE-Settings over the registry or... do anything that lets me enter the internet through a proxy(except browserproxys).

Unfortunately it doesnt work. The autoitdocs say that HttpSetProxy only works with CERN -proxys.

I didnt find a real definition for this term, but from what ive read its a proxy which only interacts through the http-protocol; so its always in the form: "www.website.de:Port" ...,is it??

Ive found various proxy programmes but not one of them seems to have cern-proxys and the usual proxys with the form: "ipadresse: port" dont work.

#include <IE.au3>
$e=HttpSetProxy(2,"130.88.203.27:3124")
sleep(5000)
$so=_IECreate("http://www.wieistmeineip.de")

Because this didnt work i tried to change the IE-settings (HttpSetProxy doesnt change IESettings anyways, only uses the proxy while doing the script).

This could be done by changing it in the registry. (i dont know what its called if english is system language, but you should find the registry under start-execute-regedit)

#include <IE.au3>
regwrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\","ProxyEnable","REG_DWORD","1")
regwrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\","ProxyServer","REG_SZ","130.88.203.27:3124")
sleep(5000)
$so=_IECreate("http://www.wieistmeineip.de")

When changing the IESettings within itself by hand these two registry are the ones that are changed and the proxy shown also works. But if you run the script above only the registry entries are changed, but not applied on IE... how can i make this work?

thanx in advance to anyone that tries to help:)

Link to comment
Share on other sites

Try this save your proxies in text file like this

127.0.0.1:8080

192.168.0.1:8080

#include <IE.au3>
#include<file.au3>

Dim $array
_FileReadToArray("Proxy.txt", $array)




While 1

for  $i = 1 To $array[0] 


$proxywrite = RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $array[$i])    
if $proxywrite = 1 Then


$proxyone =  RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1") 
if $proxyone = 1 Then


$oIE  = _IECreate ("http://google.com" , 1, 1, 0)
_IELoadWait ($oIE )
Sleep(8000)
_IEQuit ($oIE)

Else
          MsgBox(64, "Error", "Reg Proxy 0x2")
EndIf

Else
    
MsgBox(64, "Error", "Reg Proxy 0x1")
    
EndIf

Next




WEnd
Edited by autoitxp
Link to comment
Share on other sites

@autoitxp

Maybe this can get you started

Const $HKEY_CURRENT_USER = 0x80000001

$strComputer = "."
$objRegistry = ObjGet("winmgmts:\\" & $strComputer & "\root\default:StdRegProv")
 
$strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"

$strValueName = "ProxyEnable"
$dwValue = 1
$objRegistry.SetDWORDValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $dwValue)

$strValueName = "ProxyServer"
$strValue = "svcproxy:80"
$objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue)

$strValueName = "ProxyOverride"
$strValue = "<local>"
$objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue)

regards,

ptrex

Link to comment
Share on other sites

Hi,

I cannot get HttpSetProxy working either. Tried it in our company network. Perl wroks fine.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I did one of my own before the HTTPProxy command was added.

this is the basic script

CODE

; This script toggles Proxy setting for IE

; by Troy Hirschfelt

;Version 2.0.0.5

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1)

GUICreate("Proxy Control", 300, 120)

GUISetFont(12,600)

$Label = GUICtrlCreateLabel("Select Your Proxy Setting", 10, 10)

GUISetFont(9,400)

$ID1 = GUICtrlCreateButton("Proxy One", 10, 50, 90, 20)

GUICtrlSetOnEvent($ID1,"ID1")

$ID2 = GUICtrlCreateButton("Proxy Two", 100, 50, 90, 20)

GUICtrlSetOnEvent($ID2,"ID2")

$AutoID = GUICtrlCreateButton("Auto Proxy", 190, 50, 90, 20)

GUICtrlSetOnEvent($AutoID,"AutoOn")

$ExitID = GUICtrlCreateButton("Exit", 190, 80, 90, 20)

GUICtrlSetOnEvent($ExitID,"OnExit")

GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")

GUISetState() ; display the GUI

While 1

; Sleep (1000)

WEnd

;--------------- Functions ---------------

Func ID1() ;Proxy one settings

;Remove Reg Entries

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings")

;Write New Reg Entries

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1" )

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "ftp=proxy1.com:21;gopher=proxy1.com:80;http=proxy1.com:80;https=proxy1.com:443")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", "192.*;*.proxy1.com;<local>")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings", "REG_BINARY", "GET THIS DATA FROM REGEDIT and remove the commas")

MsgBox(64, "Proxy One Selected","Setting Proxy One Network",5)

Exit

EndFunc

Func ID2() ;Proxy two settings

;Remove Reg Entries

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings")

;Write New Reg Entries

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1" )

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "www.proxy2.com:80")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", "1.*.*.*;*.proxy2.net;<local>")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings", "REG_BINARY", "GET THIS DATA FROM REGEDIT and remove the commas")

MsgBox(64, "Proxy Two Selected","Setting Proxy Two Network" & @LF & "Make sure this is working for you",5)

Exit

EndFunc

Func AutoOn() ;Auto Proxy settings

;Remove Reg Entries

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings")

;Write New Reg Entries

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings", "REG_BINARY", "GET THIS DATA FROM REGEDIT and remove the commas")

MsgBox(64, "Proxy - Auto","Setting Proxy to Automatic for Home Use",5)

Exit

EndFunc

Func OnExit()

if @GUI_CtrlId = $ExitId Then

EndIf

MsgBox(48, "Canceled","Nothing Was Changed",5)

Exit

EndFunc

MAKE SURE you get the registry info and place it in the apropriate fields I listed above.

That is to say, wherever you see the words "GET THIS DATA FROM REGEDIT and remove the commas"

Edited by hirschy
Link to comment
Share on other sites

  • 3 weeks later...

hey hirschy...I'm trying to setup some proxy functions on my computer. I noticed the only item in this place....

"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"

is called "SavedLegacySettings" I'm running windows XP pro sp2. Where can I find this information? do i just need to enable them in IE and test it out?

I did one of my own before the HTTPProxy command was added.

this is the basic script

CODE

; This script toggles Proxy setting for IE

; by Troy Hirschfelt

;Version 2.0.0.5

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1)

GUICreate("Proxy Control", 300, 120)

GUISetFont(12,600)

$Label = GUICtrlCreateLabel("Select Your Proxy Setting", 10, 10)

GUISetFont(9,400)

$ID1 = GUICtrlCreateButton("Proxy One", 10, 50, 90, 20)

GUICtrlSetOnEvent($ID1,"ID1")

$ID2 = GUICtrlCreateButton("Proxy Two", 100, 50, 90, 20)

GUICtrlSetOnEvent($ID2,"ID2")

$AutoID = GUICtrlCreateButton("Auto Proxy", 190, 50, 90, 20)

GUICtrlSetOnEvent($AutoID,"AutoOn")

$ExitID = GUICtrlCreateButton("Exit", 190, 80, 90, 20)

GUICtrlSetOnEvent($ExitID,"OnExit")

GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")

GUISetState() ; display the GUI

While 1

; Sleep (1000)

WEnd

;--------------- Functions ---------------

Func ID1() ;Proxy one settings

;Remove Reg Entries

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings")

;Write New Reg Entries

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1" )

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "ftp=proxy1.com:21;gopher=proxy1.com:80;http=proxy1.com:80;https=proxy1.com:443")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", "192.*;*.proxy1.com;<local>")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings", "REG_BINARY", "GET THIS DATA FROM REGEDIT and remove the commas")

MsgBox(64, "Proxy One Selected","Setting Proxy One Network",5)

Exit

EndFunc

Func ID2() ;Proxy two settings

;Remove Reg Entries

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings")

;Write New Reg Entries

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1" )

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "www.proxy2.com:80")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", "1.*.*.*;*.proxy2.net;<local>")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings", "REG_BINARY", "GET THIS DATA FROM REGEDIT and remove the commas")

MsgBox(64, "Proxy Two Selected","Setting Proxy Two Network" & @LF & "Make sure this is working for you",5)

Exit

EndFunc

Func AutoOn() ;Auto Proxy settings

;Remove Reg Entries

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride")

RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings")

;Write New Reg Entries

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1")

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings", "REG_BINARY", "GET THIS DATA FROM REGEDIT and remove the commas")

MsgBox(64, "Proxy - Auto","Setting Proxy to Automatic for Home Use",5)

Exit

EndFunc

Func OnExit()

if @GUI_CtrlId = $ExitId Then

EndIf

MsgBox(48, "Canceled","Nothing Was Changed",5)

Exit

EndFunc

MAKE SURE you get the registry info and place it in the apropriate fields I listed above.

That is to say, wherever you see the words "GET THIS DATA FROM REGEDIT and remove the commas"

Link to comment
Share on other sites

maybe this can help i made this little tool to laptop user here , it switch from proxy on and off , it create backup of what have been push by the domain b4 it change the state. i did not want to push a fix setting in case proxy or proxy setting change , it live no need to restart IE .

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

;Var

global $lineOV , $linePS , $var ,$var1 , $state,$stateB

global $ZonesKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\"

$stateB = 0

;Fonction

Func STATE()

$state = RegRead($ZonesKey , "ProxyEnable")

If $state = 1 Then

$stateB = GuiCtrlCreateLabel("Proxy on", 10, 220, 120, 25)

GuiCtrlSetBkColor(-1, 0xf0f0f0 )

Else

Sleep(100)

EndIf

IF $state = 0 Then

$stateB = GuiCtrlCreateLabel("Proxy off", 10, 220, 120, 25)

GuiCtrlSetBkColor(-1, 0xf0f0f0 )

Else

Sleep(100)

EndIf

EndFunc

Func REG()

;reg bck

$var = RegRead($ZonesKey, "ProxyOverride")

$var1 = RegRead($ZonesKey, "ProxyServer")

RegWrite($zoneskey, "ProxyOverride.Backup" ,"REG_SZ", $var)

RegWrite($zoneskey, "ProxyServer.Backup" ,"REG_SZ", $var1)

EndFunc

Func btnClick() ;proxy on

$ProxyEnable= 1

;$ProxyServer= $linePS

;$ProxyOverride= $lineOV

RegWrite($ZonesKey , "ProxyEnable", "REG_DWORD", $ProxyEnable)

RegWrite($ZonesKey , "$ProxyServer", "REG_SZ", $var1)

RegWrite($ZonesKey , "$ProxyOverride", "REG_SZ", $var)

DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

$GraphicV = GUICtrlCreateGraphic(70, 90, 40,40)

GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00FF00,0x00FF00)

GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 0,0, 40,40)

GUICtrlSetState(-1,$GUI_SHOW)

$GraphicR = GUICtrlCreateGraphic(70, 30, 40, 40)

GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000,0xff0000)

GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 0,0, 40,40)

GUICtrlSetState(-1,$GUI_SHOW)

;GuiCtrlCreateLabel("", 70, 90, 40, 40)

;GuiCtrlSetBkColor(-1, 0x00FF00) ;vert

EndFunc

Func btnClick1()

$ProxyEnable= 0 ;proxy off

RegWrite($ZonesKey , "ProxyEnable", "REG_DWORD", $ProxyEnable)

DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

$GraphicV = GUICtrlCreateGraphic(70, 30, 40,40)

GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00FF00,0x00FF00)

GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 0,0, 40,40)

GUICtrlSetState(-1,$GUI_SHOW)

$GraphicR = GUICtrlCreateGraphic(70, 90, 40, 40)

GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000,0xff0000)

GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 0,0, 40,40)

GUICtrlSetState(-1,$GUI_SHOW)

EndFunc

Func btnClick2()

;quit key

Exit

EndFunc

Func SpecialEvents() ;Exit fonction

Exit

EndFunc

;regbck

REG()

;GUI CODE

GuiCreate("Proxy", 200, 260,-1, -1 , -1)

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") ;Fix exit

$Group1 = GuiCtrlCreateGroup("Proxy Etat", 10, 10, 120, 200)

$icon = GUICtrlCreateButton ("" ,20,30,32,32, BitOR($BS_PUSHLIKE,$BS_ICON))

GUICtrlSetImage (-1, "shell32.dll",13)

GUICtrlSetOnEvent($Icon, "btnClick1")

GUICtrlSetTip($icon,"Proxy OFF")

$n1 = GUICtrlCreateButton ("" ,20,90,32,32, BitOR($BS_PUSHLIKE,$BS_ICON))

GUICtrlSetImage (-1, @ProgramFilesDir & '\Internet Explorer\iexplore.exe',00)

GUICtrlSetOnEvent($n1, "btnClick")

GUICtrlSetTip($n1,"Proxy on")

$n2 = GUICtrlCreateButton ("" ,20,150,32,32, BitOR($BS_PUSHLIKE,$BS_ICON))

GUICtrlSetImage (-1, "shell32.dll",27)

GUICtrlSetOnEvent($n2, "btnClick2")

GUICtrlSetTip($n2,"EXIT")

GUISetState ()

While 1

$msg = GUIGetMsg()

$stateB = STATE()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

sleep(1000)

Wend

Edited by Vaner
Link to comment
Share on other sites

  • 4 months later...

Here a short code for use proxie created by me :)

$IP= "255.255.255.255"
$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.Navigate("http://whatismyipaddress.com/", Default, Default, Default, "X-Forwarded-For:" & $IP)

If you see, the code dont need of any include libraries, the result: more faster program and low resources consumption.

Anybody can say me how to fake the proxie detection? I need put the X-Forwarded-For in default_header but I don't know how to.

Thanks!

P/D: Sorry for my bad english!

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...