examples
Class SSH1Example

java.lang.Object
  extended bycom.mindbright.ssh.SSHInteractorAdapter
      extended byexamples.SSH1Example
All Implemented Interfaces:
SSHAuthenticator, SSHClientUser, SSHInteractor

public class SSH1Example
extends SSHInteractorAdapter
implements SSHAuthenticator, SSHClientUser

Examples on how to use the ssh1 classes.

     - runWithPortFwd: starts SSH1 connection and port forwarding which
        is used to send and receive data over

     - runWithCommand: starts a command over an SSH1 connection and
        retrieves the output

     - runWithCommandInShell: start a shell over SSH1 connection and 
        run a command in the shell and retrieve the output

     - runSCP: copy a file with SCP

 Run with: java SSH1Example    
 


Method Summary
 int getAliveInterval()
           
 int[] getAuthTypes(SSHClientUser origin)
           
 java.lang.String getChallengeResponse(SSHClientUser origin, java.lang.String challenge)
           
 int getCipher(SSHClientUser origin)
           
 int getCompressionLevel()
           
 java.lang.String getDisplay()
           
 SSHRSAKeyFile getIdentityFile(SSHClientUser origin)
           
 java.lang.String getIdentityPassword(SSHClientUser origin)
           
 SSHInteractor getInteractor()
           
 int getMaxPacketSz()
           
 java.lang.String getPassword(SSHClientUser origin)
           
 java.net.Socket getProxyConnection()
           
 java.lang.String getSrvHost()
           
 int getSrvPort()
           
 java.lang.String getUsername(SSHClientUser origin)
           
static void main(java.lang.String[] argv)
           
 void runSCP(java.lang.String remotefile)
          Transfer files with SCP
 void runWithCommand(java.lang.String command)
          Start a command over SSH1 connection and run a command and retrieve the output
 void runWithCommandInShell(java.lang.String command)
          Start a shell over SSH1 connection and run a command and retrieve the output
 void runWithPortFwd()
          Start an SSH1 connection with port forward.
 boolean verifyKnownHosts(RSAPublicKey hostPub)
           
 boolean wantPTY()
           
 boolean wantX11Forward()
           
 
Methods inherited from class com.mindbright.ssh.SSHInteractorAdapter
alert, askConfirmation, connected, disconnected, isVerbose, licenseDialog, open, promptLine, promptPassword, propsStateChanged, quietPrompts, report, sessionStarted, startNewSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

runWithPortFwd

public void runWithPortFwd()
                    throws java.net.UnknownHostException,
                           java.io.IOException
Start an SSH1 connection with port forward. Then demonstrate reading and writing on this portforward.

Throws:
java.net.UnknownHostException
java.io.IOException

runWithCommand

public void runWithCommand(java.lang.String command)
                    throws java.io.IOException
Start a command over SSH1 connection and run a command and retrieve the output

Parameters:
command - Command to execute
Throws:
java.io.IOException

runWithCommandInShell

public void runWithCommandInShell(java.lang.String command)
                           throws java.io.IOException
Start a shell over SSH1 connection and run a command and retrieve the output

Parameters:
command - Command to execute
Throws:
java.io.IOException

runSCP

public void runSCP(java.lang.String remotefile)
            throws java.io.IOException
Transfer files with SCP

Parameters:
remotefile - File on remote system to transfer
Throws:
java.io.IOException

getUsername

public java.lang.String getUsername(SSHClientUser origin)
                             throws java.io.IOException
Specified by:
getUsername in interface SSHAuthenticator
Throws:
java.io.IOException

getPassword

public java.lang.String getPassword(SSHClientUser origin)
                             throws java.io.IOException
Specified by:
getPassword in interface SSHAuthenticator
Throws:
java.io.IOException

getChallengeResponse

public java.lang.String getChallengeResponse(SSHClientUser origin,
                                             java.lang.String challenge)
                                      throws java.io.IOException
Specified by:
getChallengeResponse in interface SSHAuthenticator
Throws:
java.io.IOException

getAuthTypes

public int[] getAuthTypes(SSHClientUser origin)
Specified by:
getAuthTypes in interface SSHAuthenticator

getCipher

public int getCipher(SSHClientUser origin)
Specified by:
getCipher in interface SSHAuthenticator

getIdentityFile

public SSHRSAKeyFile getIdentityFile(SSHClientUser origin)
                              throws java.io.IOException
Specified by:
getIdentityFile in interface SSHAuthenticator
Throws:
java.io.IOException

getIdentityPassword

public java.lang.String getIdentityPassword(SSHClientUser origin)
                                     throws java.io.IOException
Specified by:
getIdentityPassword in interface SSHAuthenticator
Throws:
java.io.IOException

verifyKnownHosts

public boolean verifyKnownHosts(RSAPublicKey hostPub)
                         throws java.io.IOException
Specified by:
verifyKnownHosts in interface SSHAuthenticator
Throws:
java.io.IOException

getSrvHost

public java.lang.String getSrvHost()
                            throws java.io.IOException
Specified by:
getSrvHost in interface SSHClientUser
Throws:
java.io.IOException

getSrvPort

public int getSrvPort()
Specified by:
getSrvPort in interface SSHClientUser

getProxyConnection

public java.net.Socket getProxyConnection()
                                   throws java.io.IOException
Specified by:
getProxyConnection in interface SSHClientUser
Throws:
java.io.IOException

getDisplay

public java.lang.String getDisplay()
Specified by:
getDisplay in interface SSHClientUser

getMaxPacketSz

public int getMaxPacketSz()
Specified by:
getMaxPacketSz in interface SSHClientUser

getAliveInterval

public int getAliveInterval()
Specified by:
getAliveInterval in interface SSHClientUser

getCompressionLevel

public int getCompressionLevel()
Specified by:
getCompressionLevel in interface SSHClientUser

wantX11Forward

public boolean wantX11Forward()
Specified by:
wantX11Forward in interface SSHClientUser

wantPTY

public boolean wantPTY()
Specified by:
wantPTY in interface SSHClientUser

getInteractor

public SSHInteractor getInteractor()
Specified by:
getInteractor in interface SSHClientUser

main

public static void main(java.lang.String[] argv)