Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103397
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: Testing whether the VPN is running? |
| Date | Tue, 23 Feb 2016 19:24:45 +1100 |
| Lines | 25 |
| Message-ID | <mailman.62.1456215889.20994.python-list@python.org> (permalink) |
| References | <8ghgpcxrd3.ln2@news.ducksburg.com> |
| Reply-To | python-list@python.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de Vvo95/QSww4dAw8CQTohywS05fsaItCLBsF/H/S+E7RA== |
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'imply': 0.07; 'cc:addr:python-list': 0.09; 'output': 0.13; 'section.': 0.15; '>on': 0.16; 'adam': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'modul': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'simpson': 0.16; 'ssh': 0.16; 'task:': 0.16; 'vpn': 0.16; 'wrote:': 0.16; 'else,': 0.18; 'hack': 0.18; '(not': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'cheers,': 0.22; 'cc:no real name:2**0': 0.22; 'header:In-Reply- To:1': 0.24; "i've": 0.25; 'header:User-Agent:1': 0.26; 'installed': 0.26; 'turns': 0.27; 'interface': 0.29; 'that.': 0.30; 'too.': 0.30; 'up.': 0.32; 'url:python': 0.33; 'running': 0.34; 'that,': 0.34; 'could': 0.35; 'newer': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'version': 0.38; 'received:localdomain': 0.38; 'skip:p 20': 0.38; 'test': 0.39; 'does': 0.39; 'subject:the': 0.39; "didn't": 0.39; 'your': 0.60; 'address': 0.61; 'default': 0.61; 'personal': 0.63; 'cameron': 0.66; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; '>if': 0.84; 'reply- to:addr:python.org': 0.84; 'route': 0.84; 'subject:Testing': 0.84 |
| Content-Disposition | inline |
| In-Reply-To | <8ghgpcxrd3.ln2@news.ducksburg.com> |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:103397 |
Show key headers only | View raw
On 18Feb2016 10:03, Adam Funk <a24061@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@zip.com.au>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Testing whether the VPN is running? Adam Funk <a24061@ducksburg.com> - 2016-02-18 09:26 +0000
Re: Testing whether the VPN is running? Ervin Hegedüs <airween@gmail.com> - 2016-02-18 10:45 +0100
Re: Testing whether the VPN is running? Adam Funk <a24061@ducksburg.com> - 2016-02-18 10:03 +0000
Re: Testing whether the VPN is running? Cameron Simpson <cs@zip.com.au> - 2016-02-23 19:24 +1100
Re: Testing whether the VPN is running? Adam Funk <a24061@ducksburg.com> - 2016-02-25 13:25 +0000
Re: Testing whether the VPN is running? Gisle Vanem <gvanem@yahoo.no> - 2016-02-23 10:40 +0100
Re: Testing whether the VPN is running? Dan Stromberg <drsalists@gmail.com> - 2016-02-25 15:01 -0800
csiph-web