de.mud.ssh
Class SshWrapper
java.lang.Object
  |
  +--de.mud.jta.Wrapper
        |
        +--de.mud.ssh.SshWrapper
- public class SshWrapper- extends Wrapper
The telnet ssh is a sample class for how to use the SSH protocol
 handler of the JTA source package. To write a program using the wrapper
 you may use the following piece of code as an example:
 
   SshWrapper telnet = new SshWrapper();
   try {
     ssh.connect(args[0], 23);
     ssh.login("user", "password");
     ssh.setPrompt("user@host");
     ssh.waitfor("Terminal type?");
     ssh.send("dumb");
     System.out.println(ssh.send("ls -l"));
   } catch(java.io.IOException e) {
     e.printStackTrace();
   }
 
 Please keep in mind that the password is visible for anyone who can
 download the class file. So use this only for public accounts or if
 you are absolutely sure nobody can see the file.
 
 Maintainer:Marcus Meißner
- Version:
- $Id: SshWrapper.java,v 1.4 2003/04/26 12:36:21 marcus Exp $
- Author:
- Matthias L. Jugel, Marcus Meißner
 
 
 
| Method Summary | 
|  int | read(byte[] b)Read data from the backend and decrypt it.
 | 
|  java.lang.String | send(java.lang.String cmd)Send a command to the remote host.
 | 
 
| Methods inherited from class de.mud.jta.Wrapper | 
| connect, disconnect, getPrompt, getTerminalType, getWindowSize, login, setLocalEcho, setPrompt, waitfor, waitfor, write | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
handler
protected SshIO handler
SshWrapper
public SshWrapper()
send
public java.lang.String send(java.lang.String cmd)
                      throws java.io.IOException
- Send a command to the remote host. A newline is appended and if
 a prompt is set it will return the resulting data until the prompt
 is encountered.
 
- 
- Overrides:
- sendin class- Wrapper
 
- 
- Parameters:
- cmd- the command
- Returns:
- output of the command or null if no prompt is set
- java.io.IOException
 
read
public int read(byte[] b)
         throws java.io.IOException
- Read data from the backend and decrypt it. This is a buffering read
 as the encrypted information is usually smaller than its decrypted
 pendant. So it will not read from the backend as long as there is
 data in the buffer.
 
- 
- Overrides:
- readin class- Wrapper
 
- 
- Parameters:
- b- the buffer where to read the decrypted data in
- Returns:
- the amount of bytes actually read.
- java.io.IOException