Skip to content

Instantly share code, notes, and snippets.

@nettedfish
Last active December 14, 2015 01:09

Revisions

  1. nettedfish renamed this gist Feb 21, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. nettedfish revised this gist Feb 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion temp
    Original 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就是那个几分钟就会变的6位数
    #token的可变部分
    send -- $2${token}\r;
    interact;"
    }
  3. nettedfish created this gist Feb 21, 2013.
    14 changes: 14 additions & 0 deletions temp
    Original 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密码前缀,不可变部分"