Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. var Telnet = require('telnet-client')
  2. var connection = new Telnet()
  3.  
  4. var params = {
  5. host: '192.168.1.79',
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement