Internet Kill Switch
#1
Hello everyone,

So just giving a bit back for people........new user so if this is in the wrong place please let me know....

anyway........this is for Windows, you can adapt to unix/linux


SCRIPT STARTS HERE
:::::::::::::::::::::::::::::
@echo off
:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B
:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------
@echo off
:: CHANGE DEFAULT GW IP BELOW. IT IS USED IF THE SCRIPT CAN'T DETECT YOUR GW IP
set defgw=192.168.0.1
@For /f "tokens=3" %%1 in (
   'route.exe print 0.0.0.0 ^|findstr "\<0.0.0.0.*0.0.0.0\>"') Do set defgw=%%1
cls
:start
cls
echo.
color 0A
echo VPN IP KILL SWITCH
echo.
echo.
echo Your NON-VPN (ISP) gateway is probably "%defgw%"
echo.
echo USAGE:
echo.
echo -Press "1" to REMOVE default gateway (IP "%defgw%")
echo -Press "2" to RESTORE default gateway (IP "%defgw%")
echo -Press "3" Flush DNS
echo -Press "4" To Ping EVIL
echo -Press "h" for more info.
echo -Press "x" or CTRL-C to exit script.
echo.
set /p choice=Your choice:
if '%Choice%'=='1' goto :choice1
if '%Choice%'=='2' goto :choice2
if '%Choice%'=='3' goto :choice3
if '%Choice%'=='4' goto :choice4
if '%Choice%'=='x' goto :exit
if '%Choice%'=='h' goto :help
echo Insert 1, 2, 3, x or h
timeout 2
goto start
:choice1
route delete 0.0.0.0 %defgw%
echo Default gateway "%defgw%" removed
timeout 2
goto start
:choice2
route add 0.0.0.0 mask 0.0.0.0 %defgw%
echo Default gateway "%defgw%" restored
timeout 2
goto start
:choice3
echo
ipconfig /flushdns
timeout 2
goto start
:choice4
ping 8.8.8.8
timeout 1
goto start
:help
cls
timeout /T -1
goto start
:exit
exit
::::::::::::::::::::::::::::::::::::::
SCRIPT ENDS  HERE

Copy the above into notepad, save as VPNKILL.bat, run when connected through OpenVPN/ your VPN choice.

Enjoy your torrenting...
Reply
#2
This sounds like it will disable the VPN and enable the ISP network, exposing net apps like P2P.
Openvpn will re-enable the original routing table if killed.
Ping google? Bad itdea. Try OpenDNS.

Check the
route add|del commands (google) for a simpler way to stop the network, and turn it back on.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My Month with DuckDuckGo: A Search Engine Switch nightwalker 2 1,557 Oct 08, 2024, 06:47 am
Last Post: murph
  Crypto is the best way to bust Internet censorship Ladyanne3 6 3,633 Mar 10, 2024, 15:52 pm
Last Post: maskaw
  US: Hidden anti-cryptography provisions in Internet anti-trust bills Resurgence 0 11,541 Jun 23, 2022, 00:57 am
Last Post: Resurgence
  India's draconian rules for internet platforms threaten user privacy and encryption Resurgence 0 16,435 Jul 21, 2021, 20:05 pm
Last Post: Resurgence
  MI5 slammed by watchdog for failing to delete intercepted phone and internet data Resurgence 0 15,006 Mar 14, 2020, 16:13 pm
Last Post: Resurgence



Users browsing this thread: 1 Guest(s)