| File | Line |
|---|
| E05X11Forwarding.java | 48 |
| E13ExtendedHostKeyValidation.java | 43 |
SshClient client = provider.createClient(config);
ExampleUtilities.dumpClientInfo(client);
// Prompt for the host and username
String connectionSpec = Util.prompt("Enter username@hostname", System.getProperty("user.name") + "@localhost");
String host = ExampleUtilities.extractHostname(connectionSpec);
String user = ExampleUtilities.extractUsername(connectionSpec);
int port = ExampleUtilities.extractPort(connectionSpec);
// Connect, authenticate
client.connect(user, host, port);
client.authenticate(new ConsolePasswordAuthenticator());
try {
SshShell shell = client.createShell("dumb", 80, 24, 0, 0, null);
try {
shell.open();
ExampleUtilities.joinShellToConsole(shell);
} finally {
shell.close();
}
} finally {
client.disconnect();
}
}
} |
| File | Line |
|---|
| E04ExecuteCommand.java | 15 |
| E07RemoteForwarding.java | 12 |
public class E07RemoteForwarding {
/**
* Entry point.
*
* @param arg command line arguments
* @throws Exception
*/
public static void main(String[] arg) throws Exception {
SshConfiguration config = new SshConfiguration();
config.setHostKeyValidator(new ConsoleHostKeyValidator());
config.setBannerHandler(new ConsoleBannerHandler());
// Create the client using that configuration
SshClient client = config.createClient();
ExampleUtilities.dumpClientInfo(client);
// Prompt for the host and username
String connectionSpec = Util.prompt("Enter username@hostname", System.getProperty("user.name") + "@localhost");
String host = ExampleUtilities.extractHostname(connectionSpec);
String user = ExampleUtilities.extractUsername(connectionSpec);
int port = ExampleUtilities.extractPort(connectionSpec);
// Connect, authenticate
client.connect(user, host, port);
client.authenticate(new ConsolePasswordAuthenticator());
try { |
| File | Line |
|---|
| E04ExecuteCommand.java | 15 |
| E06LocalForwarding.java | 15 |
public class E06LocalForwarding {
/**
* Entry point.
*
* @param arg command line arguments
* @throws Exception
*/
public static void main(String[] arg) throws Exception {
SshConfiguration config = new SshConfiguration();
config.setHostKeyValidator(new ConsoleHostKeyValidator());
config.setBannerHandler(new ConsoleBannerHandler());
// Create the client using that configuration.
SshClient client = config.createClient();
ExampleUtilities.dumpClientInfo(client);
// Prompt for the host and username
String connectionSpec = Util.prompt("Enter username@hostname", System.getProperty("user.name") + "@localhost");
String host = ExampleUtilities.extractHostname(connectionSpec);
String user = ExampleUtilities.extractUsername(connectionSpec);
int port = ExampleUtilities.extractPort(connectionSpec);
// Connect, authenticate, and start the simple shell
client.connect(user, host, port);
client.authenticate(new ConsolePasswordAuthenticator()); |
| File | Line |
|---|
| E04ExecuteCommand.java | 15 |
| E11KeyboardInteractiveAuthentication.java | 13 |
public class E11KeyboardInteractiveAuthentication {
/**
* Entry point.
*
* @param arg command line arguments
* @throws Exception
*/
public static void main(String[] arg) throws Exception {
SshConfiguration config = new SshConfiguration();
config.setHostKeyValidator(new ConsoleHostKeyValidator());
config.setBannerHandler(new ConsoleBannerHandler());
// Create the client using that configuration
SshClient client = config.createClient();
ExampleUtilities.dumpClientInfo(client);
// Prompt for the host and username
String connectionSpec = Util.prompt("Enter username@hostname", System.getProperty("user.name") + "@localhost");
String host = ExampleUtilities.extractHostname(connectionSpec);
String user = ExampleUtilities.extractUsername(connectionSpec);
int port = ExampleUtilities.extractPort(connectionSpec);
// Connect, authenticate
client.connect(user, host, port);
client.authenticate(new ConsoleKeyboardInteractiveAuthenticator()); |
| File | Line |
|---|
| E16PublicKeySubsytem.java | 27 |
| E17TunneledSocketFactory.java | 32 |
config.addRequiredCapability(Capability.TUNNELED_SOCKET_FACTORY);
config.setHostKeyValidator(new ConsoleHostKeyValidator());
config.setBannerHandler(new ConsoleBannerHandler());
// Create the client using that configuration
SshProvider provider = DefaultProviderFactory.getInstance().getProvider(config);
SshClient client = provider.createClient(config);
ExampleUtilities.dumpClientInfo(client);
// Prompt for the host and username
String connectionSpec = Util.prompt("Enter username@hostname", System.getProperty("user.name") + "@localhost");
String host = ExampleUtilities.extractHostname(connectionSpec);
String user = ExampleUtilities.extractUsername(connectionSpec);
int port = ExampleUtilities.extractPort(connectionSpec);
// Connect, authenticate, and start the simple shell
client.connect(user, host, port);
client.authenticate(new ConsolePasswordAuthenticator()); |
| File | Line |
|---|
| E02ShellWithConsolePrompts.java | 33 |
| E07RemoteForwarding.java | 19 |
public static void main(String[] arg) throws Exception {
SshConfiguration config = new SshConfiguration();
config.setHostKeyValidator(new ConsoleHostKeyValidator());
config.setBannerHandler(new ConsoleBannerHandler());
// Create the client using that configuration
SshClient client = config.createClient();
ExampleUtilities.dumpClientInfo(client);
// Prompt for the host and username
String connectionSpec = Util.prompt("Enter username@hostname", System.getProperty("user.name") + "@localhost");
String host = ExampleUtilities.extractHostname(connectionSpec);
String user = ExampleUtilities.extractUsername(connectionSpec);
int port = ExampleUtilities.extractPort(connectionSpec);
// Connect, authenticate, and start the simple shell
client.connect(user, host, port); |