diff --git a/pyvpn b/pyvpn index 8cd426f..532317f 100755 --- a/pyvpn +++ b/pyvpn @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os +import time import sys import pexpect import os.path @@ -24,13 +25,12 @@ if len(sys.argv) > 2: configFilePath = operatingDir + "/" + clientName + ".ovpn" - fScript.expect(".*[1-4]:") + fScript.expect("Looks") fScript.sendline("1") - fScript.expect(".*name:") + fScript.expect("Tell") fScript.sendline(clientName) - fScript.expect(".*") + fScript.expect(pexpect.EOF) - fScript.kill(0) if os.path.exists(configFilePath): @@ -40,21 +40,21 @@ if len(sys.argv) > 2: sys.stdout.write(finalResult) sys.stdout.flush() - sys.exit() + quit() else: sys.stdout.write("Error! OpenVPN did not create the Configuration file.") sys.stdout.flush() - sys.stdout.exit() + quit() else: sys.stdout.write("Error! Missing options!") sys.stdout.flush() - sys.stdout.exit() + quit() else: sys.stdout.write("Error! Missing client name!") sys.stdout.flush() - sys.stdout.exit() + quit()