public ARPHostIsolation(WinPcapDotNet wpc)
 {
     this.wpc             = wpc;
     ipaToSpoof           = new List <ARPHostEntry>();
     ipaToIsolate         = new List <ARPHostEntry>();
     iPoisonInterval      = 30000;
     tTimer               = new Timer();
     tTimer.Interval      = iPoisonInterval;
     tTimer.AutoReset     = true;
     tTimer.Elapsed      += new ElapsedEventHandler(tTimer_Elapsed);
     macAddressRedirectTo = MACAddress.Parse("CE:BA:B0:00:13:37");
 }
        /// <summary>
        /// Creates a new instance of this class, listening to the given interface
        /// </summary>
        /// <param name="wpcInterface">A WinPcapInterface which defines the interface to listen to</param>
        public EthernetInterface(WinPcapInterface wpcInterface)
        {
            if (InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.Ethernet3Megabit &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.FastEthernetFx &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.FastEthernetT &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet &&
                InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name) != System.Net.NetworkInformation.NetworkInterfaceType.Wireless80211)
            {
                throw new ArgumentException("Only enabled ethernet interfaces are supported at the moment.");
            }
            if (wpcInterface.Name == null)
            {
                throw new ArgumentException("Cannot create an interface instance for an interface not properly recognised by WinPcap.");
            }

            bPromiscousMode          = true;
            oInterfaceStartStopLock  = new object();
            AddressResolutionMethod  = AddressResolution.NDP;
            bExcludeOwnTraffic       = true;
            bExcludeLocalHostTraffic = true;
            arpHostTable             = new HostTable();
            lmacSpoofAdresses        = new List <MACAddress>();
            bRun             = false;
            bShutdownPending = false;

            qFrameQueue       = new Queue <byte[]>();
            bIsRunning        = false;
            areWorkToDo       = new AutoResetEvent(false);
            this.wpcInterface = wpcInterface;
            wpcDevice         = new WinPcapDotNet();

            this.maMacAddress = InterfaceConfiguration.GetMacAddressForInterface(wpcInterface.Name);
            this.aType        = InterfaceConfiguration.GetAdapterTypeForInterface(wpcInterface.Name);
            this.MTU          = InterfaceConfiguration.GetMtuForInterface(wpcInterface.Name) - 18; //Reserve 18 bytes for our ethernet-header

            IPAddress[]  arip   = InterfaceConfiguration.GetIPAddressesForInterface(wpcInterface.Name);
            Subnetmask[] smMask = InterfaceConfiguration.GetIPSubnetsForInterface(wpcInterface.Name);

            for (int iC1 = 0; iC1 < arip.Length && iC1 < smMask.Length; iC1++)
            {
                this.AddAddress(arip[iC1], smMask[iC1]);
            }

            ipStandardgateways.AddRange(InterfaceConfiguration.GetIPStandardGatewaysForInterface(wpcInterface.Name));
            this.strDNSName   = Dns.GetHostName();
            PrimaryMACAddress = this.MACAddress;
        }
 /// <summary>
 /// Returns all known network adapters
 /// </summary>
 /// <returns>All known WinPcap network adapters</returns>
 public static WinPcapInterface[] GetAllPcapInterfaces()
 {
     return(WinPcapDotNet.GetAllDevices().ToArray());
 }