telnet-auth

library to connect to a telnet server that asks for authentication

Usage no npm install needed!

<script type="module">
  import telnetAuth from 'https://cdn.skypack.dev/telnet-auth';
</script>

README

install

npm install telnet-auth

usage

var TelnetClient = require('telnet-auth');
var telnetcli = new TelnetClient();

const connconf = {
    host: '127.0.0.1',
    port: 23,
    needCredentials: true,
    username: "user",
    password: "pass",
    log: true
};

const telnet = new TelnetClient()
    telnet.connect(connconf);
    telnet.on('authenticated', function () {
        telnet.on('response', function (response) {
            console.log(response);
        })
        telnet.write('echo "Test"');

        setTimeout(function () {
            telnet.destroy()
        }, 1000);
    })