Created
May 2, 2016 08:23
-
-
Save xxxVxxx/e1e62dfc5cc3cec564b3c5f17c763046 to your computer and use it in GitHub Desktop.
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 characters
#!/usr/bin/python | |
import sys | |
try: | |
import pexpect | |
except ImportError: | |
sys.stderr.write("\nPexpect is not installed. You can do so with 'pip install pexpect' :)\n\n") | |
exit(1) | |
def connect(root_pass,username, password, response='phone'): | |
conn = pexpect.spawn('sudo openvpn --config /usr/bin/client.ovpn --auth-retry interact') | |
conn.logfile = None | |
conn.expect('\[sudo\]') | |
conn.sendline(root_pass) | |
conn.logfile = sys.stdout | |
conn.expect('Username:') | |
conn.sendline(username) | |
conn.expect('Password:') | |
conn.logfile = None | |
conn.sendline(password) | |
conn.logfile = sys.stdout | |
conn.expect('Response:') | |
conn.delaybeforesend = 1 | |
conn.sendline(response) | |
conn.expect('Initialization Sequence Completed') | |
def main(): | |
root_pass = '@#$!@$!@#$' # replace with your system root password. NOTE: This is also not my password :D | |
username = 'xxxVxxx' # replace with your username. NOTE. This is my username :) | |
password = 'h14!BYEbOH4BOLm' # replace with your password. NOTE: This is also not my password :P | |
response = '' # set this to push if you want to use your mobile duo notification | |
connect(root_pass, username, password) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment