Advertisement
Guest User

telnetNodeTest_5.4.17

a guest
May 4th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var telnet = require('telnet-client');
  2. var connection = new telnet();
  3.  
  4. var params = {
  5.   host: 'devnetcool.cciops.com',
  6.   port: 22,
  7.   loginPrompt: 'login: ',
  8.   passwordPrompt: 'Password: ',
  9.   username: 'Vanguard',
  10.   password: 'fL@sh3!',
  11.   timeout: 3500,
  12.   // removeEcho: 4
  13. };
  14.  
  15. connection.on('ready', function(prompt) {
  16.   connection.exec(cmd, function(err, response) {
  17.     console.log(response);
  18.   });
  19. });
  20.  
  21. connection.on('timeout', function() {
  22.   console.log('socket timeout!')
  23.   connection.end();
  24. });
  25.  
  26. connection.on('close', function() {
  27.   console.log('connection closed');
  28. });
  29.  
  30. connection.connect(params);
  31. console.log(response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement