├── killswitch-windows.exe ├── killswitch-windows ├── obj │ └── Debug │ │ ├── killswitch-windows.csproj.CoreCompileInputs.cache │ │ ├── killswitch-windows.exe │ │ ├── killswitch-windows.pdb │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ ├── killswitch-windows.csprojAssemblyReference.cache │ │ ├── killswitch-windows.csproj.FileListAbsolute.txt │ │ ├── killswitch-windows.application │ │ └── killswitch-windows.exe.manifest ├── SelectQuery.cs ├── ManagementObject.cs ├── bin │ └── Debug │ │ ├── Colorful.Console.dll │ │ ├── killswitch-windows.exe │ │ ├── killswitch-windows.pdb │ │ ├── app.publish │ │ └── killswitch-windows.exe │ │ ├── killswitch-windows.exe.config │ │ ├── killswitch-windows.application │ │ └── killswitch-windows.exe.manifest ├── ManagementObjectSearcher.cs ├── killswitch-windows_TemporaryKey.pfx ├── packages.config ├── System │ └── ServiceProcess.cs ├── App.config ├── killswitch-windows.csproj.user ├── Properties │ └── AssemblyInfo.cs ├── Program.cs └── killswitch-windows.csproj ├── packages └── Colorful.Console.1.2.9 │ ├── Colorful.Console.1.2.9.nupkg │ └── lib │ ├── net40 │ └── Colorful.Console.dll │ ├── net45 │ └── Colorful.Console.dll │ ├── net451 │ └── Colorful.Console.dll │ ├── net452 │ └── Colorful.Console.dll │ ├── net46 │ └── Colorful.Console.dll │ ├── net461 │ └── Colorful.Console.dll │ └── netstandard2.0 │ └── Colorful.Console.dll ├── ISSUE_TEMPLATE.md ├── CHANGELOG.md ├── LICENSE ├── killswitch-windows.sln ├── README.md └── CONTRIBUTING.md /killswitch-windows.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows.exe -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/killswitch-windows.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | e87c427e5c72318e243ef19ec0b15e8117b4c62f 2 | -------------------------------------------------------------------------------- /killswitch-windows/SelectQuery.cs: -------------------------------------------------------------------------------- 1 | namespace killswitch_windows 2 | { 3 | internal class SelectQuery 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /killswitch-windows/ManagementObject.cs: -------------------------------------------------------------------------------- 1 | namespace killswitch_windows 2 | { 3 | internal class ManagementObject 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /killswitch-windows/bin/Debug/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/bin/Debug/Colorful.Console.dll -------------------------------------------------------------------------------- /killswitch-windows/ManagementObjectSearcher.cs: -------------------------------------------------------------------------------- 1 | namespace killswitch_windows 2 | { 3 | internal class ManagementObjectSearcher 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /killswitch-windows/bin/Debug/killswitch-windows.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/bin/Debug/killswitch-windows.exe -------------------------------------------------------------------------------- /killswitch-windows/bin/Debug/killswitch-windows.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/bin/Debug/killswitch-windows.pdb -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/killswitch-windows.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/obj/Debug/killswitch-windows.exe -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/killswitch-windows.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/obj/Debug/killswitch-windows.pdb -------------------------------------------------------------------------------- /killswitch-windows/killswitch-windows_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/killswitch-windows_TemporaryKey.pfx -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/Colorful.Console.1.2.9.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/Colorful.Console.1.2.9.nupkg -------------------------------------------------------------------------------- /killswitch-windows/bin/Debug/app.publish/killswitch-windows.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/bin/Debug/app.publish/killswitch-windows.exe -------------------------------------------------------------------------------- /killswitch-windows/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/lib/net40/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/lib/net40/Colorful.Console.dll -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/lib/net45/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/lib/net45/Colorful.Console.dll -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/lib/net451/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/lib/net451/Colorful.Console.dll -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/lib/net452/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/lib/net452/Colorful.Console.dll -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/lib/net46/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/lib/net46/Colorful.Console.dll -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/lib/net461/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/lib/net461/Colorful.Console.dll -------------------------------------------------------------------------------- /packages/Colorful.Console.1.2.9/lib/netstandard2.0/Colorful.Console.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/packages/Colorful.Console.1.2.9/lib/netstandard2.0/Colorful.Console.dll -------------------------------------------------------------------------------- /killswitch-windows/System/ServiceProcess.cs: -------------------------------------------------------------------------------- 1 | namespace System 2 | { 3 | internal class ServiceProcess 4 | { 5 | internal class ServiceController 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/killswitch-windows.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/t0nic/killswitch-windows/HEAD/killswitch-windows/obj/Debug/killswitch-windows.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /killswitch-windows/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /killswitch-windows/bin/Debug/killswitch-windows.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Installed product versions 2 | - Visual Studio: [example 2015 Professional] 3 | - This extension: [example 1.1.21] 4 | 5 | ### Description 6 | Replace this text with a short description 7 | 8 | ### Steps to recreate 9 | 1. Replace this 10 | 2. text with 11 | 3. the steps 12 | 4. to recreate 13 | 14 | ### Current behavior 15 | Explain what it's doing and why it's wrong 16 | 17 | ### Expected behavior 18 | Explain what it should be doing after it's fixed. -------------------------------------------------------------------------------- /killswitch-windows/killswitch-windows.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | en-US 11 | false 12 | 13 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Road map 2 | 3 | - [x] A feature that has been completed 4 | - [ ] A feature that has NOT yet been completed 5 | 6 | Features that have a checkmark are complete and available for 7 | download in the 8 | [release page](https://github.com/t0nic/killswitch-windows/releases). 9 | 10 | # Change log 11 | 12 | wew lad im gonna make this better i promise 13 | 14 | ## 1.0 15 | 16 | - [x] Initial release 17 | - [x] Listen for vpn disconnection 18 | - [x] Disable outgoing/incoming internet traffic 19 | - [x] re-enable internet upon start of program 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 {Author} 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /killswitch-windows.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2026 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "killswitch-windows", "killswitch-windows\killswitch-windows.csproj", "{38F69DDA-A279-4DF8-BB81-43FE621F7B71}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {38F69DDA-A279-4DF8-BB81-43FE621F7B71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {38F69DDA-A279-4DF8-BB81-43FE621F7B71}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {38F69DDA-A279-4DF8-BB81-43FE621F7B71}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {38F69DDA-A279-4DF8-BB81-43FE621F7B71}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {949E0FFF-451C-4E8A-8A76-5D6067352DE5} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/killswitch-windows.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\bin\Debug\killswitch-windows.exe.config 2 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\bin\Debug\killswitch-windows.exe 3 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\bin\Debug\killswitch-windows.pdb 4 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\bin\Debug\Colorful.Console.dll 5 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\obj\Debug\killswitch-windows.csprojAssemblyReference.cache 6 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\obj\Debug\killswitch-windows.csproj.CoreCompileInputs.cache 7 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\obj\Debug\killswitch-windows.csproj.CopyComplete 8 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\obj\Debug\killswitch-windows.exe 9 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\obj\Debug\killswitch-windows.pdb 10 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\bin\Debug\killswitch-windows.exe.manifest 11 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\bin\Debug\killswitch-windows.application 12 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\obj\Debug\killswitch-windows.exe.manifest 13 | C:\Users\zer0\source\repos\killswitch-windows\killswitch-windows\obj\Debug\killswitch-windows.application 14 | -------------------------------------------------------------------------------- /killswitch-windows/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("killswitch-windows")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("killswitch-windows")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("38f69dda-a279-4df8-bb81-43fe621f7b71")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /killswitch-windows/bin/Debug/killswitch-windows.application: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | /QbPK0ga2zZOUQ7wYYskEnbCSNCZLI0x+ypTDP2ADnU= 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/killswitch-windows.application: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | /QbPK0ga2zZOUQ7wYYskEnbCSNCZLI0x+ypTDP2ADnU= 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NOTICE! 2 | I have been meaning to work on this, but I do not have the time right now. I am going to post the source for [killswitch-core](https://github.com/t0nic/killswitch-core) which is a better version of this program written in .NET Core 3 | 4 | 5 | 6 | 7 | 8 | 9 | # KillSwitch 10 | 11 | [![Build status](https://ci.appveyor.com/api/projects/status/hv6uyc059rqbc6fj?svg=true)](https://ci.appveyor.com/project/madskristensen/extensibilitytools) 12 | 13 | Download The Precompiled binary [here](https://github.com/t0nic/killswitch-windows/releases) 14 | --------------------------------------- 15 | 16 | ![Loading image...](https://i.imgur.com/B29zayG.png) 17 | 18 | VPN Kill switch which used a listener to detect disconnections 19 | 20 | See the [change log](CHANGELOG.md) for changes and road map. 21 | 22 | ## How To Use 23 | 24 | - download the source and compile, or go to releases and download the precompiled binary 25 | - turn on your vpn 26 | - run KillSwitch 27 | - select the interface that your vpn runs on 28 | - if you are disconnected from the vpn 29 | - close all programs that could expose your (once you turn your internet traffic back on) 30 | - close KillSwitch 31 | - restart KillSwitch, and close it after you see that your internet has been enabled. 32 | - connect to your vpn again and run the program 33 | 34 | 35 | ## How it works 36 | Once your vpn is connect, and you have selected the proper interface, KillSwitch will begin listening for a change of connection on that interface, and once it does, it will quickly check if your vpn is down, and if it is, KillSwitch will use ipconfig to disable outgoing traffic to stop yourself from leaking your IP. 37 | 38 | ## Why? 39 | This is for the people who use a VPN that does not come with a premade kill switch. 40 | 41 | 42 | ## Coming Soon 43 | ### If you wanna help or wanna know what is going to be added in the coming releases, here is a list of things that need to be done. 44 | - create linux version 45 | - There is a bug with re-enabling the interface (quick fix by reoping and closing the program) 46 | - Give the option to close all programs with internet traffic besides the vpn 47 | - Auto detect interface 48 | - use multithreading 49 | 50 | ## Program screenshots 51 | ### Selecting the interface and running the scanner/listener 52 | ![Loading image....](https://i.imgur.com/yn8bq34.png) 53 | ### Dissconnecting from the vpn (we try to avoid this) 54 | ![Loading image....](https://i.imgur.com/usPChe2.png) 55 | ### Internet connection disabled 56 | ![Loading image....](https://i.imgur.com/ZyncrDJ.png) 57 | 58 | ## License 59 | 60 | -------------------------------------------------------------------------------- /killswitch-windows/bin/Debug/killswitch-windows.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 8x1P1+cp/Gz07KuXK2se6JeRijJbHKVyAwlm+DHnaPs= 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 4+3wTszO9KnlnJWSROwWh+Pr2Ou7BuDAcpFHv3RBOkY= 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | rl5/qDc7Jz+tB+BIbOv9iMGPlRe6YJwrjmU09dnlPcs= 75 | 76 | 77 | -------------------------------------------------------------------------------- /killswitch-windows/obj/Debug/killswitch-windows.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 8x1P1+cp/Gz07KuXK2se6JeRijJbHKVyAwlm+DHnaPs= 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 4+3wTszO9KnlnJWSROwWh+Pr2Ou7BuDAcpFHv3RBOkY= 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | rl5/qDc7Jz+tB+BIbOv9iMGPlRe6YJwrjmU09dnlPcs= 75 | 76 | 77 | -------------------------------------------------------------------------------- /killswitch-windows/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Drawing; 7 | using Console = Colorful.Console; 8 | using System.Net.NetworkInformation; 9 | using System.Diagnostics; 10 | 11 | namespace killswitch_windows 12 | { 13 | class Program 14 | { 15 | const string assLogo = 16 | @" 17 | __ .__.__ .__ .__ __ .__ 18 | | | _|__| | | | ________ _ _|__|/ |_ ____ | |__ 19 | | |/ / | | | | / ___/\ \/ \/ / \ __\/ ___\| | \ 20 | | <| | |_| |__\___ \ \ /| || | \ \___| Y \ 21 | |__|_ \__|____/____/____ > \/\_/ |__||__| \___ >___| / 22 | \/ \/ \/ \/ "; 23 | 24 | static private string vpnNIC; 25 | static private Int32 nicChoice; 26 | static private bool isKill; 27 | 28 | static void Main(string[] args) 29 | { 30 | 31 | Console.Write("==============================================================", Color.Blue); 32 | Console.WriteLine(""+assLogo, Color.Cyan); 33 | Console.Write("==============================================================", Color.Blue); 34 | 35 | Start(); 36 | } 37 | 38 | static void Start() 39 | { 40 | 41 | 42 | // enable internet connection (it could have been disabled before calling this function) 43 | ProcessStartInfo info = new ProcessStartInfo(); 44 | info.FileName = "ipconfig"; 45 | info.Arguments = "/renew"; // or /release if you want to disconnect 46 | info.WindowStyle = ProcessWindowStyle.Hidden; 47 | Process p = Process.Start(info); 48 | p.WaitForExit(); 49 | 50 | 51 | // get list of interfaces 52 | NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); 53 | 54 | 55 | // ask the user which interface the vpn runs on 56 | Console.WriteLine("\nSelect which network interface your vpn is running on."); 57 | //foreach (NetworkInterface n in adapters) 58 | foreach(var x in adapters.Select((value, index) => new { value, index })) 59 | { 60 | Console.WriteLine("\t{0} - {1}", x.index, x.value.Name); 61 | } 62 | Console.Write(">"); 63 | nicChoice = Convert.ToInt32(Console.ReadLine()); 64 | 65 | 66 | // store the interface id to a member value so we can compate when we detect a network change 67 | vpnNIC = adapters[nicChoice].Id; 68 | 69 | 70 | // start listening for a network change 71 | isKill = false; 72 | NetworkChange.NetworkAddressChanged += new 73 | NetworkAddressChangedEventHandler(AddressChangedCallback); 74 | Console.Write("\n[STARTED]", Color.Green); 75 | Console.Write(" killswitch is now listening for a change in your supplied interface."); 76 | 77 | // stop the program from terminating so we can keep the listener going 78 | Console.ReadLine(); 79 | 80 | 81 | } 82 | 83 | static void AddressChangedCallback(object sender, EventArgs e) 84 | { 85 | if (!isKill) 86 | { 87 | NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); 88 | Console.Beep(570, 100); 89 | Console.Beep(570, 100); 90 | Console.Beep(570, 100); 91 | Console.Beep(570, 100); 92 | Console.Write("\r\n[NETWORK CHANGE DETECTED]", Color.Red); 93 | Console.Write(" Checking if our vpn has been disabled.\n"); 94 | if (adapters[nicChoice].OperationalStatus == OperationalStatus.Down) 95 | { 96 | isKill = true; 97 | KillNow(); 98 | Console.Write("[INTERNET DISABLED]", Color.Red); 99 | Console.Write(" your vpn was dissconnected. (restart the kill switch and turn on your vpn before selecting the NIC)"); 100 | } 101 | 102 | } 103 | 104 | } 105 | 106 | public static void KillNow() 107 | { 108 | ProcessStartInfo info = new ProcessStartInfo(); 109 | info.FileName = "ipconfig"; 110 | info.Arguments = "/release"; 111 | info.WindowStyle = ProcessWindowStyle.Hidden; 112 | Process p = Process.Start(info); 113 | p.WaitForExit(); 114 | } 115 | 116 | 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /killswitch-windows/killswitch-windows.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {38F69DDA-A279-4DF8-BB81-43FE621F7B71} 8 | Exe 9 | killswitch_windows 10 | killswitch-windows 11 | v4.6.1 12 | 512 13 | true 14 | true 15 | false 16 | publish\ 17 | true 18 | Disk 19 | false 20 | Foreground 21 | 7 22 | Days 23 | false 24 | false 25 | true 26 | 0 27 | 1.0.0.%2a 28 | false 29 | true 30 | true 31 | 32 | 33 | AnyCPU 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | 51 | 52 | 33D48B50EF0802BAE21D4D849230CDA4AED24C75 53 | 54 | 55 | killswitch-windows_TemporaryKey.pfx 56 | 57 | 58 | true 59 | 60 | 61 | true 62 | 63 | 64 | 65 | ..\packages\Colorful.Console.1.2.9\lib\net461\Colorful.Console.dll 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | False 93 | Microsoft .NET Framework 4.6.1 %28x86 and x64%29 94 | true 95 | 96 | 97 | False 98 | .NET Framework 3.5 SP1 99 | false 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](http://visualstudiogallery.msdn.microsoft.com/a7f75c34-82b4-4357-9c66-c18e32b9393e). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | --------------------------------------------------------------------------------