Exemple #1
1
        // start listening on a device (combobox index)
        public void StartDevice(int deviceIndex)
        {
            Started = true;

            DeviceInfo = DeviceInfoList[deviceIndex];
            Device = WinPcapDeviceList.Instance[deviceIndex];

            Sniffer = new Sniffer(DeviceInfo);
            ARPTools = new ARPTools(DeviceInfo);
            NDTools = new NDTools(DeviceInfo);
            SSLStrip = new SSLStrip();
            Scanner = new Scanner(DeviceInfo);

            Sniffer.SnifferResult += new SnifferResultHandler(sniffer_OnSnifferResult);
            Scanner.ScannerResponse += new ScannerResponseReceived(scanner_OnResponse);
            Scanner.ScanComplete += new ScannerEventHandler(scanner_OnScanComplete);
            Scanner.HostnameResolved += new ScannerHostnameResolvedHandler(scanner_HostnameResolved);
            SSLStrip.SSLStripped += new SSLStripHandler(SSLStrip_OnSSLStripped);

            // open device, set filters & events, start capturing
            Device.Open(DeviceMode.Promiscuous, 1);
            Device.Filter = "(arp || ip || ip6)";

            Device.OnPacketArrival += new PacketArrivalEventHandler(device_OnPacketArrival);
            Device.StartCapture();
        }
Exemple #2
0
        private void cbDevices_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_selectedDevice != null)
            {
                _selectedDevice.OnPacketArrival -= SelectedDevice_OnPacketArrival;
                _selectedDevice.StopCapture();
                _selectedDevice.Close();
            }

            _selectedDevice = ((DeviceWrapper)cbDevices.SelectedItem).Device;
            _selectedDevice.OnPacketArrival += SelectedDevice_OnPacketArrival;

            _selectedDevice.Open(DeviceMode.Normal);
            _selectedDevice.Filter = "net not 10.0.0.0/8 and net not 172.16.0.0/12 and net not 192.168.0.0/24";
            _selectedDevice.StartCapture();

            _packetCount = 0;
            lblTrackingCount.Text = "0";
        }