Sign in to follow this  
Followers 0
krait

Local IP address Refresh

2 posts in this topic

hi i am new here

i would like to refresh my local ip, without closing my autoit app, how do i do it ?

this is my full code

#RequireAdmin
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
Global $nmsg, $tmsg
Opt("TrayMenuMode", 1)
$RestoreTray = TrayCreateItem("Restore")

#Region ### START Koda GUI section ###
$ini1 = IniRead(@ScriptDir & "\data.ini", "Settings", "HOST", "")
$ini2 = IniRead(@ScriptDir & "\data.ini", "Settings", "PORT", "")
$ini3 = IniRead(@ScriptDir & "\data.ini", "Settings", "USERNAME", "")
$ini4 = IniRead(@ScriptDir & "\data.ini", "Settings", "PASSWORD", "")
$ini5 = IniRead(@ScriptDir & "\data.ini", "Settings", "HOST PROXY", "")
$ini6 = IniRead(@ScriptDir & "\data.ini", "Settings", "PORT PROXY", "")
$form1 = GUICreate("TEST", 345, 289, -1, -1)
$menuitem1 = GUICtrlCreateMenu("&FILE")
$savecfg = GUICtrlCreateMenuItem("SAVE", $menuitem1)
$tutor = GUICtrlCreateMenuItem("PETUNJUK", $menuitem1)
$keluar = GUICtrlCreateMenuItem("KELUAR", $menuitem1)
$menuitem2 = GUICtrlCreateMenu("&TOOLS")
$bwpro = GUICtrlCreateMenuItem("BANDWITH METER", $menuitem2)
$mdma = GUICtrlCreateMenuItem("MDMA", $menuitem2)
$route = GUICtrlCreateMenuItem("ROUTE", $menuitem2)
$tcpmon = GUICtrlCreateMenuItem("TCP/IP Monitor", $menuitem2)
$rekonek = GUICtrlCreateMenuItem("RECONNECTION", $menuitem2)
GUISetBkColor(26316)
$group1 = GUICtrlCreateGroup("SSH SERVER", 8, 8, 217, 73)
GUICtrlSetColor(-1, 16776960)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$input1 = GUICtrlCreateInput($ini1, 80, 24, 129, 21)
GUICtrlSetColor(-1, 255)
$input2 = GUICtrlCreateInput($ini2, 80, 48, 129, 21)
GUICtrlSetColor(-1, 255)
$label1 = GUICtrlCreateLabel("HOST", 16, 32, 38, 17)
GUICtrlSetColor(-1, 16776960)
$label2 = GUICtrlCreateLabel("PORT", 16, 56, 38, 17)
GUICtrlSetColor(-1, 16776960)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$group2 = GUICtrlCreateGroup("AUTHENTICATION", 8, 88, 217, 73)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 16776960)
$input3 = GUICtrlCreateInput($ini3, 80, 104, 129, 21)
GUICtrlSetColor(-1, 255)
$input4 = GUICtrlCreateInput($ini4, 80, 128, 129, 21, $es_password)
GUICtrlSetColor(-1, 255)
$label3 = GUICtrlCreateLabel("USER", 16, 112, 38, 17)
GUICtrlSetColor(-1, 16776960)
$label4 = GUICtrlCreateLabel("PASS", 16, 136, 36, 17)
GUICtrlSetColor(-1, 16776960)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$group3 = GUICtrlCreateGroup("PROXY SETTING", 8, 168, 217, 73)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$input5 = GUICtrlCreateInput($ini5, 80, 184, 70, 21)
GUICtrlSetColor(-1, 255)
$input6 = GUICtrlCreateInput($ini6, 80, 208, 70, 21)
GUICtrlSetColor(-1, 255)
$label5 = GUICtrlCreateLabel("PROXY", 16, 192, 46, 17)
GUICtrlSetColor(-1, 16776960)
$label6 = GUICtrlCreateLabel("PORT", 16, 216, 38, 17)
GUICtrlSetColor(-1, 16776960)
$Checkbox = GUICtrlCreateCheckbox("Use Proxy", 155, 192, 65, 25)
GUICtrlSetColor(-1, 16776960)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$group4 = GUICtrlCreateGroup("CONNECTION", 232, 8, 105, 233)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$radio1 = GUICtrlCreateRadio("1 SSH", 255, 22, 65, 25)
$radio2 = GUICtrlCreateRadio("2 SSH", 255, 46, 65, 25)
$folder = GUICtrlCreateButton("FOLDER", 248, 72, 73, 33)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
GUICtrlSetCursor(-1, 0)
$login = GUICtrlCreateButton("LOGIN", 248, 112, 73, 33)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
GUICtrlSetCursor (-1, 0)
$logout = GUICtrlCreateButton("LOGOUT", 248, 152, 73, 33)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
GUICtrlSetCursor (-1, 0)
$exit = GUICtrlCreateButton("EXIT", 248, 192, 73, 33)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
GUICtrlSetCursor (-1, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$label8 = GUICtrlCreatelabel(@IPaddress1, 155, 248, 163, 17)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 65280)
GUISetState()
#EndRegion ### END Koda GUI section ###

;Opt('MustDeclareVars', 1)

While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg
    
        Case $exit
            keluar()
        Case $savecfg
            simpancfg()
        Case $login
            login()
        Case $logout()
            logout()
        Case $keluar
            metu()
        Case $tutor
            petunjuk()
        Case $bwpro
            bwpro()
        Case $mdma
            mdma()
        Case $rekonek
            rekonek()
        Case $route
            roti()
        Case $tcpmon
            tcpmon()    
        Case $folder
            folder()
        Case -3
            Exit
        Case $GUI_event_minimize
            minimize($form1)    
            
    EndSwitch
    
        $tmsg = TrayGetMsg()
        Switch $tmsg    
        Case $RestoreTray
            maximize($form1)    
    EndSwitch   
    
WEnd


Func mdma()
    If $mdma = True Then
        Run(@ScriptDir & "\files\MDMA.exe")
    EndIf
EndFunc

Func bwpro()
    If $bwpro = True Then
        Run(@ScriptDir & "\files\BWMeterPro.exe")
    EndIf
EndFunc

Func folder()
    if $folder  = True Then
        ShellExecute(@ScriptDir &"\files")
    Endif
EndFunc

Func roti()
    If $route = True Then
        Run(@ScriptDir & "\files\route.exe")
    EndIf
EndFunc

Func tcpmon()
    If $route = True Then
        Run(@ScriptDir & "\files\tcpmon.exe")
    EndIf
EndFunc

Func rekonek()
    If $rekonek = True Then
        Run(@ScriptDir & "\files\ReConnect.exe")
    EndIf
EndFunc

Func petunjuk()
    If $tutor = True Then
        MsgBox(64, "PETUNJUK", "Masukkan detail account anda ke dalam setiap kolom yangg sudah disediakan (HOST, PORT, USERNAME, PASSWORD). Jika ingin menyimpan data anda silahkan klik tombol SAVE. Jika ingin menggunakan proxy, silahkan input 'y' pada box USE PROXY & jika tidak input 'n'")
    EndIf
EndFunc

Func keluar()
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("Proxifier.exe") Then ProcessClose("Proxifier.exe")
    Sleep(10)
    Exit 
EndFunc

Func logout()
    GUICtrlSetState($login, $gui_enable)
    GUICtrlSetState($logout, $gui_disable)
    GUICtrlSetState($exit, $gui_enable)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("Proxifier.exe") Then ProcessClose("Proxifier.exe")
    Sleep(10)
EndFunc

Func simpancfg()
    IniWrite(@ScriptDir & "\data.ini", "Settings", "HOST", GUICtrlRead($input1))
    IniWrite(@ScriptDir & "\data.ini", "Settings", "PORT", GUICtrlRead($input2))
    IniWrite(@ScriptDir & "\data.ini", "Settings", "USERNAME", GUICtrlRead($input3))
    IniWrite(@ScriptDir & "\data.ini", "Settings", "PASSWORD", GUICtrlRead($input4))
    IniWrite(@ScriptDir & "\data.ini", "Settings", "HOST PROXY", GUICtrlRead($input5))
    IniWrite(@ScriptDir & "\data.ini", "Settings", "PORT PROXY", GUICtrlRead($input6))
    If $savecfg = True Then
        #MsgBox(64, "INFO", "Berhasil Disimpan", 3)
        SplashTextOn("INFO", "Berhasil Disimpan.", 200, 50, -1, -1, 0, "", 11)
        Sleep(1500)
        SplashOff()
    EndIf
EndFunc

Func login()
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
    Sleep(10)
    If ProcessExists("Proxifier.exe") Then ProcessClose("Proxifier.exe")
    Sleep(10)
    $host_ssh = GUICtrlRead($input1)
    $port_ssh = GUICtrlRead($input2)
    $username = GUICtrlRead($input3)
    $password = GUICtrlRead($input4)
    $host_proxy = GUICtrlRead($input5)
    $port_proxy = GUICtrlRead($input6)
    $use_proxy = GUICtrlRead($checkbox) = $gui_checked
    $no_proxy = GUICtrlRead($checkbox) = $gui_unchecked
    If BitAND(GUICtrlRead($radio1), $gui_checked) Then
        Sleep(10)
        GUICtrlSetState($login, $gui_disable)
        GUICtrlSetState($logout, $gui_enable)
        GUICtrlSetState($exit, $gui_disable)
        If $use_proxy Then
            $ssh1 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=y -proxyType=HTTP -proxyserver=" & $host_proxy & " -proxyport=" & $port_proxy & " -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh1"
            $ssh2 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=y -proxyType=HTTP -proxyserver=" & $host_proxy & " -proxyport=" & $port_proxy & " -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh2"
            Sleep(10)
        EndIf
        If $no_proxy Then
            $ssh1 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=n -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh1"
            $ssh2 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=n -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh2"
            Sleep(10)
        EndIf
            Run(@ScriptDir & "\esteh\BvSsh.exe -profile=config\ssh1.bscp -loginOnStartup " & $ssh1, @ScriptDir, @SW_HIDE)
            Run('"' & @ProgramFilesDir & "\Proxifier\Proxifier.exe" & '"' & " " & '"' & @AppDataDir & "\Proxifier\Profiles\tn1.ppx" & '"' & "", @ScriptDir, @SW_HIDE)
            ;Run('"' & @ScriptDir & "\Pf\Proxifier.exe" & '"' & " " & '"' & @ScriptDir & "\Pf\Profiles\tn1.ppx" & '"' & "", @ScriptDir, @SW_HIDE)
            Sleep(10)
        EndIf
    If BitAND(GUICtrlRead($radio2), $gui_checked) Then
        Sleep(10)
        GUICtrlSetState($login, $gui_disable)
        GUICtrlSetState($logout, $gui_enable)
        GUICtrlSetState($exit, $gui_disable)
        If $use_proxy Then
            $ssh1 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=y -proxyType=HTTP -proxyserver=" & $host_proxy & " -proxyport=" & $port_proxy & " -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh1"
            $ssh2 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=y -proxyType=HTTP -proxyserver=" & $host_proxy & " -proxyport=" & $port_proxy & " -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh2"
            Sleep(10)
        EndIf
        If $no_proxy Then
            $ssh1 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=n -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh1"
            $ssh2 = "-host=" & $host_ssh & " -port=" & $port_ssh & " -username=" & $username & " -password=" & $password & " -proxy=n -hide=trayWRC,traySFTP,trayRDP,trayPopups -title=ssh2"
            Sleep(10)
        EndIf
            Run(@ScriptDir & "\esteh\BvSsh.exe -profile=config\ssh1.bscp -loginOnStartup " & $ssh1, @ScriptDir, @SW_HIDE)
            Run(@ScriptDir & "\esteh\BvSsh.exe -profile=config\ssh2.bscp -loginOnStartup " & $ssh2, @ScriptDir, @SW_HIDE)
            Run('"' & @ProgramFilesDir & "\Proxifier\Proxifier.exe" & '"' & " " & '"' & @AppDataDir & "\Proxifier\Profiles\tn2.ppx" & '"' & "", @ScriptDir, @SW_HIDE)
            ;Run('"' & @ScriptDir & "\Pf\Proxifier.exe" & '"' & " " & '"' & @ScriptDir & "\Pf\Profiles\tn2.ppx" & '"' & "", @ScriptDir, @SW_HIDE)
            Sleep(10)
    EndIf
EndFunc
    
Func minimize($form1)
    If $GUI_event_minimize = True Then
    GUISetState(@SW_HIDE, $form1)
    EndIf
EndFunc

Func maximize($form1)
    If $RestoreTray = True Then
    GUISetState(@SW_SHOWNORMAL, $form1)
    EndIf
EndFunc

Func metu()
    If $keluar = True Then
        If ProcessExists("BvSsh.exe") Then ProcessClose("BvSsh.exe")
        Sleep(100)
        If ProcessExists("Proxifier.exe") Then ProcessClose("Proxifier.exe")
        Exit 
    EndIf
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

your question is not clear, and your code is not reproducible.

anyway:

to refresh your IP address, call "ipconfig /renew"

to get your IP address, use @IPAddress1

Edited by orbs

Share this post


Link to post
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
Sign in to follow this  
Followers 0