com.mindbright.ssh
public final class SSHInteractiveClient extends SSHClient implements java.lang.Runnable, SSHInteractor, SSH2Interactor, MindTermApp, TerminalInputListener, NIOCallback
SSHClient.AuthFailException, SSHClient.ExitMonitor, SSHClient.LocalForward, SSHClient.RemoteForward| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
customStartMessage |
boolean |
exitOnLogout |
boolean |
isSSH2 |
boolean |
quiet |
SSH2Transport |
transport |
boolean |
wantHelpInfo |
activateTunnels, commandLine, console, controller, controllerMonitor, exitStatus, firstFTPPort, gracefulExit, havePORTFtp, heartbeat, interactor, isConnected, isOpened, isReading, localAddr, localForwards, rand, refCount, remoteForwards, serverAddr, serverRealAddr, srvVersionMajor, srvVersionMinor, srvVersionStr, sshIn, sshOut, sshSocket, userAUTH_CRYPTOCARD, AUTH_DEFAULT, AUTH_GSSAPI, AUTH_HOSTBASED, AUTH_KBDINTERACT, AUTH_KERBEROS, AUTH_NOTSUPPORTED, AUTH_PASSWORD, AUTH_PUBLICKEY, AUTH_RHOSTS, AUTH_RHOSTS_RSA, AUTH_SDI, AUTH_TIS, authTypeDesc, CIPHER_3DES, CIPHER_ANY, CIPHER_BLOWFISH, CIPHER_DEFAULT, CIPHER_DES, CIPHER_IDEA, CIPHER_INVALID, 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, DEBUG, DEBUGMORE, DEBUGPKG, 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, 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 and Description |
|---|
SSHInteractiveClient(boolean quiet,
boolean exitOnLogout,
SSHPropertyHandler propsHandler) |
SSHInteractiveClient(SSHInteractiveClient clone) |
| Modifier and Type | Method and Description |
|---|---|
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 |
callback(java.lang.Object arg) |
void |
closeTunnelFromList(int listIdx) |
void |
completed(java.nio.ByteBuffer buf)
Called once the network read operation has been completed
|
void |
connected(boolean timeout)
Called once the connection has been established (assuming
interest for this has been registered by calling the
NotifyWhenConnected method of Switchboard). |
void |
connected(SSHClient client) |
void |
connectionFailed(java.lang.Exception e)
Called if the connection failed (assuming
interest for this has been registered by calling the
NotifyWhenConnected method of Switchboard). |
void |
delLocalPortForward(java.lang.String localHost,
int port) |
void |
delRemotePortForward(java.lang.String remoteHost,
int port) |
protected void |
disconnect(boolean graceful,
java.lang.Exception e) |
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() |
long |
getConnectTimeout() |
SSHConsoleRemote |
getConsoleRemote() |
java.awt.Component |
getDialogParent() |
long |
getHelloTimeout() |
java.lang.String |
getHost() |
SSH2Interactor |
getInteractor() |
long |
getKexTimeout() |
Logo |
getLogo() |
int |
getPort() |
java.util.Properties |
getProperties() |
java.lang.String |
getProperty(java.lang.String name) |
SSHPropertyHandler |
getPropertyHandler() |
TerminalWin |
getTerminalWin() |
SSH2Transport |
getTransport() |
java.lang.String |
getUserName() |
java.lang.String |
getVersionId(boolean client) |
static byte[] |
getX11Cookie()
Get the local MIT_MAGIC_COOKIE to use for X11 connections.
|
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)
Prompt for a single string.
|
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)
This function is only used by AppGate internal code so there is
no need to actually implement it in any other code.
|
java.lang.String[] |
promptMulti(java.lang.String[] prompts,
boolean[] echos)
Prompt for multiple strings.
|
java.lang.String[] |
promptMultiFull(java.lang.String name,
java.lang.String instruction,
java.lang.String[] prompts,
boolean[] echos)
Prompt for multiple strings.
|
java.lang.String |
promptPassword(java.lang.String prompt) |
void |
propsStateChanged(SSHPropertyHandler props) |
boolean |
quietPrompts() |
void |
readFailed(java.lang.Exception e)
Called if the read failed
|
static 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 |
sendBreak()
Called when the user sends a break to the terminal
|
void |
sendBytes(byte[] b)
May be called when the user pastes data.
|
void |
sendBytesDirect(byte[] b)
Send some bytes directly to the host.
|
void |
sessionStarted(SSHClient client) |
void |
setDialogParent(java.awt.Component parent) |
void |
setMenus(SSHMenuHandler menus) |
void |
setProperty(java.lang.String name,
java.lang.String value) |
void |
showLogo() |
void |
signalTermTypeChanged(java.lang.String newTermType)
Called when the terminal type has changed.
|
void |
signalWindowChanged(int rows,
int cols,
int vpixels,
int hpixels)
Called when the size of the terminal window has changed.
|
void |
splashScreen() |
void |
startNewSession(SSHClient client) |
void |
startSFTP(boolean startSFTP) |
void |
typedChar(byte[] b)
Called when the user types a character
|
void |
typedChar(char c)
Called when the user types a character
|
void |
updateMenus() |
void |
updateTitle() |
void |
waitForCompletion() |
void |
writeFailed()
Called if the write failed
|
addLocalPortForward, addLocalPortForward, addRef, boot, bootSSH, bootSSH, clearAllForwards, delRef, delRemotePortForward, disconnect, doSingleCommand, getConsole, getException, getExitStatus, getLocalAddr, getServerAddr, getServerRealAddr, getServerVersion, isConnected, isOpened, setConsole, setExitStatus, setLocalAddr, setServerRealAddr, shutdown, startExitMonitor, startExitMonitor, waitForExit, waitForExitgetAltAuthName, getAuthName, getAuthType, getAuthTypes, getCipherName, getCipherType, getProxyType, getProxyTypes, getSupportedCipher, initCipher, initClientCipher, initServerCipher, isAuthTypeSupported, isProtocolFlagSet, log, logDebug, logExtra, logIgnore, msgTypeString, secureRandomclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisConnectedpublic boolean isSSH2
public SSH2Transport transport
public boolean wantHelpInfo
public java.lang.String customStartMessage
public boolean quiet
public boolean exitOnLogout
public SSHInteractiveClient(boolean quiet,
boolean exitOnLogout,
SSHPropertyHandler propsHandler)
public SSHInteractiveClient(SSHInteractiveClient clone)
public void setMenus(SSHMenuHandler menus)
public void setDialogParent(java.awt.Component parent)
public SSHPropertyHandler getPropertyHandler()
public void updateMenus()
public void splashScreen()
public boolean installLogo()
public static java.io.ByteArrayOutputStream readResource(java.lang.String name)
public void doSingleCommand(java.lang.String commandLine)
throws java.lang.Exception
java.lang.Exceptionpublic void startSFTP(boolean startSFTP)
public void run()
run in interface java.lang.Runnablepublic long getConnectTimeout()
getConnectTimeout in class SSHClientpublic long getHelloTimeout()
getHelloTimeout in class SSHClientpublic long getKexTimeout()
public void connected(boolean timeout)
NIOCallbackNotifyWhenConnected method of Switchboard).connected in interface NIOCallbackconnected in class SSHClienttimeout - true if the connection attempt timed outpublic void connectionFailed(java.lang.Exception e)
NIOCallbackNotifyWhenConnected method of Switchboard).connectionFailed in interface NIOCallbackconnectionFailed in class SSHCliente - the exception the connection failed with.public void completed(java.nio.ByteBuffer buf)
NIOCallbackcompleted in interface NIOCallbackcompleted in class SSHClientbuf - the buffer provided to the read callpublic void readFailed(java.lang.Exception e)
NIOCallbackreadFailed in interface NIOCallbackreadFailed in class SSHClientpublic void writeFailed()
NIOCallbackwriteFailed in interface NIOCallbackwriteFailed in class SSHClientpublic boolean isDumb()
public TerminalWin getTerminalWin()
public void showLogo()
public void hideLogo()
public Logo getLogo()
public void updateTitle()
public java.lang.String promptLine(java.lang.String prompt,
boolean echo)
throws SSH2UserCancelException
SSH2InteractorpromptLine in interface SSH2Interactorprompt - The prompt string to showecho - True if the text the user enters should be
echoed.SSH2UserCancelExceptionpublic java.lang.String[] promptMulti(java.lang.String[] prompts,
boolean[] echos)
throws SSH2UserCancelException
SSH2InteractorpromptMulti in interface SSH2Interactorprompts - List of prompts to showechos - List of boolean values which indicates if the
text entered for the corresponding prompt should
be echoed.SSH2UserCancelExceptionpublic java.lang.String[] promptMultiFull(java.lang.String name,
java.lang.String instruction,
java.lang.String[] prompts,
boolean[] echos)
throws SSH2UserCancelException
SSH2InteractorpromptMultiFull in interface SSH2Interactorname - Suggested title of the dialoginstruction - Instructions to show to user in the dialogprompts - List of prompts to showechos - List of boolean values which indicates if the
text entered for the corresponding prompt should
be echoed.SSH2UserCancelExceptionpublic int promptList(java.lang.String name,
java.lang.String instruction,
java.lang.String[] choices)
throws SSH2UserCancelException
SSH2InteractorIt is used to let the user select one element in a list.
promptList in interface SSH2Interactorname - Suggested title of dialoginstruction - Instructions to show to userchoices - Array of possible choicesSSH2UserCancelExceptionpublic void propsStateChanged(SSHPropertyHandler props)
propsStateChanged in interface SSHInteractorpublic void startNewSession(SSHClient client)
startNewSession in interface SSHInteractorpublic void sessionStarted(SSHClient client)
sessionStarted in interface SSHInteractorpublic boolean quietPrompts()
quietPrompts in interface SSHInteractorpublic boolean isVerbose()
isVerbose in interface SSHInteractorpublic java.lang.String promptLine(java.lang.String prompt,
java.lang.String defaultVal)
throws java.io.IOException
promptLine in interface SSHInteractorjava.io.IOExceptionpublic java.lang.String promptPassword(java.lang.String prompt)
throws java.io.IOException
promptPassword in interface SSHInteractorjava.io.IOExceptionpublic boolean askConfirmation(java.lang.String message,
boolean defAnswer)
askConfirmation in interface SSHInteractorpublic boolean askConfirmation(java.lang.String message,
boolean preferDialog,
boolean defAnswer)
throws java.io.IOException
java.io.IOExceptionpublic boolean licenseDialog(java.lang.String license)
licenseDialog in interface SSHInteractorpublic void connected(SSHClient client)
connected in interface SSHInteractorpublic void open(SSHClient client)
open in interface SSHInteractorpublic void disconnected(SSHClient client, boolean graceful)
disconnected in interface SSHInteractorpublic void report(java.lang.String msg)
report in interface SSHInteractorpublic SSH2Interactor getInteractor()
getInteractor in interface MindTermApppublic void alert(java.lang.String msg)
alert in interface MindTermAppalert in interface SSHInteractorpublic void forcedDisconnect()
forcedDisconnect in class SSHClientpublic void requestLocalPortForward(java.lang.String localHost,
int localPort,
java.lang.String remoteHost,
int remotePort,
java.lang.String plugin)
throws java.io.IOException
requestLocalPortForward in class SSHClientjava.io.IOExceptionpublic void addRemotePortForward(java.lang.String remoteHost,
int remotePort,
java.lang.String localHost,
int localPort,
java.lang.String plugin)
addRemotePortForward in class SSHClientpublic void delLocalPortForward(java.lang.String localHost,
int port)
delLocalPortForward in class SSHClientpublic void delRemotePortForward(java.lang.String remoteHost,
int port)
delRemotePortForward in class SSHClientpublic void callback(java.lang.Object arg)
public boolean fingerprintMatch(SSH2Signature serverHostKey)
public void typedChar(char c)
TerminalInputListenertypedChar in interface TerminalInputListenerc - typed characterpublic void typedChar(byte[] b)
TerminalInputListenertypedChar in interface TerminalInputListenerb - byte code representation fo the character encoded in
the current encoding.public void sendBytes(byte[] b)
TerminalInputListenersendBytes in interface TerminalInputListenerb - array of bytes representing characters to inputpublic void sendBytesDirect(byte[] b)
TerminalInputListenersendBytesDirect in interface TerminalInputListenerb - array of bytes representing characters to sendpublic void sendBreak()
TerminalInputListenersendBreak in interface TerminalInputListenerpublic void signalWindowChanged(int rows,
int cols,
int vpixels,
int hpixels)
TerminalInputListenersignalWindowChanged in interface TerminalInputListenerrows - new number of rowscols - new number of columnsvpixels - new number of vertical pixelshpixels - new number of horizontal pixelspublic void signalTermTypeChanged(java.lang.String newTermType)
TerminalInputListenersignalTermTypeChanged in interface TerminalInputListenernewTermType - new terminal type to emulatepublic void addAuthModules(SSH2Authenticator authenticator, java.lang.String methods)
public void newShell()
public java.lang.String getVersionId(boolean client)
getVersionId in class SSHpublic void closeTunnelFromList(int listIdx)
public java.lang.String[] listTunnels()
public java.lang.String getHost()
getHost in interface MindTermApppublic int getPort()
getPort in interface MindTermApppublic java.util.Properties getProperties()
getProperties in interface MindTermApppublic java.lang.String getProperty(java.lang.String name)
getProperty in interface MindTermApppublic void setProperty(java.lang.String name,
java.lang.String value)
setProperty in interface MindTermApppublic java.lang.String getUserName()
getUserName in interface MindTermApppublic java.awt.Component getDialogParent()
getDialogParent in interface MindTermApppublic java.lang.String getAppName()
getAppName in interface MindTermApppublic boolean isApplet()
isApplet in interface MindTermApppublic java.applet.AppletContext getAppletContext()
getAppletContext in interface MindTermApppublic SSH2Transport getTransport()
getTransport in interface MindTermApppublic SSH2Connection getConnection()
getConnection in interface MindTermApppublic SSHConsoleRemote getConsoleRemote()
getConsoleRemote in interface MindTermAppprotected void disconnect(boolean graceful,
java.lang.Exception e)
disconnect in class SSHClientpublic void waitForCompletion()
throws java.lang.Exception
java.lang.Exceptionpublic static byte[] getX11Cookie()