Testing whether the VPN is running?
Cameron Simpson
cs at zip.com.au
Tue Feb 23 03:24:45 EST 2016
More information about the Python-list mailing list
Tue Feb 23 03:24:45 EST 2016
- Previous message (by thread): Testing whether the VPN is running?
- Next message (by thread): Testing whether the VPN is running?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 18Feb2016 10:03, Adam Funk <a24061 at ducksburg.com> wrote: >On 2016-02-18, Ervin Hegedüs wrote: >> I think that the psutil modul could be better for you for this >> task: >> https://pypi.python.org/pypi/psutil/ >> >> and see the "Network" section. > >if 'tun0' in psutil.net_if_addrs(): > # vpn is running > >Brilliant! I've used psutil for something else, but I didn't know it >did that too. My excuse is that the version on my system was 2.2.1, >which does not do that, so I installed the newer version with pip3. >Thanks for pointing me to that. You might also want to check that the interface is up. My personal hack (not for a VPN, but for "being online", which turns my ssh tunnels on and off) is to look in the output of "netstat -rn" for a default route. This may imply that an alternative test for you is to test for a route to your VPN's address range? Just an idea. Cheers, Cameron Simpson <cs at zip.com.au>
- Previous message (by thread): Testing whether the VPN is running?
- Next message (by thread): Testing whether the VPN is running?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list