Closed Kaimunchi closed 4 years ago
I suppose you're connecting to busybox based on your shell prompt?
here i want to connect remote telnet server.
Use appropriate shell prompt. The one you get when manually connecting via linux/windows.
i'm using windows terminal
@Kaimunchi - This is not a paid service. You leverage this library to make it work for you. People don't just help everyone here for free. I invested at least two years of my precious time to provide you with this library for free, so the least you can do is try looking into what might be the issue on your side and also provide bugfixes if they arise. Thank you.
My apologies
I'm trying to connect mikrotik router using this code,its giving this error,but in router telnet logs shows its connected via telnet
connect
connection closed
Unhandled rejection Error: Cannot connect
at Socket.<anonymous> (D:\New folder\node_modules\telnet-client\lib\index.js:85:25)
at Object.onceWrapper (events.js:416:28)
at Socket.emit (events.js:310:20)
at Socket._onTimeout (net.js:479:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
Unhandled rejection Error: Socket closes
at Socket.<anonymous> (D:\New folder\node_modules\telnet-client\lib\index.js:121:18)
at Socket.emit (events.js:310:20)
at TCP.<anonymous> (net.js:672:12)
connection closed ```
#this is the code what i'm trying
```var telnet = require('telnet-client');
var connection = new telnet();
var params = {
host: '1.2.3.4',
port: 6023,
shellPrompt: /[>\]]/,
loginPrompt: "Login: ",
passwordPrompt: "Password: ",
username: 'admin',
password: 'admin',
timeout: 10000,
}
connection.on('connect',function()
{
console.log('connect');
});
connection.connect('ready',function()
{
connection.exec("interface enable numbers=0");
});
connection.on('timeout', function() {
console.log('socket timeout!')
connection.end();
});
connection.on('close', function() {
console.log('connection closed');
});
connection.connect(params); ```