标签:active node require key finish try connect bsp lang
var arr=[]; for(var i=0;i<255;++i){ arr.push("10.110.80."+i); } for(var i=0;i<arr.length;++i){ var ip=arr[i]; testip(ip); } function testip(ip){ let password="xxxxxx"; NodeSSH = require(‘node-ssh‘) ssh = new NodeSSH() ssh.connect({ host: ip, username: ‘root‘, port: 22, password, tryKeyboard: true, onKeyboardInteractive: (name, instructions, instructionsLang, prompts, finish) => { //console.log(prompts); if (prompts.length > 0 && prompts[0].prompt.toLowerCase().includes(‘password‘)) { finish(password) } } }).then(function(conn){ console.log(ip); },function(err){ }) }
标签:active node require key finish try connect bsp lang
原文地址:https://www.cnblogs.com/wolbo/p/13255044.html