diff --git a/conf/log4j2.xml b/conf/log4j2.xml index 710e29a..8fb6fff 100644 --- a/conf/log4j2.xml +++ b/conf/log4j2.xml @@ -16,7 +16,7 @@ - + diff --git a/conf/replies.properties b/conf/replies.properties index 6f992f9..015e2db 100644 --- a/conf/replies.properties +++ b/conf/replies.properties @@ -1,7 +1,7 @@ -prompt=$ +prompt=root@localhost$ 5BAABD7C4581F90088133C0E945302C2=\t0\t0\t0 - uname=Linux -9DD46246144D353C914D7572AEDF8EA6=Linux mail.vidconnect.cyou 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:10 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux -whoami=appadmin +9DD46246144D353C914D7572AEDF8EA6=Linux localhost 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:10 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux +whoami=root 4DE8A3B5E72E54D9D2A70BD43CB5EA9E=Model:\t\t0 99EFF9F4022855955653078ECB2B4CE4=1.9G diff --git a/pom.xml b/pom.xml index 22a31e7..cface4a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.example.sshd echo-sshd-server - 1.0.3 + 1.0.4 ECHO SSH SERVER Learning Apache Mina SSHD library diff --git a/src/main/java/com/example/sshd/config/EchoShellFactory.java b/src/main/java/com/example/sshd/config/EchoShellFactory.java index e64aa21..2e5c09c 100644 --- a/src/main/java/com/example/sshd/config/EchoShellFactory.java +++ b/src/main/java/com/example/sshd/config/EchoShellFactory.java @@ -100,7 +100,7 @@ public class EchoShellFactory implements Factory { @Override public void run() { - String prompt = repliesProperties.getProperty("prompt","$ "); + String prompt = repliesProperties.getProperty("prompt", "$ "); try { out.write(prompt.getBytes()); out.flush(); @@ -116,8 +116,16 @@ public class EchoShellFactory implements Factory { } command = ""; } else { - out.write(s); - command += (char) s; + logger.trace("input character: {}", s); + if (s == 127) { + if (command.length() > 0) { + command = command.substring(0, command.length() - 1); + out.write(s); + } + } else if (s >= 32 && s < 127) { + command += (char) s; + out.write(s); + } } out.flush(); }