Using-regular-expression-for-a-prompt-in-SSH - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Using regular expression for a prompt in SSH
VB code
Dim wodSSH1 As wodSSHCom
Set wodSSH1 = New wodSSHCom

'Authenticate with server using hostname, login, password.
wodSSH1.HostName = "your_hostname"
wodSSH1.Protocol = SSHAuto
wodSSH1.Login = "your_login"
wodSSH1.Password = "your_password"
wodSSH1.Blocking = True 'Use synchronous connections
wodSSH1.Connect

'regex: \$%#> means it will accept any of those chars (\,$,%,#,>)if they appear at the end of the line.
'This includes 99.9% of most UNIX command prompts (including root account).
Debug.Print wodSSH1.WaitFor("regex:[\$%#>] $")
VB.NET code
Dim wodSSH1 As WeOnlyDo.Client.SSH
wodSSH1 = New WeOnlyDo.Client.SSH

'Authenticate with server using hostname, login, password.
wodSSH1.Hostname = "your_hostname"
wodSSH1.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSHAuto
wodSSH1.Login = "your_login"
wodSSH1.Password = "your_password"
wodSSH1.Blocking = True 'Use synchronous connections
wodSSH1.Connect()

'regex: \$%#> means it will accept any of those chars (\,$,%,#,>)if they appear at the end of the line.
'This includes 99.9% of most UNIX command prompts (including root account).
Console.WriteLine(wodSSH1.WaitFor("regex:[\$%#>] $"))
C# code
WeOnlyDo.Client.SSH wodSSH1;
wodSSH1 = new WeOnlyDo.Client.SSH();

//Authenticate with server using hostname, login, password.
wodSSH1.Hostname = "your_hostname";
wodSSH1.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSHAuto;
wodSSH1.Login = "your_login";
wodSSH1.Password = "your_password";
wodSSH1.Blocking = true;
wodSSH1.Connect();

//regex: \$%#> means it will accept any of those chars (\,$,%,#,>)if they appear at the end of the line.
//This includes 99.9% of most UNIX command prompts (including root account).
Console.WriteLine(wodSSH1.WaitFor("regex:[\\$%#>] $"));