Jump to content

How can I convert this batch file to autoIt script?


Go to solution Solved by JohnOne,

Recommended Posts

+-----------------------------------------------------------------------
Batch File to open a ssh tunnel to remote host
-----------------------------------------------------------------------+
start C:\putty.exe -N -L 127.0.0.1:443:10.0.0.29:443 -l Admin -pw password myfirewall.net
ping localhost -n 3 
start https://127.0.0.1

Dear all,

The batch file above is meant to open a ssh tunnel to the remote host 10.0.0.29 via my firewall send three ping packets then launch the default browser to local host which will open the remote host.

I want Auto-It script to read the username and password form an input and then launch the browser to the remote host as ssh tunnel.

The Idea is to have many Buttons to launch deterrent tunnels.

Any Ideas and solution are warmly welcomed.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <process.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("IPconnect", 200, 150, 192, 100)
$Input1 = GUICtrlCreateInput("user", 88, 8, 105, 21)
$Input2 = GUICtrlCreateInput("password", 88, 40, 105, 21)
$Button1 = GUICtrlCreateButton("Tunnel1", 24, 96, 113, 25)
$Group1 = GUICtrlCreateGroup("Tunnels", 16, 60, 180, 70)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("Username", 24, 8, 60, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Password", 24, 40, 60, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Many Thanks In Advance.

 

Link to comment
Share on other sites

I don't know what putty is but a start might be something like...

Run("C:\putty.exe -N -L 127.0.0.1:443:10.0.0.29:443 -l Admin -pw password myfirewall.net")
Ping("localhost")
ShellExecute("https://127.0.0.1")

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Hi John,

 

 

I don't know what putty is but a start might be something like...

Run("C:\putty.exe -N -L 127.0.0.1:443:10.0.0.29:443 -l Admin -pw password myfirewall.net")
Ping("localhost")
ShellExecute("https://127.0.0.1")

 

Many thanks for the fast reply. you script is doing well.

however what I want is to read the username and password from the $Input1$Input2. so that other user can log on with their credentials instead of the the user Admin and the password Password.

Run("C:\putty.exe -N -L 127.0.0.1:443:10.0.0.29:443 -l GUICtrlRead($Input1) -pw GUICtrlRead($Input2) myfirewall.net")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("IPconnect", 200, 150, 192, 100)
$Input1 = GUICtrlCreateInput("user", 88, 8, 105, 21)
$Input2 = GUICtrlCreateInput("password", 88, 40, 105, 21)
$Button1 = GUICtrlCreateButton("Tunnel1", 24, 96, 113, 25)
$Group1 = GUICtrlCreateGroup("Tunnels", 16, 60, 180, 70)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("Username", 24, 8, 60, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Password", 24, 40, 60, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Edited by SDG
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...