Advertisement
Guest User

Untitled

a guest
Oct 14th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. var Telnet = require('telnet-client')
  2. var connection = new Telnet()
  3.  
  4. var params = {
  5. host: '127.0.0.1',
  6. port: 23,
  7. shellPrompt: '/ # ',
  8. timeout: 1500,
  9. // removeEcho: 4
  10. }
  11.  
  12. connection.on('ready', function(prompt) {
  13. connection.exec(cmd, function(err, response) {
  14. console.log(response)
  15. })
  16. })
  17.  
  18. connection.on('timeout', function() {
  19. console.log('socket timeout!')
  20. connection.end()
  21. })
  22.  
  23. connection.on('close', function() {
  24. console.log('connection closed')
  25. })
  26.  
  27. connection.connect(params)`
  28.  
  29. `var params = {
  30. host: '127.0.0.1',
  31. port: 23,
  32. shellPrompt: '/ #',
  33. loginPrompt: 'Username: ',
  34. passwordPrompt: 'Password: ',
  35. username: 'vinit',
  36. password: 'vinit123',
  37. initialLFCR: true,
  38. timeout: 1500,
  39. // removeEcho: 4
  40. }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement