mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-08 08:10:55 +03:00
logback instead of log4j
This commit is contained in:
87
pom.xml
87
pom.xml
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -45,57 +46,35 @@
|
|||||||
<version>1.45</version>
|
<version>1.45</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jcraft</groupId>
|
<groupId>com.jcraft</groupId>
|
||||||
<artifactId>jzlib</artifactId>
|
<artifactId>jzlib</artifactId>
|
||||||
<version>1.0.7</version>
|
<version>1.0.7</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.6</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.sshd</groupId>
|
<groupId>org.apache.sshd</groupId>
|
||||||
<artifactId>sshd-core</artifactId>
|
<artifactId>sshd-core</artifactId>
|
||||||
<version>0.3.0</version>
|
<version>0.4.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>logback-core</artifactId>
|
||||||
<version>1.5.11</version>
|
<version>0.9.20</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<version>1.2.15</version>
|
<version>0.9.20</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.sun.jdmk</groupId>
|
|
||||||
<artifactId>jmxtools</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.sun.jmx</groupId>
|
|
||||||
<artifactId>jmxri</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>javax.jms</groupId>
|
|
||||||
<artifactId>jms</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>javax.mail</groupId>
|
|
||||||
<artifactId>mail</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>oro</groupId>
|
|
||||||
<artifactId>oro</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -172,7 +151,7 @@
|
|||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>dev</id>
|
<id>full-deps</id>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
@@ -185,36 +164,14 @@
|
|||||||
<version>1.0.7</version>
|
<version>1.0.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>logback-core</artifactId>
|
||||||
<version>1.5.11</version>
|
<version>0.9.20</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<version>1.2.15</version>
|
<version>0.9.20</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.sun.jdmk</groupId>
|
|
||||||
<artifactId>jmxtools</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.sun.jmx</groupId>
|
|
||||||
<artifactId>jmxri</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>javax.jms</groupId>
|
|
||||||
<artifactId>jms</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>javax.mail</groupId>
|
|
||||||
<artifactId>mail</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>oro</groupId>
|
|
||||||
<artifactId>oro</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</profile>
|
</profile>
|
||||||
|
|||||||
@@ -23,10 +23,6 @@ import java.io.IOException;
|
|||||||
/** This examples demonstrates how a remote command can be executed. */
|
/** This examples demonstrates how a remote command can be executed. */
|
||||||
public class Exec {
|
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)
|
public static void main(String... args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SSHClient ssh = new SSHClient();
|
SSHClient ssh = new SSHClient();
|
||||||
@@ -37,7 +33,7 @@ public class Exec {
|
|||||||
|
|
||||||
ssh.authPublickey(System.getProperty("user.name"));
|
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);
|
// Pipe.pipe(cmd.getInputStream(), System.out, cmd.getLocalMaxPacketSize(), false);
|
||||||
System.out.print(cmd.getOutputAsString());
|
System.out.print(cmd.getOutputAsString());
|
||||||
|
|||||||
@@ -26,11 +26,6 @@ import java.net.InetSocketAddress;
|
|||||||
*/
|
*/
|
||||||
public class LocalPF {
|
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)
|
public static void main(String... args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SSHClient ssh = new SSHClient();
|
SSHClient ssh = new SSHClient();
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ import java.net.InetSocketAddress;
|
|||||||
*/
|
*/
|
||||||
public class RemotePF {
|
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)
|
public static void main(String... args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SSHClient client = new SSHClient();
|
SSHClient client = new SSHClient();
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ import java.io.IOException;
|
|||||||
/** A very rudimentary psuedo-terminal based on console I/O. */
|
/** A very rudimentary psuedo-terminal based on console I/O. */
|
||||||
class RudimentaryPTY {
|
class RudimentaryPTY {
|
||||||
|
|
||||||
// static {
|
|
||||||
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static void main(String... args)
|
public static void main(String... args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ import java.io.IOException;
|
|||||||
/** This example demonstrates downloading of a file over SCP from the SSH server. */
|
/** This example demonstrates downloading of a file over SCP from the SSH server. */
|
||||||
public class SCPDownload {
|
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)
|
public static void main(String[] args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SSHClient ssh = new SSHClient();
|
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. */
|
/** This example demonstrates uploading of a file over SCP to the SSH server. */
|
||||||
public class SCPUpload {
|
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)
|
public static void main(String[] args)
|
||||||
throws IOException, ClassNotFoundException {
|
throws IOException, ClassNotFoundException {
|
||||||
SSHClient ssh = new SSHClient();
|
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. */
|
/** This example demonstrates downloading of a file over SFTP from the SSH server. */
|
||||||
public class SFTPDownload {
|
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)
|
public static void main(String[] args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SSHClient ssh = new SSHClient();
|
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. */
|
/** This example demonstrates uploading of a file over SFTP to the SSH server. */
|
||||||
public class SFTPUpload {
|
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)
|
public static void main(String[] args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
SSHClient ssh = new SSHClient();
|
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. */
|
/** This example demonstrates how forwarding X11 connections from a remote host can be accomplished. */
|
||||||
public class X11 {
|
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)
|
public static void main(String... args)
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
SSHClient ssh = new SSHClient();
|
SSHClient ssh = new SSHClient();
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ package net.schmizz.sshj;
|
|||||||
import net.schmizz.sshj.transport.TransportException;
|
import net.schmizz.sshj.transport.TransportException;
|
||||||
import net.schmizz.sshj.userauth.UserAuthException;
|
import net.schmizz.sshj.userauth.UserAuthException;
|
||||||
import net.schmizz.sshj.util.BogusPasswordAuthenticator;
|
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.SshServer;
|
||||||
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
|
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -35,9 +32,6 @@ import static org.junit.Assert.assertTrue;
|
|||||||
/* Kinda basic right now */
|
/* Kinda basic right now */
|
||||||
|
|
||||||
public class SmokeTest {
|
public class SmokeTest {
|
||||||
static {
|
|
||||||
BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
|
|
||||||
}
|
|
||||||
|
|
||||||
private SSHClient ssh;
|
private SSHClient ssh;
|
||||||
private SshServer sshd;
|
private SshServer sshd;
|
||||||
|
|||||||
Reference in New Issue
Block a user