Jump to content

Proxy Connecter help please


Recommended Posts

;;;;;;;;;;;; Proxyz Buddy; Version 0.0.1; AutoIt v3

;Presets
#include <GUIConstants.au3>
Opt("TrayIconHide", 1)
Opt("MouseCoordMode", 3)
;Pre Bindables
$GUItitle = "ProxyzBuddy v0.0.1"

;References

;GUI Creation
$Form1 = GUICreate($GUItitle, 208, 329, 321, 125)
$Label1 = GUICtrlCreateLabel("Proxy IP Address", 32, 32, 140, 17)
$Input1 = GUICtrlCreateInput("Syntax: 68.40.312.162", 32, 48, 145, 21)
$Label2 = GUICtrlCreateLabel("Proxy IP Port", 32, 80, 140, 17)
$Input2 = GUICtrlCreateInput("Syntax: 1080", 32, 96, 145, 21)
$Radio1 = GUICtrlCreateRadio("Enable Proxy IP", 32, 146, 113, 17)
$Button1 = GUICtrlCreateButton("Connect", 8, 192, 81, 41, 0)
$Button2 = GUICtrlCreateButton("Disable", 112, 192, 81, 41, 0)
$Label3 = GUICtrlCreateLabel($GUItitle, 16, 272, 172, 17)
$Label4 = GUICtrlCreateLabel("Copyright: Ace Coding Development", 16, 256, 172, 17)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem5 = GUICtrlCreateMenuItem("Save", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Load", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("Quit PzB", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("About")
$MenuItem7 = GUICtrlCreateMenuItem("About Us", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("Help")
$MenuItem9 = GUICtrlCreateMenuItem("Forums", $MenuItem3)
$Icon1 = GUICtrlCreateIcon("Aces-X.ico", "Aces-X", 170, 5)
GUICtrlSetFont($Label1, 9, 1000)
GUICtrlSetFont($Label2, 9, 1000)
GUICtrlSetFont($Radio1, 9, 1000)
GUICtrlSetFont($Button1, 12)
GUICtrlSetBkColor($Button1, 0x000000)
GUICtrlSetColor($Button1, 0x00FF00)
GUICtrlSetFont($Button2, 12)
GUICtrlSetBkColor($Button2, 0x000000)
GUICtrlSetColor($Button2, 0xCC0000)
GUISetBkColor(0x006699)
GUISetState(@SW_SHOW)

;Main Script
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            $Input1Read = GUICtrlRead($Input1)
            $Input2Read = GUICtrlRead($Input2)
            $ServerSocket = TCPConnect($Input1Read, $Input2Read)
            $MainSocket = TCPListen("127.0.0.1", $Input2Read)
            $ClientSocket = TCPAccept($MainSocket)
            TCPCloseSocket($ServerSocket)
            TCPCloseSocket($ClientSocket)
            TCPCloseSocket($MainSocket)
            TCPShutdown()
            Exit
        Case $msg = $MenuItem5
            If SaveSettings() = 0 Then
                MsgBox(0, $GUItitle, "SaveSettings ERROR")
            EndIf
        Case $msg = $MenuItem6
            If Quit() = 0 Then
                MsgBox(0, $GUItitle, "Quit ERROR")
            EndIf
        Case $msg = $Button1
            If Connect() = 0 Then
                MsgBox(0, $GUItitle, "Connect ERROR")
            EndIf
        Case $msg = $Button2
            If Disable() = 0 Then
                MsgBox(0, $GUItitle, "Disable ERROR")
            EndIf
        Case $msg = $MenuItem4
            If LoadSettings() = 0 Then
                MsgBox(0, $GUItitle, "LoadSettings ERROR")
            EndIf
    EndSelect
WEnd

;Functions
Func SaveSettings()
    $Save = FileSaveDialog("Save Config File...", @SCRIPTDIR, "Configuration File (*.ini)|All (*.*)", 16, "PzB_Config.ini")
    IniWrite($Save, "Settings", "ProxyIP", GUICtrlRead($Input1))
    IniWrite($Save, "Settings", "ProxyPort", GUICtrlRead($Input2))
    If IniWrite($Save, "Settings", "ProxyPort", GUICtrlRead($Input2)) = 1 Then
        MsgBox(0, $GUItitle, "Settings have been saved!")
    ElseIf IniWrite($Save, "Settings", "ProxyPort", GUICtrlRead($Input2)) = 0 Then
        MsgBox(0, $GUItitle, "Settings have not been saved!")
    EndIf
    Return 1
EndFunc

Func LoadSettings()
    $Open = FileOpenDialog("Open Config File...", @SCRIPTDIR, "Configuration File (*.ini)|All (*.*)", 16, "PzB_Config.ini")
    $ProxyIP = IniRead($Open, "Settings", "ProxyIP", "")
    $ProxyPort = IniRead($Open, "Settings", "ProxyPort", "")
    GUICtrlSetData($Input1, $ProxyIP)
    GUICtrlSetData($Input2, $ProxyPort)
    MsgBox(0, $GUItitle, "Configurations have been loaded!")
    Return 1
EndFunc

Func Quit()
    $QuitBox = MsgBox(4, $GUItitle, "Are you sure you want to quit ProxyzBuddy?")
    If $QuitBox = 6 Then
        $Input1Read = GUICtrlRead($Input1)
        $Input2Read = GUICtrlRead($Input2)
        $ServerSocket = TCPConnect($Input1Read, $Input2Read)
        $MainSocket = TCPListen("192.168.0.101", $Input2Read)
        $ClientSocket = TCPAccept($MainSocket)
        TCPCloseSocket($ServerSocket)
        TCPCloseSocket($ClientSocket)
        TCPCloseSocket($MainSocket)
        TCPShutdown()
        Exit
    ElseIf $QuitBox = 7 Then
        MsgBox(0, $GUItitle, "Returning to ProxyzBuddy...")
    EndIf
    Return 1
EndFunc

Func Connect()
    $ConnectBox = MsgBox(4, $GUItitle, "Are you sure you want to connect to your proxy settings?")
    If $ConnectBox = 6 Then
        GUICtrlSetState($Radio1, $GUI_CHECKED)
        TCPStartup()
        $Input2Read = GUICtrlRead($Input2)
        $MainSocket = TCPListen("192.168.0.101", $Input2Read)
        $ClientSocket = TCPAccept($MainSocket)
        While $ClientSocket = -1
            $ClientSocket = TCPAccept($MainSocket)
        WEnd
        $Input1Read = GUICtrlRead($Input1)
        $Input2Read = GUICtrlRead($Input2)
        TCPConnect($Input1, $Input2)
        While 1
            $Input1Read = GUICtrlRead($Input1)
            $Input2Read = GUICtrlRead($Input2)
            $ServerSocket = TCPConnect($Input1Read, $Input2Read)
            $recv = TCPRecv($ClientSocket, 131072)
            TCPSend($ServerSocket, $recv)
            $recv = TCPRecv($ServerSocket, 131072)
            TCPSend($ClientSocket, $recv)
            ExitLoop
        WEnd
        $Input1Read = GUICtrlRead($Input1)
        $Input2Read = GUICtrlRead($Input2)
        MsgBox(0, $GUItitle, "You have connected to " & $Input1Read & ":" & $Input2Read)
    ElseIf $ConnectBox = 7 Then
        $Input1Read = GUICtrlRead($Input1)
        $Input2Read = GUICtrlRead($Input2)
        MsgBox(0, $GUItitle, "Connecting to " & $Input1Read & ":" & $Input2Read & " has been canceled!")
    EndIf
    Return 1
EndFunc

Func Disable()
    $DisableBox = MsgBox(4, $GUItitle, "Are you sure you want to disable proxy settings?")
    If $DisableBox = 6 Then
        $Input1Read = GUICtrlRead($Input1)
        $Input2Read = GUICtrlRead($Input2)
        $ServerSocket = TCPConnect($Input1Read, $Input2Read)
        $MainSocket = TCPListen("192.168.0.101", $Input2Read)
        $ClientSocket = TCPAccept($MainSocket)
        GUICtrlSetState($Radio1, $GUI_UNCHECKED)
        TCPCloseSocket($ServerSocket)
        TCPCloseSocket($ClientSocket)
        TCPCloseSocket($MainSocket)
        TCPShutdown()
        MsgBox(0, $GUItitle, "Your proxy settings have been disabled!")
    ElseIf $DisableBox = 7 Then
        MsgBox(0, $GUItitle, "Your proxy settings will not be disabled!")
    EndIf
    Return 1
EndFunc

suppose to connect to proxy i specify, any reason why it doesnt work?

the script stops in the Connect() function

Edited by Aces

~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

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