通过跳板机的登录通常很麻烦,能够使用 vbs自动登录脚本。html
windows下的xshell的vbs登录脚本shell
Sub Main xsh.Screen.Synchronous = true ' xsh.Screen.WaitForString "resource" xsh.screen.send "2" xsh.screen.send Chr(13) xsh.Screen.WaitForString "account" xsh.screen.send "root" xsh.screen.send Chr(13) xsh.Session.Sleep 1000 xsh.Screen.WaitForString "password:" xsh.screen.send "Root@123456" xsh.screen.send Chr(13) xsh.Session.Sleep 1000 xsh.Screen.WaitForString "~$" xsh.screen.send "ssh admin@120.16.150.141" xsh.screen.send VbCr xsh.Session.Sleep 5000 xsh.Screen.WaitForString "password:" xsh.screen.send "Admin@123456" xsh.screen.send VbCr ' VbCr is equal to Chr(13) xsh.Screen.Synchronous = false End Sub
xshell下脚本不少是否无效,特别是 WaitForString 和 WaitForStrings 函数windows
windows下securityCRT的登录脚本服务器
Sub Main crt.Screen.WaitForString "select the resource" ,30 crt.screen.send "2" crt.screen.send Chr(13) crt.Screen.WaitForString "account" ,10 crt.screen.send "root" crt.screen.send Chr(13) crt.Screen.WaitForString "password" ,10 crt.screen.send "Root@123456" crt.screen.send Chr(13) crt.Screen.WaitForString "~$" ,10 crt.screen.send "ssh admin@120.16.150.141" crt.screen.send Chr(13) crt.Screen.WaitForString "assword:" ,10 crt.screen.send "Admin@123456" crt.screen.send Chr(13) End Sub
参考资料:ssh
二、 xshell官方手册 http://www.netsarang.com/docs/Xshell5_manual.pdfpost
三、 shell实现SSH自动登录ui
四、 【ssh】经过跳板机自动登陆目标服务器 url