commit c8492f0988cfa5eb4ce354d99b96327c588af797 from: marcus date: Sat Aug 18 16:40:56 2007 UTC use login() method commit - 62b697056fea38b5d57781776735a084f5815724 commit + c8492f0988cfa5eb4ce354d99b96327c588af797 blob - 403f3ac0be11bbbb74d5ce0f2c5dccf23006333d blob + 64532b923915419bd1eeb8ae68dae2d5562f430c --- de/mud/ssh/SshWrapperExample.java +++ de/mud/ssh/SshWrapperExample.java @@ -35,22 +35,24 @@ package de.mud.ssh; * Maintainer:Marcus Meissner * * @version $Id$ - * @author Matthias L. Jugel, Marcus Mei�ner + * @author Matthias L. Jugel, Marcus Meissner */ public class SshWrapperExample { public static void main(String args[]) { SshWrapper ssh = new SshWrapper(); try { byte[] buffer = new byte[256]; + String foo; ssh.connect(args[0], 22); - ssh.login("marcus", "xxxxx"); - ssh.setPrompt("marcus"); - - System.out.println("after login"); - + ssh.login("marcus", "password"); + foo = ssh.waitfor("marcus"); + System.out.println(foo); ssh.send("ls -l"); - ssh.read(buffer); - System.out.println(new String(buffer)); + foo = ssh.waitfor("galeere"); // my hostname + System.out.println(foo); + ssh.send("ls -l"); + foo = ssh.waitfor("galeere"); // my hostname + System.out.println(foo); } catch (java.io.IOException e) { e.printStackTrace(); }