def startVPN(vpn_profile):
# Call the platform VPN to start the VPN
if not fakeConnection():
p = getPlatform()
if p == platforms.RPI or p == platforms.LINUX:
command=getOpenVPNPath() + " \"" + vpn_profile + "\" > " + getVPNLogFilePath() + " &"
if useSudo() : command = "sudo " + command
debugTrace("(Linux) Starting VPN with " + command)
os.system(command)
if p == platforms.WINDOWS:
command=getOpenVPNPath() + " \"" + vpn_profile + "\""
debugTrace("(Windows) Starting VPN with " + command)
args = shlex.split(command)
outfile = open(getVPNLogFilePath(),'w')
proc = subprocess.Popen(args, stdout=outfile, creationflags=subprocess.SW_HIDE, shell=True)
# **** ADD MORE PLATFORMS HERE ****
else:
# This bit is just to help with debug during development.
command=getOpenVPNPath() + " \"" + vpn_profile + "\" > " + getVPNLogFilePath()
debugTrace("Faking starting VPN with " + command)
return
评论列表
文章目录