天天上班第一件事,就是鏈接公司LAB裏面的機器,但首先要過一個防火牆,每次輸用戶名密碼是很累人的事,bash
如下是兩個腳本,能夠放在啓動項中,開機便自動登陸spa
WINDOWS:blog
@echo off ipconfig /flushdns echo set sh=WScript.CreateObject("WScript.Shell") > telnet_tmp.vbs echo WScript.Sleep 200 >> telnet_tmp.vbs echo sh.SendKeys "username{ENTER}" >>telnet_tmp.vbs echo WScript.Sleep 200 >>telnet_tmp.vbs echo sh.SendKeys "password{ENTER}">>telnet_tmp.vbs start telnet 9.XXX.XXX.92 //your ip address cscript //Nologo telnet_tmp.vbs
LINUX OR OS Xdns
#!/usr/bin/expect set timeout 20 #set hostName [lindex $argv 0] #set userName [lindex $argv 1] #set password [lindex $argv 2] set hostName "9.xxx.xxx.247" set userName "username" set password "passw0rd" spawn telnet $hostName expect "'^]'." exit expect "FSO" expect "Username:" send "$userName\r" expect "Password:" send "$password\r"; interact