Start work on new telnet server

This commit is contained in:
Bryan Ashby 2020-05-17 20:22:16 -06:00
parent ad2382c1f2
commit 75787b6107
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
4 changed files with 58 additions and 2 deletions

View File

@ -285,6 +285,11 @@ function getDefaultConfig() {
},
loginServers : {
telnet2: {
port: 8810,
enabled : true,
firstMenu: 'telnetConnected',
},
telnet : {
port : 8888,
enabled : true,

View File

@ -0,0 +1,43 @@
// ENiGMA½
const LoginServerModule = require('../../login_server_module');
const Client = require('../../client');
// deps
const net = require('net');
const { TelnetSocket, TelnetSpec } = require('telnet-socket');
const ModuleInfo = exports.moduleInfo = {
name : 'Telnet',
desc : 'Telnet Server',
author : 'NuSkooler',
isSecure : false,
packageName : 'codes.l33t.enigma.telnet.server.v2',
};
class TelnetClient extends Client {
constructor(socket) {
super();
this.setInputOutput(socket, socket);
this.telnetSocket = new TelnetSocket(socket);
// :TODO: banner
}
};
exports.getModule = class TelnetServerModule extends LoginServerModule {
constructor() {
super();
}
createServer(cb) {
this.server = net.createServer( socket => {
const client = new TelnetClient(socket);
this.handleNewClient(client, socket, ModuleInfo);
});
return cb(null);
}
};

View File

@ -57,7 +57,8 @@
"uuid-parse": "1.1.0",
"ws": "^7.3.0",
"xxhash": "^0.3.0",
"yazl": "^2.5.1"
"yazl": "^2.5.1",
"telnet-socket" : "github:NuSkooler/telnet-socket"
},
"devDependencies": {},
"engines": {

View File

@ -160,7 +160,7 @@ bcrypt-pbkdf@^1.0.2:
dependencies:
tweetnacl "^0.14.3"
binary-parser@^1.6.2:
binary-parser@^1.5.0, binary-parser@^1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/binary-parser/-/binary-parser-1.6.2.tgz#8410a82ffd9403271ec182bd91e63a09cee88cbe"
integrity sha512-cYAhKB51A9T/uylDvMK7uAYaPLWLwlferNOpnQ0E0fuO73yPi7kWaWiOm22BvuKxCbggmkiFN0VkuLg6gc+KQQ==
@ -1840,6 +1840,13 @@ tar@^4:
safe-buffer "^5.1.2"
yallist "^3.0.2"
"telnet-socket@github:NuSkooler/telnet-socket":
version "0.1.0"
resolved "https://codeload.github.com/NuSkooler/telnet-socket/tar.gz/a29ea2edaec98bb844f2b0d27fa0977f33eaa7bf"
dependencies:
binary-parser "^1.5.0"
buffers "github:NuSkooler/node-buffers"
temptmp@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/temptmp/-/temptmp-1.1.0.tgz#bfbbff858d7f7d59c563fbf069758a7775ecd431"