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, startNewSession
public void runCmd(java.lang.String command) throws java.io.IOException
command
- Command to executejava.io.IOException
public void close()
public java.lang.String getUsername(SSHClientUser origin) throws java.io.IOException
getUsername
in interface SSHAuthenticator
java.io.IOException
public java.lang.String getPassword(SSHClientUser origin) throws java.io.IOException
getPassword
in interface SSHAuthenticator
java.io.IOException
public java.lang.String getChallengeResponse(SSHClientUser origin, java.lang.String challenge) throws java.io.IOException
getChallengeResponse
in interface SSHAuthenticator
java.io.IOException
public int[] getAuthTypes(SSHClientUser origin)
getAuthTypes
in interface SSHAuthenticator
public int getCipher(SSHClientUser origin)
getCipher
in interface SSHAuthenticator
public SSHRSAKeyFile getIdentityFile(SSHClientUser origin) throws java.io.IOException
getIdentityFile
in interface SSHAuthenticator
java.io.IOException
public java.lang.String getIdentityPassword(SSHClientUser origin) throws java.io.IOException
getIdentityPassword
in interface SSHAuthenticator
java.io.IOException
public boolean verifyKnownHosts(java.security.interfaces.RSAPublicKey hostPub) throws java.io.IOException
verifyKnownHosts
in interface SSHAuthenticator
hostPub
- public key of remote hostjava.io.IOException
public java.lang.String getSrvHost() throws java.io.IOException
getSrvHost
in interface SSHClientUser
java.io.IOException
public int getSrvPort()
getSrvPort
in interface SSHClientUser
public NetworkConnection getProxyConnection() throws java.io.IOException
getProxyConnection
in interface SSHClientUser
java.io.IOException
public java.lang.String getDisplay()
getDisplay
in interface SSHClientUser
public int getMaxPacketSz()
getMaxPacketSz
in interface SSHClientUser
public int getAliveInterval()
getAliveInterval
in interface SSHClientUser
public int getCompressionLevel()
getCompressionLevel
in interface SSHClientUser
public boolean wantX11Forward()
wantX11Forward
in interface SSHClientUser
public boolean wantPTY()
wantPTY
in interface SSHClientUser
public int getKexTimeout()
getKexTimeout
in interface SSHClientUser
public int getConnectTimeout()
getConnectTimeout
in interface SSHClientUser
public int getHelloTimeout()
getHelloTimeout
in interface SSHClientUser
public SSHInteractor getInteractor()
getInteractor
in interface SSHClientUser
public static void main(java.lang.String[] argv)