Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Telnet = require('telnet-client')
- var connection = new Telnet()
- var params = {
- host: '127.0.0.1',
- port: 23,
- shellPrompt: '/ # ',
- timeout: 1500,
- // removeEcho: 4
- }
- connection.on('ready', function(prompt) {
- connection.exec(cmd, function(err, response) {
- console.log(response)
- })
- })
- connection.on('timeout', function() {
- console.log('socket timeout!')
- connection.end()
- })
- connection.on('close', function() {
- console.log('connection closed')
- })
- connection.connect(params)`
- `var params = {
- host: '127.0.0.1',
- port: 23,
- shellPrompt: '/ #',
- loginPrompt: 'Username: ',
- passwordPrompt: 'Password: ',
- username: 'vinit',
- password: 'vinit123',
- initialLFCR: true,
- timeout: 1500,
- // removeEcho: 4
- }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement