cracki Posted September 7, 2010 Report Share Posted September 7, 2010 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.pyyou'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 More sharing options...
GTHK Posted September 8, 2010 Report Share Posted September 8, 2010 I saw a guide somewhere once about using Win firewall to selectively block a program from certain interfaces. A cool firewall like Comodo might be able to do it too. Link to comment Share on other sites More sharing options...
cracki Posted September 8, 2010 Author Report Share Posted September 8, 2010 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 More sharing options...
sangesi Posted August 13, 2012 Report Share Posted August 13, 2012 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 More sharing options...
Kitsoran Posted August 13, 2012 Report Share Posted August 13, 2012 How often does the script poll? Does µTorrent have time to establish a connection or two before it's killed? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.