Last active
December 14, 2015 01:09
Revisions
-
nettedfish renamed this gist
Feb 21, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nettedfish revised this gist
Feb 21, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ spawn -noecho $sshcmd -tt $1 expect "*password*"; send -- 这儿是一长串密码,注意保留本行末尾的3个字符\r; expect "*PASSCODE*"; #token的可变部分 send -- $2${token}\r; interact;" } -
nettedfish created this gist
Feb 21, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #!/bin/bash read -p "请输入6位token动态密码: " token sshcmd='ssh -o StrictHostKeyChecking=no -o NumberOfPasswordPrompts=1 -o ConnectTimeout=2' online_login_ssh (){ expect -c "set timeout -1; spawn -noecho $sshcmd -tt $1 expect "*password*"; send -- 这儿是一长串密码,注意保留本行末尾的3个字符\r; expect "*PASSCODE*"; #token就是那个几分钟就会变的6位数 send -- $2${token}\r; interact;" } online_login_ssh "yinggang1@通道机ip地址" "这儿是你的token密码前缀,不可变部分"