Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.09 KB | None | 0 0
  1. var Client = require('ssh2').Client;
  2.  
  3. console.log('Start ssh2...');
  4. var conn = new Client();
  5. conn.on('ready', function() {
  6. console.log('Client :: ready');
  7. conn.shell(function(err, stream) {
  8. if (err) throw err;
  9. stream.on('close', function() {
  10. console.log('Stream :: close');
  11. conn.end();
  12. }).on('data', function(data) {
  13. console.log('STDOUT: ' + data);
  14. }).stderr.on('data', function(data) {
  15. console.log('STDERR: ' + data);
  16. });
  17. stream.end('ls -lnexitn');
  18. });
  19. }).connect({
  20. host: '12.12.12.12',
  21. port: 22,
  22. tryKeyboard: true,
  23. debug: console.log,
  24. readyTimeout: 99999,
  25. username: 'root',
  26. password: 'password'
  27. });
  28.  
  29. DEBUG: Local ident: 'SSH-2.0-ssh2js0.0.14'
  30. DEBUG: Client: Trying 123.123.123.123 on port 22 ...
  31. DEBUG: Client: Connected
  32. DEBUG: Parser: IN_INIT
  33. DEBUG: Parser: IN_GREETING
  34. DEBUG: Parser: IN_HEADER
  35. DEBUG: Remote ident: 'SSH-2.0-OpenSSH_6.2'
  36. DEBUG: Outgoing: Writing KEXINIT
  37. DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
  38. DEBUG: Parser: IN_PACKET
  39. DEBUG: Parser: pktLen:1540,padLen:7,remainLen:1536
  40. DEBUG: Parser: IN_PACKETDATA
  41. DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXINIT
  42. DEBUG: Comparing KEXINITs ...
  43. DEBUG: (local) KEX algorithms: diffie-hellman-group-exchange-sha256,diffie-hellm
  44. an-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
  45. DEBUG: (remote) KEX algorithms: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-
  46. nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1
  47. ,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
  48. DEBUG: KEX algorithm: diffie-hellman-group-exchange-sha256
  49. DEBUG: (local) Host key formats: ssh-rsa,ssh-dss
  50. DEBUG: (remote) Host key formats: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
  51. DEBUG: Host key format: ssh-rsa
  52. DEBUG: (local) Client->Server ciphers: aes256-ctr,aes192-ctr,aes128-ctr,aes128-g
  53. cm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com,aes256-cbc,aes192-cb
  54. c,aes128-cbc,blowfish-cbc,3des-cbc,arcfour256,arcfour128,cast128-cbc,arcfour
  55. DEBUG: (remote) Client->Server ciphers: aes128-ctr,aes192-ctr,aes256-ctr,arcfour
  56. 256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc
  57. ,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu
  58. .se
  59. DEBUG: Client->Server Cipher: aes256-ctr
  60. DEBUG: (local) Server->Client ciphers: aes256-ctr,aes192-ctr,aes128-ctr,aes128-g
  61. cm,aes128-gcm@openssh.com,aes256-gcm,aes256-gcm@openssh.com,aes256-cbc,aes192-cb
  62. c,aes128-cbc,blowfish-cbc,3des-cbc,arcfour256,arcfour128,cast128-cbc,arcfour
  63. DEBUG: (remote) Server->Client ciphers: aes128-ctr,aes192-ctr,aes256-ctr,arcfour
  64. 256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc
  65. ,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu
  66. .se
  67. DEBUG: Server->Client Cipher: aes256-ctr
  68. DEBUG: (local) Client->Server HMAC algorithms: hmac-md5,hmac-sha1,hmac-sha2-256,
  69. hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-sha1-96,hmac
  70. -md5-96
  71. DEBUG: (remote) Client->Server HMAC algorithms: hmac-md5-etm@openssh.com,hmac-sh
  72. a1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-25
  73. 6-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,h
  74. mac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-
  75. 64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,h
  76. mac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
  77. DEBUG: Client->Server HMAC algorithm: hmac-md5
  78. DEBUG: (local) Server->Client HMAC algorithms: hmac-md5,hmac-sha1,hmac-sha2-256,
  79. hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-sha1-96,hmac
  80. -md5-96
  81. DEBUG: (remote) Server->Client HMAC algorithms: hmac-md5-etm@openssh.com,hmac-sh
  82. a1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-25
  83. 6-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,h
  84. mac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-
  85. 64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,h
  86. mac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
  87. DEBUG: Server->Client HMAC algorithm: hmac-md5
  88. DEBUG: (local) Client->Server compression algorithms: none
  89. DEBUG: (remote) Client->Server compression algorithms: none,zlib@openssh.com
  90. DEBUG: Client->Server compression algorithm: none
  91. DEBUG: (local) Server->Client compression algorithms: none
  92. DEBUG: (remote) Server->Client compression algorithms: none,zlib@openssh.com
  93. DEBUG: Server->Client compression algorithm: none
  94. DEBUG: Outgoing: Writing KEXDH_GEX_REQUEST
  95. DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
  96. DEBUG: Parser: IN_PACKET
  97. DEBUG: Parser: pktLen:404,padLen:8,remainLen:400
  98. DEBUG: Parser: IN_PACKETDATA
  99. DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXDH_GEX_GROUP
  100. DEBUG: Outgoing: Writing KEXDH_GEX_INIT
  101. DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
  102. DEBUG: Parser: IN_PACKET
  103. DEBUG: Parser: pktLen:956,padLen:7,remainLen:952
  104. DEBUG: Parser: IN_PACKETDATA
  105. DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXDH_GEX_REPLY
  106. DEBUG: Checking host key format
  107. DEBUG: Checking signature format
  108. DEBUG: Verifying host fingerprint
  109. DEBUG: Host accepted by default (no verification)
  110. DEBUG: Verifying signature
  111. DEBUG: Outgoing: Writing NEWKEYS
  112. DEBUG: Parser: IN_PACKETBEFORE (expecting 8)
  113. DEBUG: Parser: IN_PACKET
  114. DEBUG: Parser: pktLen:12,padLen:10,remainLen:8
  115. DEBUG: Parser: IN_PACKETDATA
  116. DEBUG: Parser: IN_PACKETDATAAFTER, packet: NEWKEYS
  117. DEBUG: Outgoing: Writing SERVICE_REQUEST (ssh-userauth)
  118. DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
  119. DEBUG: Parser: IN_PACKET
  120. DEBUG: Parser: Decrypting
  121. DEBUG: Parser: pktLen:28,padLen:10,remainLen:16
  122. DEBUG: Parser: IN_PACKETDATA
  123. DEBUG: Parser: Decrypting
  124. DEBUG: Parser: HMAC size:16
  125. DEBUG: Parser: IN_PACKETDATAVERIFY
  126. DEBUG: Parser: Verifying MAC
  127. DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
  128. DEBUG: Parser: IN_PACKETDATAAFTER, packet: SERVICE_ACCEPT
  129. DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)
  130. DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
  131. DEBUG: Parser: IN_PACKET
  132. DEBUG: Parser: Decrypting
  133. DEBUG: Parser: pktLen:44,padLen:7,remainLen:32
  134. DEBUG: Parser: IN_PACKETDATA
  135. DEBUG: Parser: Decrypting
  136. DEBUG: Parser: HMAC size:16
  137. DEBUG: Parser: IN_PACKETDATAVERIFY
  138. DEBUG: Parser: Verifying MAC
  139. DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
  140. DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_FAILURE
  141. DEBUG: Client: password auth failed
  142. DEBUG: Outgoing: Writing USERAUTH_REQUEST (keyboard-interactive)
  143. DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
  144. DEBUG: Parser: IN_PACKET
  145. DEBUG: Parser: Decrypting
  146. DEBUG: Parser: pktLen:44,padLen:11,remainLen:32
  147. DEBUG: Parser: IN_PACKETDATA
  148. DEBUG: Parser: Decrypting
  149. DEBUG: Parser: HMAC size:16
  150. DEBUG: Parser: IN_PACKETDATAVERIFY
  151. DEBUG: Parser: Verifying MAC
  152. DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)
  153. DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_INFO_REQUEST
  154. DEBUG: Parser: IN_PACKETBEFORE (expecting 16)
  155. events.js:85
  156. throw er; // Unhandled 'error' event
  157. ^
  158. Error: Timed out while waiting for handshake
  159. at null._onTimeout (node_modulesssh2libclient.js:138:17)
  160. at Timer.listOnTimeout (timers.js:110:15)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement