Skip to content

Instantly share code, notes, and snippets.

@jcouyang
Last active March 10, 2019 01:20
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save jcouyang/68f487656bacb6535c7e to your computer and use it in GitHub Desktop.
Save jcouyang/68f487656bacb6535c7e to your computer and use it in GitHub Desktop.
thoughtworks VPN 1 click login script
  1. sudo pip install onetimepass
  2. 需要okta绑定 google authenticator 时 QR code里面的16位的 secret, android 用 barcode scaner 一扫就知道了
  3. 填到 auth.py 里
  4. 填用户名密码到 inputs.txt
  5. 以后每次运行 ./vpn connect (用 zsh or fish) 就登上了
  6. vpn diconnect 下线
import os
import onetimepass as otp
my_secret = 'SECRET_FROM_QRCODE'
print otp.get_totp(my_secret)
y
USENAME
PASSWORD
3
AUTHENTICATOR_CODE
exit
#!/bin/zsh
answers=$(sed 's/AUTHENTICATOR_CODE/'$(python auth.py)'/g' inputs.txt)
echo $answers | /opt/cisco/anyconnect/bin/vpn -s $1 bjvpn.thoughtworks.com
@howiehu
Copy link

howiehu commented Jun 27, 2015

inputs.txt 里面第一行的 y 好像已经没有用了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment