silverwind / expect-telnet Goto Github PK
View Code? Open in Web Editor NEWtelnet automation through expect-send sequences, like in Tcl
License: BSD 2-Clause "Simplified" License
telnet automation through expect-send sequences, like in Tcl
License: BSD 2-Clause "Simplified" License
Hi,
I am getting the error: "port" option should be a number or string: null. The hostname is: GPO_HBRISAS_DSL01:23
et("GPO_HBRISAS_DSL01:23", seq, {timeout: 60000, exit: true }, function(err) {
if (err) { // If error
console.log(err);
callback(err.toString()); // Returns error
}
});
If I change the hostname to an IP address works fine :
et("192.0.2.25:23", seq, {timeout: 60000, exit: true }, function(err) {
if (err) { // If error
console.log(err);
callback(err.toString()); // Returns error
}
});
Regards,
Oscar.
your package works great to 2 different telnet servers from my ubuntu box running node 4.4.5 (thanks!!)
but on 1 (tripp lite snmpwebcard), the small card apparently gets busy doing other stuff and occasionally hangs the socket in your code without driving any of your sequence timeouts, and since i don't end my code (restarts all day with settimeout), i was getting a buildup of fin_wait2s that wouldn't go away, unless I end my node, which I don't want to do
you already had the socket.setTimeout but no listener, so all I did was add this:
socket.on('timeout', function() {
console.log('socket timeout')
socket.destroy()
})
and no more fin_wait2 buildup on my ubuntu box!!
now if i could just figure out how to clean up a corresponding close_wait on the snmpwebcard... but i can reboot that occasionally so no big deal
i would do a pull request but i really don't know how
thanks again
Some characters don't seem to be printed to stdout, I wonder if telnet control characters are interfering, because I have zero handling for them right now.
i need var to do something.
Need to add some events for easier output and error handling.
Maybe a module rename is in order with this :)
Hi, I'm doing some tests with your library and it's working really fine. But I found myself in a situation where I need to execute several commands on a remote machine and it would be nice for parsing purpose to be able to send some kind of string between send calls something like this:
et("127.0.0.1:23", expect = [
{expect: "Login:" , send: `mylogin\n`},
{expect: "Password:", send: `${senha}\n`},
{expect: ">", send: "first command\n", delimiter: '-'.repeate(80)+"\n" },
{expect: ">" , send: "second command\n"},
{expect: ">" , out: function(result){
console.log(result)
}, send: 'exit\n'},
], function(err) {
if (err) console.error(err)
});
If the target machine is an linux or have some sort of echo or print command is ok, but in my case it's a proprietary device which doesn't have any means to print some string to the output, so it would be nice to be able to send this delimiter between commands in order to make ease to parse the output e use the same connection for multiples commands, or could be an event after or before the expect so we would be able to take custom actions in the middle of the processing.
Thanks
My understanding is that this module sends passwords in clear.
As far as I knew, tcl/expect uses some low-layer mechanism at the moment to send passwords and it manages to send them encrypted. But this nodejs module seems to emulate the "expect" syntax only.
Can you please confirm this, or point me to the instructions about shipment of encrypted password?
Thank you for your attention.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.