Skip to content
Need a script to kill Ethernet.
Got a problem with Viscosity or need help? Ask here!
Hi.
I just registered after searching last night for help on this came close on a few posts here but not what I'm after.
I'm using Viscosity and have a kill switch .Bat to run for FrostWire.
What I really need is a kill switch that drops my LAN when a disconnect occurs.
I tried a few scripts I found from other posts that were more related to dropping the wireless network and editing them adding my "Local Area Connection" instead but it still didn't work.
My VPN provider has a script for Mac but not windows it seems.
So can anyone help me with this please. If their is a script already somewhere that I haven't been able to find.
Or someone that can possibly write one for me would be awesome.
I just don't trust this kill switch even though FrostWire starts shutting down fast I think my IP will still been seen for microns of seconds.
Also have ticket restart network interfaces on disconnect in Viscosity but this takes a few seconds as well.
Thanks.
I just registered after searching last night for help on this came close on a few posts here but not what I'm after.
I'm using Viscosity and have a kill switch .Bat to run for FrostWire.
What I really need is a kill switch that drops my LAN when a disconnect occurs.
I tried a few scripts I found from other posts that were more related to dropping the wireless network and editing them adding my "Local Area Connection" instead but it still didn't work.
My VPN provider has a script for Mac but not windows it seems.
So can anyone help me with this please. If their is a script already somewhere that I haven't been able to find.
Or someone that can possibly write one for me would be awesome.
I just don't trust this kill switch even though FrostWire starts shutting down fast I think my IP will still been seen for microns of seconds.
Also have ticket restart network interfaces on disconnect in Viscosity but this takes a few seconds as well.
Thanks.
Hi unix,
There is no solution that will be truly instant I'm afraid, any solution will take a second or so to complete. If you want to take your network interface down in a script, the following line will do the job:
netsh interface set interface name="Local Area Connection" admin=DISABLED
Please also be aware that Viscosity scripts are run with the same privileges as Viscosity. The above script requires Admin rights so you will need to run Viscosity with Admin rights for the above script to work correctly.
To be a little bit quicker, you may wish to remove your default route first. This will stop almost all traffic and is much faster than disabling a network adapter, but please keep in mind Windows will add this again automatically after a period of time if the ethernet adapter is left enabled:
route delete 0.0.0.0
I would recommend trying the batch script on it's own to make sure it has the desired effect before using it with Viscosity.
Regards,
Eric
There is no solution that will be truly instant I'm afraid, any solution will take a second or so to complete. If you want to take your network interface down in a script, the following line will do the job:
netsh interface set interface name="Local Area Connection" admin=DISABLED
Please also be aware that Viscosity scripts are run with the same privileges as Viscosity. The above script requires Admin rights so you will need to run Viscosity with Admin rights for the above script to work correctly.
To be a little bit quicker, you may wish to remove your default route first. This will stop almost all traffic and is much faster than disabling a network adapter, but please keep in mind Windows will add this again automatically after a period of time if the ethernet adapter is left enabled:
route delete 0.0.0.0
I would recommend trying the batch script on it's own to make sure it has the desired effect before using it with Viscosity.
Regards,
Eric
Eric Thorpe
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Thanks a lot mate.
I'm trying to first solution. Does this script need to go into a .Bat file and loaded onto the Viscosity Disconnect option.
Or does it go in the extra Open VPN commands?.
Because I created a .Bat file and used the script and loaded it onto the disconnect option run as admin disconnected the server and nothing happened.
Also if I add it to the extra commands the connection doesn't connect with error as follows.
"Dec 16 01:09:45: Connection is reachable. Starting connection attempt.
Dec 16 01:09:45: Options error: Unrecognized option or missing "
Thanks again. Appreciate it.
I'm trying to first solution. Does this script need to go into a .Bat file and loaded onto the Viscosity Disconnect option.
Or does it go in the extra Open VPN commands?.
Because I created a .Bat file and used the script and loaded it onto the disconnect option run as admin disconnected the server and nothing happened.
Also if I add it to the extra commands the connection doesn't connect with error as follows.
"Dec 16 01:09:45: Connection is reachable. Starting connection attempt.
Dec 16 01:09:45: Options error: Unrecognized option or missing "
Thanks again. Appreciate it.
Hi unix,
Both need to be used in a batch (.bat) script. Change "Local Area Connection" so it matches the name of your interface (On Windows 7 or above this will generally be "Ethernet" instead), open notepad, insert this single line, save the file as something like disconnect.bat, and then double click the file to test it. On Vista or above, you will need to right click the bat file and select "Run as Administrator".
You can find a guide to batch scripts here - http://www.sparklabs.com/support/viswin_scripting/
Regards,
Eric
Both need to be used in a batch (.bat) script. Change "Local Area Connection" so it matches the name of your interface (On Windows 7 or above this will generally be "Ethernet" instead), open notepad, insert this single line, save the file as something like disconnect.bat, and then double click the file to test it. On Vista or above, you will need to right click the bat file and select "Run as Administrator".
You can find a guide to batch scripts here - http://www.sparklabs.com/support/viswin_scripting/
Regards,
Eric
Eric Thorpe
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Yeh got it. I just realised mines Local Internet Connection 2. That's awesome been looking for something like this for ages. thanks a lot.
Seems to work pretty quickly.
This route delete what does this actually do if you still have time?. Like diverts all traffic thought the VPN or something?.
The delete router 0.0.0.0, I presume this goes into the extra open VPN commands? or networking then routing then in default gateway?.
Once that's set up what would happen on disconnect then?.
Again sorry for asking for explanations on everything.
Appreciated.
Thanks.
Seems to work pretty quickly.
This route delete what does this actually do if you still have time?. Like diverts all traffic thought the VPN or something?.
The delete router 0.0.0.0, I presume this goes into the extra open VPN commands? or networking then routing then in default gateway?.
Once that's set up what would happen on disconnect then?.
Again sorry for asking for explanations on everything.
Appreciated.
Thanks.
Hi unix,
As mentioned above, the route command is also a command line (or batch) command, not an openvpn command. Put simply, routes tell your computer where to send network traffic, 0.0.0.0 is the "everything else" route so to speak, and is on your ethernet adapter by default. Removing this will mean Windows will not send any traffic anywhere unless it has a specific route in your routing table. The following might explain this a bit better - http://www.sparklabs.com/support/routin ... lications/
If netsh is doing the job at disabling your adapter, there isn't much point to the second method.
Regards,
Eric
As mentioned above, the route command is also a command line (or batch) command, not an openvpn command. Put simply, routes tell your computer where to send network traffic, 0.0.0.0 is the "everything else" route so to speak, and is on your ethernet adapter by default. Removing this will mean Windows will not send any traffic anywhere unless it has a specific route in your routing table. The following might explain this a bit better - http://www.sparklabs.com/support/routin ... lications/
If netsh is doing the job at disabling your adapter, there isn't much point to the second method.
Regards,
Eric
Eric Thorpe
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
Viscosity Developer
Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
6 posts
Page 1 of 1