examples

Class SSH1Cisco

    • Method Detail

      • runCmd

        public void runCmd(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
      • close

        public void close()
        Close connection
      • getUsername

        public java.lang.String getUsername(SSHClientUser origin)
                                     throws java.io.IOException
        Get username to log in as
        Specified by:
        getUsername in interface SSHAuthenticator
        Throws:
        java.io.IOException
      • getPassword

        public java.lang.String getPassword(SSHClientUser origin)
                                     throws java.io.IOException
        Get password to log in with
        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
        Present challenge to user an return answer
        Specified by:
        getChallengeResponse in interface SSHAuthenticator
        Throws:
        java.io.IOException
      • getIdentityPassword

        public java.lang.String getIdentityPassword(SSHClientUser origin)
                                             throws java.io.IOException
        Return password protecting identify file
        Specified by:
        getIdentityPassword in interface SSHAuthenticator
        Throws:
        java.io.IOException
      • verifyKnownHosts

        public boolean verifyKnownHosts(java.security.interfaces.RSAPublicKey hostPub)
                                 throws java.io.IOException
        Verify the fingerprint of the remote host.
        Specified by:
        verifyKnownHosts in interface SSHAuthenticator
        Parameters:
        hostPub - public key of remote host
        Returns:
        true if the public key verifies
        Throws:
        java.io.IOException
      • getSrvHost

        public java.lang.String getSrvHost()
                                    throws java.io.IOException
        Get host to connect to
        Specified by:
        getSrvHost in interface SSHClientUser
        Throws:
        java.io.IOException
      • getSrvPort

        public int getSrvPort()
        Get port number to connect to
        Specified by:
        getSrvPort in interface SSHClientUser
      • getProxyConnection

        public NetworkConnection getProxyConnection()
                                             throws java.io.IOException
        Return a connection to the server. This can be used to connect through proxies etc.
        Specified by:
        getProxyConnection in interface SSHClientUser
        Throws:
        java.io.IOException
      • getDisplay

        public java.lang.String getDisplay()
        Get the display for X11 forwardings
        Specified by:
        getDisplay in interface SSHClientUser
      • getMaxPacketSz

        public int getMaxPacketSz()
        get maximum packet size (0 = no limit)
        Specified by:
        getMaxPacketSz in interface SSHClientUser
      • getAliveInterval

        public int getAliveInterval()
        Get alive interval (0 = do not send keepalive packets)
        Specified by:
        getAliveInterval in interface SSHClientUser
      • wantX11Forward

        public boolean wantX11Forward()
        Return true if X11 forwarding is desired
        Specified by:
        wantX11Forward in interface SSHClientUser
      • wantPTY

        public boolean wantPTY()
        Return true if we need a PTY on the server
        Specified by:
        wantPTY in interface SSHClientUser
      • getKexTimeout

        public int getKexTimeout()
        Timeout of key exchange (in seconds)
        Specified by:
        getKexTimeout in interface SSHClientUser
      • getConnectTimeout

        public int getConnectTimeout()
        Timeout when connecting to server (in seconds)
        Specified by:
        getConnectTimeout in interface SSHClientUser
      • getHelloTimeout

        public int getHelloTimeout()
        Timeout when waiting for initial greeting from server (in seconds)
        Specified by:
        getHelloTimeout in interface SSHClientUser
      • main

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