com.mindbright.ssh
Class SSHInteractiveClient

java.lang.Object
  extended bycom.mindbright.ssh.SSH
      extended bycom.mindbright.ssh.SSHClient
          extended bycom.mindbright.ssh.SSHInteractiveClient
All Implemented Interfaces:
MindTermApp, java.lang.Runnable, SSH2Interactor, SSHInteractor, TerminalInputListener

public final class SSHInteractiveClient
extends SSHClient
implements java.lang.Runnable, SSHInteractor, SSH2Interactor, MindTermApp, TerminalInputListener


Nested Class Summary
 
Nested classes inherited from class com.mindbright.ssh.SSHClient
SSHClient.AuthFailException, SSHClient.ExitMonitor, SSHClient.LocalForward, SSHClient.RemoteForward
 
Field Summary
static java.lang.String customStartMessage
           
 boolean exitOnLogout
           
 boolean isSSH2
           
 boolean quiet
           
 SSH2Transport transport
           
static boolean wantHelpInfo
           
 
Fields inherited from class com.mindbright.ssh.SSHClient
activateTunnels, authenticator, commandLine, console, controller, firstFTPPort, gracefulExit, havePORTFtp, interactor, isConnected, isOpened, keepAliveThread, localAddr, localForwards, myThread, rand, refCount, remoteForwards, serverAddr, serverRealAddr, srvVersionMajor, srvVersionMinor, srvVersionStr, sshIn, sshOut, sshSocket, user
 
Fields inherited from class com.mindbright.ssh.SSH
AUTH_CRYPTOCARD, AUTH_DEFAULT, AUTH_KBDINTERACT, AUTH_KERBEROS, AUTH_NOTSUPPORTED, AUTH_PASSWORD, AUTH_PUBLICKEY, AUTH_RHOSTS, AUTH_RHOSTS_RSA, AUTH_SDI, AUTH_TIS, authTypeDesc, CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DEFAULT, CIPHER_DES, CIPHER_IDEA, CIPHER_NONE, CIPHER_NOTSUPPORTED, CIPHER_RC4, CIPHER_RESERVED, CIPHER_TSS, cipherClasses, cipherType, CMSG_ACM_ACCESS_DENIED, CMSG_ACM_NEW_PIN, CMSG_ACM_NEW_PIN_ACCEPTED, CMSG_ACM_NEW_PIN_REJECTED, CMSG_ACM_NEW_PIN_REQUIRED, CMSG_ACM_NEXT_CODE, CMSG_ACM_NEXT_CODE_REQUIRED, CMSG_ACM_OK, CMSG_AGENT_REQUEST_FORWARDING, CMSG_AUTH_PASSWORD, CMSG_AUTH_RHOSTS, CMSG_AUTH_RHOSTS_RSA, CMSG_AUTH_RSA, CMSG_AUTH_RSA_RESPONSE, CMSG_AUTH_SDI, CMSG_AUTH_TIS, CMSG_AUTH_TIS_RESPONSE, CMSG_EOF, CMSG_EXEC_CMD, CMSG_EXEC_SHELL, CMSG_EXIT_CONFIRMATION, CMSG_MAX_PACKET_SIZE, CMSG_PORT_FORWARD_REQUEST, CMSG_REQUEST_COMPRESSION, CMSG_REQUEST_PTY, CMSG_SESSION_KEY, CMSG_STDIN_DATA, CMSG_USER, CMSG_WINDOW_SIZE, CMSG_X11_REQUEST_FORWARDING, CONNECT_CHAN_NUM, CVS_DATE, CVS_NAME, DEBUG, DEBUGMORE, DEFAULTPORT, HOST_KEY_LENGTH, IDX_CIPHER_CLASS, IDX_CIPHER_NAME, isAnSSHClient, KNOWN_HOSTS_FILE, LISTEN_CHAN_NUM, MAIN_CHAN_NUM, MSG_ANY, MSG_CHANNEL_CLOSE, MSG_CHANNEL_CLOSE_CONFIRMATION, MSG_CHANNEL_DATA, MSG_CHANNEL_INPUT_EOF, MSG_CHANNEL_OPEN_CONFIRMATION, MSG_CHANNEL_OPEN_FAILURE, MSG_CHANNEL_OUTPUT_CLOSED, MSG_DEBUG, MSG_DISCONNECT, MSG_IGNORE, MSG_NONE, MSG_PORT_OPEN, PASS_KERBEROS_TGT, protocolFlags, PROTOFLAG_HOST_IN_FWD_OPEN, PROTOFLAG_SCREEN_NUMBER, PROXY_HTTP, PROXY_NONE, PROXY_NOTSUPPORTED, PROXY_SOCKS4, PROXY_SOCKS5_DNS, PROXY_SOCKS5_IP, randomSeed, rcvCipher, rcvComp, secureRandom, SERVER_KEY_LENGTH, SESSION_KEY_LENGTH, sessionId, sessionKey, SMSG_AGENT_OPEN, SMSG_AUTH_RSA_CHALLENGE, SMSG_AUTH_TIS_CHALLENGE, SMSG_EXITSTATUS, SMSG_FAILURE, SMSG_PUBLIC_KEY, SMSG_STDERR_DATA, SMSG_STDOUT_DATA, SMSG_SUCCESS, SMSG_X11_OPEN, sndCipher, sndComp, SRV_HOSTKEY_CHANGED, SRV_HOSTKEY_KNOWN, SRV_HOSTKEY_NEW, srvCookie, srvHostKey, srvServerKey, SSH_VER_MAJOR, SSH_VER_MINOR, supportedAuthTypes, supportedCiphers, TTY_OP_END, TTY_OP_ISPEED, TTY_OP_OSPEED, UNKNOWN_CHAN_NUM, VER_MINDTERM, VER_MINDTUNL
 
Constructor Summary
SSHInteractiveClient(boolean quiet, boolean exitOnLogout, SSHPropertyHandler propsHandler)
           
SSHInteractiveClient(SSHInteractiveClient clone)
           
 
Method Summary
 void addAuthModules(SSH2Authenticator authenticator, java.lang.String methods)
           
 void addRemotePortForward(java.lang.String remoteHost, int remotePort, java.lang.String localHost, int localPort, java.lang.String plugin)
           
 void alert(java.lang.String msg)
           
 boolean askConfirmation(java.lang.String message, boolean defAnswer)
           
 boolean askConfirmation(java.lang.String message, boolean preferDialog, boolean defAnswer)
           
 void closeTunnelFromList(int listIdx)
           
 void connected(SSHClient client)
           
 void delLocalPortForward(java.lang.String localHost, int port)
           
 void delRemotePortForward(java.lang.String remoteHost, int port)
           
 void disconnected(SSHClient client, boolean graceful)
           
 void doSingleCommand(java.lang.String commandLine)
           
 boolean fingerprintMatch(SSH2Signature serverHostKey)
           
 void forcedDisconnect()
           
 java.applet.AppletContext getAppletContext()
           
 java.lang.String getAppName()
           
 SSH2Connection getConnection()
           
 SSHConsoleRemote getConsoleRemote()
           
 java.lang.String getHost()
           
 SSH2Interactor getInteractor()
           
 Logo getLogo()
           
 java.awt.Frame getParentFrame()
           
 int getPort()
           
 java.util.Properties getProperties()
           
 java.lang.String getProperty(java.lang.String name)
           
 SSHPropertyHandler getPropertyHandler()
           
 RandomSeed getRandomSeed()
           
 TerminalWin getTerminalWin()
           
 SSH2Transport getTransport()
           
 java.lang.String getUserName()
           
 java.lang.String getVersionId(boolean client)
           
 void hideLogo()
           
 boolean installLogo()
           
 boolean isApplet()
           
 boolean isDumb()
           
 boolean isVerbose()
           
 boolean licenseDialog(java.lang.String license)
           
 java.lang.String[] listTunnels()
           
 void newShell()
           
 void open(SSHClient client)
           
 java.lang.String promptLine(java.lang.String prompt, boolean echo)
           
 java.lang.String promptLine(java.lang.String prompt, java.lang.String defaultVal)
           
 int promptList(java.lang.String name, java.lang.String instruction, java.lang.String[] choices)
           
 java.lang.String[] promptMulti(java.lang.String[] prompts, boolean[] echos)
           
 java.lang.String[] promptMultiFull(java.lang.String name, java.lang.String instruction, java.lang.String[] prompts, boolean[] echos)
           
 java.lang.String promptPassword(java.lang.String prompt)
           
 void propsStateChanged(SSHPropertyHandler props)
           
 boolean quietPrompts()
           
 java.io.ByteArrayOutputStream readResource(java.lang.String name)
           
 void report(java.lang.String msg)
           
 void requestLocalPortForward(java.lang.String localHost, int localPort, java.lang.String remoteHost, int remotePort, java.lang.String plugin)
           
 void run()
           
 void sendBytes(byte[] b)
           
 void sessionStarted(SSHClient client)
           
 void setMenus(SSHMenuHandler menus)
           
 void setProperty(java.lang.String name, java.lang.String value)
           
 void showLogo()
           
 void signalWindowChanged(int rows, int cols, int vpixels, int hpixels)
           
 void splashScreen()
           
 void startNewSession(SSHClient client)
           
 void typedChar(char c)
           
 void updateMenus()
           
 void updateTitle()
           
 
Methods inherited from class com.mindbright.ssh.SSHClient
addLocalPortForward, addLocalPortForward, addRef, addRemotePortForward, boot, bootSSH, bootSSH, clearAllForwards, delRef, delRemotePortForward, delRemotePortForward, disconnect, doSingleCommand, getConsole, getLocalAddr, getServerAddr, getServerRealAddr, getServerVersion, isConnected, isOpened, setConsole, setLocalAddr, setServerRealAddr, startExitMonitor, startExitMonitor, waitForExit
 
Methods inherited from class com.mindbright.ssh.SSH
generateKeyFiles, getAltAuthName, getAuthName, getAuthType, getAuthTypes, getCipherName, getCipherType, getProxyType, getProxyTypes, haveSecureRandom, initCipher, initClientCipher, initSeedGenerator, initServerCipher, isAuthTypeSupported, isCipherSupported, isProtocolFlagSet, log, logDebug, logExtra, logIgnore, randomSeed, secureRandom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.mindbright.application.MindTermApp
isConnected
 

Field Detail

isSSH2

public boolean isSSH2

transport

public SSH2Transport transport

wantHelpInfo

public static boolean wantHelpInfo

customStartMessage

public static java.lang.String customStartMessage

quiet

public boolean quiet

exitOnLogout

public boolean exitOnLogout
Constructor Detail

SSHInteractiveClient

public SSHInteractiveClient(boolean quiet,
                            boolean exitOnLogout,
                            SSHPropertyHandler propsHandler)

SSHInteractiveClient

public SSHInteractiveClient(SSHInteractiveClient clone)
Method Detail

setMenus

public void setMenus(SSHMenuHandler menus)

getPropertyHandler

public SSHPropertyHandler getPropertyHandler()

updateMenus

public void updateMenus()

splashScreen

public void splashScreen()

installLogo

public boolean installLogo()

readResource

public java.io.ByteArrayOutputStream readResource(java.lang.String name)

doSingleCommand

public void doSingleCommand(java.lang.String commandLine)
                     throws java.lang.Exception
Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable

isDumb

public boolean isDumb()

getTerminalWin

public TerminalWin getTerminalWin()

showLogo

public void showLogo()

hideLogo

public void hideLogo()

getLogo

public Logo getLogo()

updateTitle

public void updateTitle()

promptLine

public java.lang.String promptLine(java.lang.String prompt,
                                   boolean echo)
                            throws SSH2UserCancelException
Specified by:
promptLine in interface SSH2Interactor
Throws:
SSH2UserCancelException

promptMulti

public java.lang.String[] promptMulti(java.lang.String[] prompts,
                                      boolean[] echos)
                               throws SSH2UserCancelException
Specified by:
promptMulti in interface SSH2Interactor
Throws:
SSH2UserCancelException

promptMultiFull

public java.lang.String[] promptMultiFull(java.lang.String name,
                                          java.lang.String instruction,
                                          java.lang.String[] prompts,
                                          boolean[] echos)
                                   throws SSH2UserCancelException
Specified by:
promptMultiFull in interface SSH2Interactor
Throws:
SSH2UserCancelException

promptList

public int promptList(java.lang.String name,
                      java.lang.String instruction,
                      java.lang.String[] choices)
               throws SSH2UserCancelException
Specified by:
promptList in interface SSH2Interactor
Throws:
SSH2UserCancelException

propsStateChanged

public void propsStateChanged(SSHPropertyHandler props)
Specified by:
propsStateChanged in interface SSHInteractor

startNewSession

public void startNewSession(SSHClient client)
Specified by:
startNewSession in interface SSHInteractor

sessionStarted

public void sessionStarted(SSHClient client)
Specified by:
sessionStarted in interface SSHInteractor

quietPrompts

public boolean quietPrompts()
Specified by:
quietPrompts in interface SSHInteractor

isVerbose

public boolean isVerbose()
Specified by:
isVerbose in interface SSHInteractor

promptLine

public java.lang.String promptLine(java.lang.String prompt,
                                   java.lang.String defaultVal)
                            throws java.io.IOException
Specified by:
promptLine in interface SSHInteractor
Throws:
java.io.IOException

promptPassword

public java.lang.String promptPassword(java.lang.String prompt)
                                throws java.io.IOException
Specified by:
promptPassword in interface SSHInteractor
Throws:
java.io.IOException

askConfirmation

public boolean askConfirmation(java.lang.String message,
                               boolean defAnswer)
Specified by:
askConfirmation in interface SSHInteractor

askConfirmation

public boolean askConfirmation(java.lang.String message,
                               boolean preferDialog,
                               boolean defAnswer)
                        throws java.io.IOException
Throws:
java.io.IOException

licenseDialog

public boolean licenseDialog(java.lang.String license)
Specified by:
licenseDialog in interface SSHInteractor

connected

public void connected(SSHClient client)
Specified by:
connected in interface SSHInteractor

open

public void open(SSHClient client)
Specified by:
open in interface SSHInteractor

disconnected

public void disconnected(SSHClient client,
                         boolean graceful)
Specified by:
disconnected in interface SSHInteractor

report

public void report(java.lang.String msg)
Specified by:
report in interface SSHInteractor

getInteractor

public SSH2Interactor getInteractor()
Specified by:
getInteractor in interface MindTermApp

alert

public void alert(java.lang.String msg)
Specified by:
alert in interface SSHInteractor

forcedDisconnect

public void forcedDisconnect()
Overrides:
forcedDisconnect in class SSHClient

requestLocalPortForward

public void requestLocalPortForward(java.lang.String localHost,
                                    int localPort,
                                    java.lang.String remoteHost,
                                    int remotePort,
                                    java.lang.String plugin)
                             throws java.io.IOException
Throws:
java.io.IOException

addRemotePortForward

public void addRemotePortForward(java.lang.String remoteHost,
                                 int remotePort,
                                 java.lang.String localHost,
                                 int localPort,
                                 java.lang.String plugin)

delLocalPortForward

public void delLocalPortForward(java.lang.String localHost,
                                int port)
Overrides:
delLocalPortForward in class SSHClient

delRemotePortForward

public void delRemotePortForward(java.lang.String remoteHost,
                                 int port)

fingerprintMatch

public boolean fingerprintMatch(SSH2Signature serverHostKey)

typedChar

public void typedChar(char c)
Specified by:
typedChar in interface TerminalInputListener

sendBytes

public void sendBytes(byte[] b)
Specified by:
sendBytes in interface TerminalInputListener

signalWindowChanged

public void signalWindowChanged(int rows,
                                int cols,
                                int vpixels,
                                int hpixels)
Specified by:
signalWindowChanged in interface TerminalInputListener

addAuthModules

public void addAuthModules(SSH2Authenticator authenticator,
                           java.lang.String methods)

newShell

public void newShell()

getVersionId

public java.lang.String getVersionId(boolean client)
Overrides:
getVersionId in class SSH

closeTunnelFromList

public void closeTunnelFromList(int listIdx)

listTunnels

public java.lang.String[] listTunnels()

getHost

public java.lang.String getHost()
Specified by:
getHost in interface MindTermApp

getPort

public int getPort()
Specified by:
getPort in interface MindTermApp

getProperties

public java.util.Properties getProperties()
Specified by:
getProperties in interface MindTermApp

getProperty

public java.lang.String getProperty(java.lang.String name)
Specified by:
getProperty in interface MindTermApp

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Specified by:
setProperty in interface MindTermApp

getUserName

public java.lang.String getUserName()
Specified by:
getUserName in interface MindTermApp

getParentFrame

public java.awt.Frame getParentFrame()
Specified by:
getParentFrame in interface MindTermApp

getAppName

public java.lang.String getAppName()
Specified by:
getAppName in interface MindTermApp

getRandomSeed

public RandomSeed getRandomSeed()
Specified by:
getRandomSeed in interface MindTermApp

isApplet

public boolean isApplet()
Specified by:
isApplet in interface MindTermApp

getAppletContext

public java.applet.AppletContext getAppletContext()
Specified by:
getAppletContext in interface MindTermApp

getTransport

public SSH2Transport getTransport()
Specified by:
getTransport in interface MindTermApp

getConnection

public SSH2Connection getConnection()
Specified by:
getConnection in interface MindTermApp

getConsoleRemote

public SSHConsoleRemote getConsoleRemote()
Specified by:
getConsoleRemote in interface MindTermApp