mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 15:50:57 +03:00
logback instead of log4j
This commit is contained in:
@@ -23,10 +23,6 @@ import java.io.IOException;
|
||||
/** This examples demonstrates how a remote command can be executed. */
|
||||
public class Exec {
|
||||
|
||||
// static {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String... args)
|
||||
throws IOException {
|
||||
SSHClient ssh = new SSHClient();
|
||||
@@ -37,7 +33,7 @@ public class Exec {
|
||||
|
||||
ssh.authPublickey(System.getProperty("user.name"));
|
||||
|
||||
Command cmd = ssh.startSession().exec("ping google.com -n 1");
|
||||
Command cmd = ssh.startSession().exec("ping -c 1 google.com");
|
||||
|
||||
// Pipe.pipe(cmd.getInputStream(), System.out, cmd.getLocalMaxPacketSize(), false);
|
||||
System.out.print(cmd.getOutputAsString());
|
||||
|
||||
@@ -26,11 +26,6 @@ import java.net.InetSocketAddress;
|
||||
*/
|
||||
public class LocalPF {
|
||||
|
||||
// static
|
||||
// {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String... args)
|
||||
throws IOException {
|
||||
SSHClient ssh = new SSHClient();
|
||||
|
||||
@@ -28,10 +28,6 @@ import java.net.InetSocketAddress;
|
||||
*/
|
||||
public class RemotePF {
|
||||
|
||||
// static {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String... args)
|
||||
throws IOException {
|
||||
SSHClient client = new SSHClient();
|
||||
|
||||
@@ -28,10 +28,6 @@ import java.io.IOException;
|
||||
/** A very rudimentary psuedo-terminal based on console I/O. */
|
||||
class RudimentaryPTY {
|
||||
|
||||
// static {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String... args)
|
||||
throws IOException {
|
||||
|
||||
|
||||
@@ -22,10 +22,6 @@ import java.io.IOException;
|
||||
/** This example demonstrates downloading of a file over SCP from the SSH server. */
|
||||
public class SCPDownload {
|
||||
|
||||
// static {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String[] args)
|
||||
throws IOException {
|
||||
SSHClient ssh = new SSHClient();
|
||||
|
||||
@@ -22,10 +22,6 @@ import java.io.IOException;
|
||||
/** This example demonstrates uploading of a file over SCP to the SSH server. */
|
||||
public class SCPUpload {
|
||||
|
||||
// static {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String[] args)
|
||||
throws IOException, ClassNotFoundException {
|
||||
SSHClient ssh = new SSHClient();
|
||||
|
||||
@@ -22,10 +22,6 @@ import java.io.IOException;
|
||||
/** This example demonstrates downloading of a file over SFTP from the SSH server. */
|
||||
public class SFTPDownload {
|
||||
|
||||
// static {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String[] args)
|
||||
throws IOException {
|
||||
SSHClient ssh = new SSHClient();
|
||||
|
||||
@@ -22,11 +22,6 @@ import java.io.IOException;
|
||||
/** This example demonstrates uploading of a file over SFTP to the SSH server. */
|
||||
public class SFTPUpload {
|
||||
|
||||
// static
|
||||
// {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String[] args)
|
||||
throws IOException {
|
||||
SSHClient ssh = new SSHClient();
|
||||
|
||||
@@ -27,10 +27,6 @@ import java.net.InetSocketAddress;
|
||||
/** This example demonstrates how forwarding X11 connections from a remote host can be accomplished. */
|
||||
public class X11 {
|
||||
|
||||
// static {
|
||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
// }
|
||||
|
||||
public static void main(String... args)
|
||||
throws IOException, InterruptedException {
|
||||
SSHClient ssh = new SSHClient();
|
||||
|
||||
@@ -18,9 +18,6 @@ package net.schmizz.sshj;
|
||||
import net.schmizz.sshj.transport.TransportException;
|
||||
import net.schmizz.sshj.userauth.UserAuthException;
|
||||
import net.schmizz.sshj.util.BogusPasswordAuthenticator;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.ConsoleAppender;
|
||||
import org.apache.log4j.PatternLayout;
|
||||
import org.apache.sshd.SshServer;
|
||||
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
|
||||
import org.junit.After;
|
||||
@@ -35,9 +32,6 @@ import static org.junit.Assert.assertTrue;
|
||||
/* Kinda basic right now */
|
||||
|
||||
public class SmokeTest {
|
||||
static {
|
||||
BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
||||
}
|
||||
|
||||
private SSHClient ssh;
|
||||
private SshServer sshd;
|
||||
|
||||
Reference in New Issue
Block a user