A Java library which implements an embeddable Telnet server. The server is fully multithreaded and supports numerous Telnet RFC's.
kTelnet is licensed under the BSD terms
<groupId>com.khubla.ktelnet</groupId>
<artifactId>ktelnet</artifactId>
<packaging>jar</packaging>
<version></version>
A simple example using the default Telnet implementation:
private final static int THREADS = 20;
private final static int PORT = 2121;
public static void main(String[] args) {
try {
/*
* telnet
*/
final TelnetServer telnetServer = new TelnetServer(PORT, THREADS, new BasicShellFactoryImpl());
telnetServer.start();
/*
* wait
*/
Thread.sleep(1000);
System.out.println("Press any key to exit");
System.in.read();
/*
* shutdown
*/
telnetServer.shutdown();
} catch (final Exception e) {
e.printStackTrace();
System.exit(0);
}
- RFC 727 - Logout
- RFC 856 - Binary
- RFC 857 - Echo
- RFC 858 - Suppress Go Ahead
- RFC 859 - Status
- RFC 860 - Mark
- RFC 885 - EOR
- RFC 1091 - Termtype
- RFC 1073 - Winsize
- RFC 1079 - Termspeed
Telnet options are enumerated here
Login is implemented by passing an implementation of AuthenticationHandler to the shell constructor. A simple properties file based implementation PropertiesFileAuthenticationHandlerImpl is provided.
Custom shells can be implemented by extending the classes ShellFactory, BasicTelnetCommandRegistryImpl and AbstractCommand. A very simple shell which implements the "quit" command is provided: BasicShellImpl
kTelnet supports logging at the byte level via NVTSpy. A console implementation ConsoleNVTSpyImpl and a log file implementation LoggingNVTSpyImpl are provided.