Skip to content

Instantly share code, notes, and snippets.

@antelio
Created April 12, 2021 16:48
Show Gist options
  • Select an option

  • Save antelio/7f411dd9fc58cb9bad3bbc90ac922cf7 to your computer and use it in GitHub Desktop.

Select an option

Save antelio/7f411dd9fc58cb9bad3bbc90ac922cf7 to your computer and use it in GitHub Desktop.
# print('Hello World')
import os
print("User Name: ", os.environ.get('USERNAME'))
print("Locaweb VPN HOST: ", os.environ.get('LW_VPN_HOST'))
print("Locaweb VPN USER: ", os.environ.get('LW_VPN_USER'))
print("Locaweb VPN TOKEN: ", os.environ.get('LW_VPN_TOKEN'))
print("Locaweb VPN PIN: ", os.environ.get('LW_VPN_PIN'))
vpn_host = os.environ.get('LW_VPN_HOST')
vpn_user = os.environ.get('LW_VPN_USER')
pin = os.environ.get('LW_VPN_PIN')
token = os.environ.get('LW_VPN_TOKEN')
import pyotp
totp = pyotp.TOTP(token)
print("Current OTP:", totp.now())
vpn_password = pin + totp.now()
print("Locaweb VPN Password: ", vpn_password)
'c:\program files\python38\python.exe -m pip install --upgrade pip'
import pyperclip
pyperclip.copy(vpn_password)
print("Sent Password to clipboard: ", pyperclip.paste())
# import subprocess, os
# fortclient_cli = r"C:\Users\abe\Utils\SSLVPNcmdline\FortiSSLVPNclient.exe"
# command = " connect -u " + vpn_user + ":" + vpn_password + " -h " + vpn_host + " -i -m "
# Parameters:
# -u username:password
# -h server:port
# -i ignore server certificate
# -m minimize
# print(fortclient_cli)
# print(args)
# subprocess.call("command-name-here")
# subprocess.call(["/path/to/command", "arg1", "-arg2"])
# os.system("/path/to/exe/RegressionSystem.exe -config "+str(config)+" filename")
# os.system(fortclient_cli + args)
# subprocess.run(["start", fortclient_cli, args])
# os.system("start " + fortclient_cli + " connect " + args)
# subprocess.Popen([fortclient_cli, "connect", "-u", vpn_user + ":" + vpn_password, "-h", vpn_host, "-i", "-m"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment