TerminalScriptingWinForm - GUI SSH and telnet client scripting sample
A sample that demonstrates scripting capabilities of TerminalControl and VirtualTerminal objects.
Sample application that demonstrates scripting capabilities of Rebex SSH Shell library.
The following features are covered:
- Terminal emulation using TerminalControl and VirtualTerminal classes.
- Automation using the Scripting class.
- Ssh and Telnet classes.
- Resizing the terminal screen.
- Handling the Disconnected event.
- Authentication over Telnet.
C#
// create a new Ssh object Ssh ssh = new Ssh(); // connect to the SSH server ssh.Connect("hostname"); // login to the SSH server ssh.Login("username", "password"); // get a scripting object Scripting scripting = ssh.StartScripting(); // detect prompt scripting.DetectPrompt(); // execute a command scripting.SendCommand("uname -a"); // read response string response = scripting.ReadUntilPrompt();
VB.NET
' create a new Ssh object Dim ssh As New Ssh() ' connect to the SSH server ssh.Connect("hostname") ' login to the SSH server ssh.Login("username", "password") ' get a scripting object Dim scripting As Scripting = ssh.StartScripting() ' detect prompt scripting.DetectPrompt() ' execute a command scripting.SendCommand("uname -a") ' read response Dim response As String = scripting.ReadUntilPrompt()