コード例 #1
0
ファイル: Form1.cs プロジェクト: computamike/NetworkAssasin
        /// <summary>
        /// On click issues an assasinate (or revival) attempt for identified adapters.
        /// </summary>
        private void button1_Click(object sender, EventArgs e)
        {
            var connected = _networkAdapters.Where(t => t.Status == NetworkState.Connected).ToList();

            if (!connected.Any())
            {
                toolStripLabel1.Text = "Unable to find any network adapters which are currently connected to a network.";
                return;
            }

            foreach (var item in connected) // Kill them with FIRE
            {
                foreach (var adapter in NetworkRepository.GetNetworkAdapters(item.Id))
                {
                    toolStripLabel1.Text = String.Format(_enabled ? "Disabling \"{0}\"" : "Enabling \"{0}\"", adapter.Name);
                    adapter.Toggle();
                    Thread.Sleep(500); // Sleep to give user a bit of time to read messages.
                }
            }

            toolStripLabel1.Text = _enabled ? "Networks assassinated." : "Networks revived.";
            _enabled             = !_enabled;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: computamike/NetworkAssasin
 /// <summary>
 /// When the form loads, issues a scan for adapters.
 /// </summary>
 private void Form1_Load(object sender, EventArgs e)
 {
     _networkAdapters.Clear();
     _networkAdapters     = NetworkRepository.GetNetworkAdapters().ToList();
     toolStripLabel1.Text = "Targets loaded...";
 }