In past I've connected to VPN via Linux in Windows perfectly with python by using the following code:
import win32ras
hdl, retcode = win32ras.Dial (None, None, (vpn_name, ip, "", username, password, ""), None) #changing 'ip' will connect to that server ip
win32ras.HangUp (hdl) #This disconnects the connection
So this works perfectly fine in windows with python but now I want to do it in ubuntu with python and I'm not sure how to do this at all. I want to do the same, define a VPN name and change its IP on connecting and input via username/password, if there's any other way, like directly connecting to the VPN without even making one then that's obviously better.
I'm finding the solution on internet as of now, will update if I find something.
How about using the Linux PPTP Client: http://pptpclient.sourceforge.net/ ?
A few options for calling it from Python:
1) Call it as a command-line tool using subprocess: https://docs.python.org/2/library/subprocess.html
2) Build it as a library and call it via Cython: http://cython.org/
3) Build it as a Python package (and for bonus points, make it available to others!): https://docs.python.org/2/extending/extending.html