Jump to content

VPN users: this kills uTorrent when your VPN goes down


cracki

Recommended Posts

Hi,

I was getting ticked off that my VPN always craps out in the middle of the night and utorrent just kept on using the unsecured ISP connection.

So I wrote this little python script that watches the VPN connection and makes sure uTorrent (or any other application) is only running when the VPN is running. if the VPN connection drops, the script will kill utorrent and automatically start it later (if it had to be killed due to the drop).

there's still a chance that utorrent communicates over your non-VPN internet connection. however, utorrent will probably not upload/download anything successfully in the short timespan between the VPN going down and utorrent getting killed.

here's the script: http://vpnmon.googlecode.com/hg/vpnmon.py

you'll need python v2.5 or later, and the WMI module ( http://pypi.python.org/pypi/WMI/ ).

the script contains instructions on how to use it. you're supposed to run it in the "DOS prompt", commonly called a console, shell, or command line.

i haven't figured out how to get at named VPN connections, so you'll have to mess around with magic IDs. these IDs seem to be stable at least.

is this something you folks can use?

edit: i know that openvpn already has a facility for running batch scripts after connection/disconnection. some VPN providers use PPTP and that's why i wrote this.

Link to comment
Share on other sites

I have Gigabit LAN. Comodo uses so much CPU that I can barely get 150 Mbit/s.

=> I don't use 3rd party personal firewalls anymore.

If I didn't need my Gigabit LAN, I'd still be using Comodo on that box and just add a rule to block uT on all other interfaces.

I've googled around a bit and couldn't find anything on "windows group/security policies" that could restrict network activity like this. The Windows XP firewall can filter on remote IP, but I didn't see anything about interfaces there either.

There was some freeware tool that acted as a launcher, would hook various sockets APIs and force them to bind to a specified interface. I tried that tool. It didn't work.

So, that little script is for people in my situation. I hope I'm not alone ;)

Link to comment
Share on other sites

  • 1 year later...

Hi, cracki,

thanks a lot!

This problem with loosing vpn connection and uTorrent still sharing over my unsecured ISP, was really annoying, and kind of risky, I must say. Before starting to write myself, I looked around and found your script, after tiny changes (syntax of a print() has been changed) runs smoothly. Thank you very much for sharing!

regards,

Denis.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Guest
This topic is now closed to further replies.
×
×
  • Create New...