examples
public class SSH1Cisco extends SSHInteractorAdapter implements SSHAuthenticator, SSHClientUser
Usage:
java -cp examples.jar examples.SSH1Cisco
host port username password
command
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close connection
|
int |
getAliveInterval()
Get alive interval (0 = do not send keepalive packets)
|
int[] |
getAuthTypes(SSHClientUser origin)
Get the authentication method the user wants to us
|
java.lang.String |
getChallengeResponse(SSHClientUser origin,
java.lang.String challenge)
Present challenge to user an return answer
|
int |
getCipher(SSHClientUser origin)
Get desirect encryption algorithm
|
int |
getCompressionLevel()
Get desired level of compression
|
int |
getConnectTimeout()
Timeout when connecting to server (in seconds)
|
java.lang.String |
getDisplay()
Get the display for X11 forwardings
|
int |
getHelloTimeout()
Timeout when waiting for initial greeting from server (in seconds)
|
SSHRSAKeyFile |
getIdentityFile(SSHClientUser origin)
Return name of file containing private key for pubkey authentication
|
java.lang.String |
getIdentityPassword(SSHClientUser origin)
Return password protecting identify file
|
SSHInteractor |
getInteractor()
Get interactor which should handle the authentication phase
|
int |
getKexTimeout()
Timeout of key exchange (in seconds)
|
int |
getMaxPacketSz()
get maximum packet size (0 = no limit)
|
java.lang.String |
getPassword(SSHClientUser origin)
Get password to log in with
|
NetworkConnection |
getProxyConnection()
Return a connection to the server.
|
java.lang.String |
getSrvHost()
Get host to connect to
|
int |
getSrvPort()
Get port number to connect to
|
java.lang.String |
getUsername(SSHClientUser origin)
Get username to log in as
|
static void |
main(java.lang.String[] argv)
Run the application
|
void |
runCmd(java.lang.String command)
Start a shell over SSH1 connection and run a command and
retrieve the output
|
boolean |
verifyKnownHosts(java.security.interfaces.RSAPublicKey hostPub)
Verify the fingerprint of the remote host.
|
boolean |
wantPTY()
Return true if we need a PTY on the server
|
boolean |
wantX11Forward()
Return true if X11 forwarding is desired
|
alert, askConfirmation, connected, disconnected, isVerbose, licenseDialog, open, promptLine, promptPassword, propsStateChanged, quietPrompts, report, sessionStarted, startNewSessionpublic void runCmd(java.lang.String command)
throws java.io.IOException
command - Command to executejava.io.IOExceptionpublic void close()
public java.lang.String getUsername(SSHClientUser origin) throws java.io.IOException
getUsername in interface SSHAuthenticatorjava.io.IOExceptionpublic java.lang.String getPassword(SSHClientUser origin) throws java.io.IOException
getPassword in interface SSHAuthenticatorjava.io.IOExceptionpublic java.lang.String getChallengeResponse(SSHClientUser origin, java.lang.String challenge) throws java.io.IOException
getChallengeResponse in interface SSHAuthenticatorjava.io.IOExceptionpublic int[] getAuthTypes(SSHClientUser origin)
getAuthTypes in interface SSHAuthenticatorpublic int getCipher(SSHClientUser origin)
getCipher in interface SSHAuthenticatorpublic SSHRSAKeyFile getIdentityFile(SSHClientUser origin) throws java.io.IOException
getIdentityFile in interface SSHAuthenticatorjava.io.IOExceptionpublic java.lang.String getIdentityPassword(SSHClientUser origin) throws java.io.IOException
getIdentityPassword in interface SSHAuthenticatorjava.io.IOExceptionpublic boolean verifyKnownHosts(java.security.interfaces.RSAPublicKey hostPub)
throws java.io.IOException
verifyKnownHosts in interface SSHAuthenticatorhostPub - public key of remote hostjava.io.IOExceptionpublic java.lang.String getSrvHost()
throws java.io.IOException
getSrvHost in interface SSHClientUserjava.io.IOExceptionpublic int getSrvPort()
getSrvPort in interface SSHClientUserpublic NetworkConnection getProxyConnection() throws java.io.IOException
getProxyConnection in interface SSHClientUserjava.io.IOExceptionpublic java.lang.String getDisplay()
getDisplay in interface SSHClientUserpublic int getMaxPacketSz()
getMaxPacketSz in interface SSHClientUserpublic int getAliveInterval()
getAliveInterval in interface SSHClientUserpublic int getCompressionLevel()
getCompressionLevel in interface SSHClientUserpublic boolean wantX11Forward()
wantX11Forward in interface SSHClientUserpublic boolean wantPTY()
wantPTY in interface SSHClientUserpublic int getKexTimeout()
getKexTimeout in interface SSHClientUserpublic int getConnectTimeout()
getConnectTimeout in interface SSHClientUserpublic int getHelloTimeout()
getHelloTimeout in interface SSHClientUserpublic SSHInteractor getInteractor()
getInteractor in interface SSHClientUserpublic static void main(java.lang.String[] argv)