Beispiel #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();
        }
Beispiel #2
0
 public void Run(WinPcapDevice device)
 {
     comm = device;
     device.Open(OpenFlags.Promiscuous, 1, null);
     comm.Filter = ("arp");
     comm.NonBlockingMode = true;
     lDev.Text = device.Description;
 }
Beispiel #3
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";
        }
Beispiel #4
0
        private TcpSynPortScanner(string hostName)
        {
            timeout = 5000;

            localIp = NetworkUtils.GetLocalHostIP();
            localPort = (ushort)new Random().Next(20000, 50000);

            device = NetworkUtils.GetActiveDevice(localIp);

            localMacAddress = device.Interface.MacAddress;

            destinationIp = NetworkUtils.ResolveHostName(hostName);
            var tryCount = 8;
            while (--tryCount > 0)
            {

                destinationMacAddress = NetworkUtils.GetMacAddress(destinationIp);
                if (!Equals(destinationMacAddress, new PhysicalAddress(new byte[] { 0, 0, 0, 0, 0, 0 })))
                    break;
                Thread.Sleep(500 / tryCount);
            }

            if (destinationMacAddress == null)
                throw new Exception("Destination MAC can't be null");

            device.Open(DeviceMode.Promiscuous, 100);
            ConfigureWinPcapDevice();

        }