Hi guys,
I am new to this forums so hopefully I am asking this questions in the correct forums.
I found this script from one of the threads that allows to log into SSH session while using Putty In the background. How do I go about typing in a command after I am logged in?
For example, I was to send "ls" command once I am logged in.
Any help and guidance is greatly appreciated.
I am new to this forums so hopefully I am asking this questions in the correct forums.
I found this script from one of the threads that allows to log into SSH session while using Putty In the background. How do I go about typing in a command after I am logged in?
For example, I was to send "ls" command once I am logged in.
Any help and guidance is greatly appreciated.
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("HTSE Login Screen", 331, 238, 326, 220) $Group1 = GUICtrlCreateGroup(" SSH Login", 8, 8, 313, 217) $IP = GUICtrlCreateLabel("IP", 80, 48, 21, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $IPAddress1 = _GUICtrlIpAddress_Create($Form1, 104, 48, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "10.10.10.50") $User = GUICtrlCreateLabel("User", 64, 96, 39, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Username = GUICtrlCreateInput("", 104, 96, 129, 21) $Password = GUICtrlCreateLabel("Password", 24, 136, 77, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Pass = GUICtrlCreateInput("", 104, 136, 129, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $Login = GUICtrlCreateButton("Login", 104, 176, 107, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Cancel = GUICtrlCreateButton("Cancel", 232, 176, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "Tahoma") $Label1 = GUICtrlCreateLabel("Port", 240, 48, 36, 22) GUICtrlSetFont(-1, 11, 800, 0, "Tahoma") $Input3 = GUICtrlCreateInput("22", 280, 48, 25, 21) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Cancel Exit Case $Login $IPAddress1 = _GUICtrlIpAddress_Get($IPAddress1) $Username = GUICtrlRead($Username) $Pass = GUICtrlRead($Pass) ExitLoop EndSwitch WEnd $Command = "putty.exe -ssh -2 -P 22 " & $Username & "@" & $IPAddress1 & " -pw " & $Pass ;MsgBox(32, 'Command to Pass', $Command & @LF & $IPAddress1) ;comment out this line for production Run($Command)