V1.0.4 Handle backspace

master
Ng Yat Yan 1 month ago
parent 2af24c044e
commit 9417a7b022

@ -16,7 +16,7 @@
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<Root level="debug">
<AppenderRef ref="LogToConsole" />
</Root>
</Loggers>

@ -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

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.sshd</groupId>
<artifactId>echo-sshd-server</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<name>ECHO SSH SERVER</name>
<description>Learning Apache Mina SSHD library</description>
<parent>

@ -116,8 +116,16 @@ public class EchoShellFactory implements Factory<Command> {
}
command = "";
} else {
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();
}

Loading…
Cancel
Save