自动代理IE对象

时间:2012-07-01 13:44:46

标签: browser proxy ip autoit

我想使用代理来掩盖我在网上冲浪的自动浏览器! 这是我的代码:

#NoTrayIcon
#include <GUIConstants.au3>
#Include <IE.au3>
#include <GUIConstantsEx.au3>
GUICreate("Web Browser By EMP£!!",800,600)
GUISetBkColor(0x808080)
GUISetState(@SW_SHOW)
$Edit=GUICtrlCreateInput("http://www.whatismyip.com/",20,20,500,20)
$Vai=GUICtrlCreateButton("SURF!!!",600,10,150,50)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 10, 90,780, 500)
$ret = HttpSetProxy(2,"61.163.78.51:3128")
If $ret == 0 Then
    MsgBox(0, "Proxy", "Proxy Error")
    Exit
EndIf
While 1
 $msg=GUIGetMsg()
     Switch $msg
     Case $Vai
$Link=GUICtrlRead($Edit)
_IENavigate($oIE,($Link))
   GUICtrlSetData($Edit,$Link)
  Case $GUI_EVENT_CLOSE
   Exit
       EndSwitch
WEnd

我在http://www.whatismyip.com/上导航,我可以看到我的真实IP地址!我想隐藏一个代理!

1 个答案:

答案 0 :(得分:1)

HttpSetProxy功能仅适用于InetGet,它对Internet Explorer设置没有任何影响。要为Internet Explorer窗口创建代理,您需要更改Internet Explorer设置。

我这样做的方式如下:

#include <GUIConstants.au3>
#include <IE.au3>
#include <GUIConstantsEx.au3>

Global Const $sInetSettingsKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

GUICreate("Web Browser By EMP£!!", 800, 600)
GUISetBkColor(0x808080)
GUISetState(@SW_SHOW)
$Edit = GUICtrlCreateInput("http://www.whatismyip.com/", 20, 20, 500, 20)
$Vai = GUICtrlCreateButton("SURF!!!", 600, 10, 150, 50)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 10, 90, 780, 500)

MySetProxy("61.163.78.51:3128")

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Vai
            $Link = GUICtrlRead($Edit)
            _IENavigate($oIE, ($Link))
            GUICtrlSetData($Edit, $Link)
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

MySetProxy()

Func MySetProxy($sProxy = "", $fEnable = True)
    Local Static $sPrev = ""
    Local Static $fWasEnabled = False

    If $sProxy = "" Then
        If $sPrev <> "" Then __setProxyInfo($fWasEnabled, $sPrev)
    Else
        If $sPrev = "" Then
            $sPrev = RegRead($sInetSettingsKey, "ProxyServer")
            $fWasEnabled = RegRead($sInetSettingsKey, "ProxyEnable")
        EndIf

        __setProxyInfo($fEnable, $sProxy)
    EndIf
EndFunc

Func __setProxyInfo($fEnabled, $sProxy)
    RegWrite($sInetSettingsKey, "ProxyEnable", "REG_DWORD", 1)
    RegWrite($sInetSettingsKey, "ProxyServer", "REG_SZ", $sProxy)
EndFunc

whatismyip.com不喜欢它。但IP地址肯定发生了变化。