Package JSSHTerminal

Class SSHSession

java.lang.Object
JSSHTerminal.SSHSession
All Implemented Interfaces:
com.jcraft.jsch.UserInfo

public final class SSHSession extends Object implements com.jcraft.jsch.UserInfo
SSH session
  • Constructor Details

    • SSHSession

      public SSHSession(MainPanel parent, int width, int height, int scrollSize)
      Parameters:
      parent - Parent terminal frame
      width - Width of the terminal. For example, 80.
      height - Height of the terminal. For example, 25.
      scrollSize - Scrollbar buffer size
  • Method Details

    • setSshPort

      public void setSshPort(int port)
      Sets the SSH port
      Parameters:
      port - Port number
    • setAnswerYes

      public void setAnswerYes(boolean enable)
      Automatically answer yes to question
      Parameters:
      enable - true to enable, false otherwise
    • setX11Forwarding

      public void setX11Forwarding(boolean enable)
      Enable X11 forwarding
      Parameters:
      enable - true to enable, false otherwise
    • execCommand

      public void execCommand(String cmd) throws IOException
      Execute the given command
      Parameters:
      cmd - Command to be executed (Do not add \n at the end)
      Throws:
      IOException
    • connect

      public void connect(String host, String user, String password) throws IOException
      Connect to a host using name and password.
      Parameters:
      host - Host to connect
      user - username
      password - password (if null, password will be prompted)
      Throws:
      IOException
    • isConnected

      public boolean isConnected()
    • close

      public void close()
    • write

      public void write(String k)
    • getTerminal

      public TerminalEmulator getTerminal()
    • getPassphrase

      public String getPassphrase()
      Specified by:
      getPassphrase in interface com.jcraft.jsch.UserInfo
    • getPassword

      public String getPassword()
      Specified by:
      getPassword in interface com.jcraft.jsch.UserInfo
    • promptPassword

      public boolean promptPassword(String message)
      Specified by:
      promptPassword in interface com.jcraft.jsch.UserInfo
    • promptPassphrase

      public boolean promptPassphrase(String s)
      Specified by:
      promptPassphrase in interface com.jcraft.jsch.UserInfo
    • promptYesNo

      public boolean promptYesNo(String str)
      Specified by:
      promptYesNo in interface com.jcraft.jsch.UserInfo
    • showMessage

      public void showMessage(String s)
      Specified by:
      showMessage in interface com.jcraft.jsch.UserInfo