|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Process
verinec.util.J2sshProcess
public class J2sshProcess
Process implementation for J2ssh.
J2ssh developpment has been abandoned, because the company behind has
started a commercial rewrite of the library.
J2ssh seems to have some weaknesses. On sensitive systems, an other
implementation should be used - if you use only linux, you could also build
an scp distributor using the ProgramExec method to call scp.
Original J2ssh copyright notice:
J2ssh is Copyright (C) 2002-2003 Lee David Painter and Contributors.
See www.sshtools.com for more
information about j2ssh.
However, at sshtools.com, they sell a new implementation. The library we use within VeriNeC is still online at sourceforge.net/projects/sshtools
SshProgramExec| Nested Class Summary | |
|---|---|
class |
J2sshProcess.ProcessThread
A thread to execute a command on a channel. |
static class |
J2sshProcess.SingleKnownHostsKeyVerification
Used if the fingerprint of the target host is specified. |
| Field Summary | |
|---|---|
private String |
cmdline
|
private File |
cwd
|
private InputStream |
error
Input stream for process error output. |
private J2sshProcess.ProcessThread |
executer
|
private PipedInputStream |
input
Input stream of process output. |
private PipedOutputStream |
output
Output stream for process input. |
private int |
retval
|
private com.sshtools.j2ssh.SshClient |
ssh
|
| Constructor Summary | |
|---|---|
J2sshProcess(String cmdline,
com.sshtools.j2ssh.SshClient ssh,
File cwd)
Start a program execution process. |
|
| Method Summary | |
|---|---|
void |
destroy()
Kills the subprocess. |
int |
exitValue()
Returns the exit value for the subprocess. |
InputStream |
getErrorStream()
Gets the error stream of the subprocess. |
InputStream |
getInputStream()
Gets the input stream of the subprocess. |
OutputStream |
getOutputStream()
Gets the output stream of the subprocess. |
static com.sshtools.j2ssh.SshClient |
getSshConnection(String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
Perform all the messy work of setting up the ssh connection. |
static com.sshtools.j2ssh.SshClient |
getSshConnection(String username,
String password,
File keyfile,
String passphrase,
com.sshtools.j2ssh.configuration.SshConnectionProperties props,
com.sshtools.j2ssh.transport.HostKeyVerification hv)
Perform all the messy work of setting up the ssh connection. |
int |
waitFor()
causes the current thread to wait, if necessary, until the process represented by this Process object has terminated. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private J2sshProcess.ProcessThread executer
private com.sshtools.j2ssh.SshClient ssh
private String cmdline
private int retval
private File cwd
private InputStream error
private PipedInputStream input
private PipedOutputStream output
| Constructor Detail |
|---|
public J2sshProcess(String cmdline,
com.sshtools.j2ssh.SshClient ssh,
File cwd)
throws VerinecException
cmdline - The command line to executessh - The client to use. Connection must be established.cwd - The current working directory (on the remote system). If null, no cwd is used.
VerinecException - If creating ssh process fails.| Method Detail |
|---|
public void destroy()
destroy in class Processpublic int exitValue()
exitValue in class ProcessIllegalThreadStateException - if the subprocess represented by this Process object has not yet terminated.public InputStream getErrorStream()
getErrorStream in class Processpublic InputStream getInputStream()
getInputStream in class Processpublic OutputStream getOutputStream()
getOutputStream in class Process
public int waitFor()
throws InterruptedException
waitFor in class ProcessInterruptedException - if the current thread is interrupted by another thread while it is waiting, then the wait is ended and an InterruptedException is thrown.
public static com.sshtools.j2ssh.SshClient getSshConnection(String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
throws VerinecException
host - Hostname to connect toport - A port number to use, pass -1 to leave defaultusername - The username to log into the remote system.password - The password to use for password authentication. If null, no password auth is attempted.prefPublicKey - The preferred public key algorithm. 'ssh-rsa' is a good choice.keyfile - The path to file containing the private keys. If null, no public key auth is attempted.passphrase - The passphrase to use with the key file. Pass null if no pass phrase needed.hostVerification - Requirement for host verification.
Possible values are ignore, interactive or the expected host fingerprint.
VerinecException - If the connection can not be established
IllegalArgumentException - If one of the arguments can not be used.
public static com.sshtools.j2ssh.SshClient getSshConnection(String username,
String password,
File keyfile,
String passphrase,
com.sshtools.j2ssh.configuration.SshConnectionProperties props,
com.sshtools.j2ssh.transport.HostKeyVerification hv)
throws VerinecException
getSshConnection(String,int,String,String,String,File,String,String)
if you do not want to set up the connection properties yourselves.
username - The username to log into the remote system.password - The password to use for password authentication. If null, no password auth is attempted.keyfile - The path to file containing the private keys. If null, no public key auth is attempted.passphrase - The passphrase to use with the key file. Pass null if no pass phrase needed.props - The connection properties, setting host, port, preferred algorithm ecc.hv - The desired HostKeyVerification instance.
VerinecException - If the connection can not be established
IllegalArgumentException - If one of the arguments can not be used.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||