Exemplo n.º 1
0
 /// <summary>
 /// Disconnects clients selected in the listview
 /// </summary>
 public void DisconnectSelectedClients()
 {
     if (_view.ListView1.SelectedItems.Count > 0)
     {
         Dictionary <IPAddress, PhysicalAddress> targetlist = new Dictionary <IPAddress, PhysicalAddress>();
         int parseindex = 0;
         foreach (ListViewItem listitem in _view.ListView1.SelectedItems)
         {
             targetlist.Add(IPAddress.Parse(listitem.SubItems[1].Text), PhysicalAddress.Parse(listitem.SubItems[2].Text.Replace(":", "-")));
             _view.MainForm.BeginInvoke(new Action(() =>
             {
                 _view.ListView1.SelectedItems[parseindex++].SubItems[3].Text = "Desactivado";
                 _view.ToolStripStatus.Text = "Has quitado la conexión";
             }));
         }
         DisconnectReconnect.Disconnect(_view, targetlist, GetGatewayIP(_view.ToolStripComboBoxDeviceList.Text), GetGatewayMAC(_view.ToolStripComboBoxDeviceList.Text), _view.ToolStripComboBoxDeviceList.Text);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Disconnects clients selected in the listview
        /// </summary>
        public void DisconnectSelectedClients()//Not used
        {
            try
            {
                if (_view.ListView1.SelectedObjects.Count > 0)
                {
                    Dictionary <IPAddress, PhysicalAddress> targetlist = new Dictionary <IPAddress, PhysicalAddress>();
                    foreach (Device listitem in _view.ListView1.SelectedObjects)
                    {
                        targetlist.Add(listitem.IP,
                                       listitem.MAC);
                        listitem.DeviceStatus = "Offline";
                        _view.ListView1.UpdateObject(listitem);
                        _view.MainForm.BeginInvoke(new Action(() =>
                        {
                            _view.StatusLabel.Text = "Spoofing active";
                        }));
                    }

                    DisconnectReconnect.Disconnect(_view.ListView1, targetlist,
                                                   GetGatewayIP(NetStalker.Properties.Settings.Default.friendlyname),
                                                   GetGatewayMAC(NetStalker.Properties.Settings.Default.friendlyname),
                                                   NetStalker.Properties.Settings.Default.friendlyname);

                    _view.PictureBox.BeginInvoke(new Action(() =>
                    {
                        _view.PictureBox.Image = NetStalker.Properties.Resources.image__4_25;
                    }));
                }
            }
            catch (GatewayTargeted)
            {
                MetroMessageBox.Show(_view.MainForm, "This operation can not target the gateway!", "Warning",
                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (LocalHostTargeted)
            {
                MetroMessageBox.Show(_view.MainForm, "This operation can not target your own ip address!", "Warning",
                                     MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }