示例#1
0
        public override string Increment(string Value)
        {
            var val = MACAddress.Parse(Value);

            val.Increment();
            return(val.ToString());
        }
示例#2
0
        /// <summary>
        /// Converts an array of name value items to an array of MAC addresses
        /// </summary>
        /// <param name="strString">The name value item which should be converted</param>
        /// <returns>An array of MAC addresses</returns>
        public static MACAddress[] ConvertToMACAddress(NameValueItem[] strString)
        {
            MACAddress[] mac = new MACAddress[strString.Length];

            for (int iC1 = 0; iC1 < strString.Length; iC1++)
            {
                mac[iC1] = MACAddress.Parse(strString[iC1].Value);
            }

            return(mac);
        }
 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");
 }
示例#4
0
        protected override void Scan(IPAddress ipaDestination)
        {
            ARPFrame arpFrame = new ARPFrame();

            arpFrame.DestinationIP       = ipaDestination;
            arpFrame.SourceIP            = SourceAddress;
            arpFrame.DestinationMAC      = MACAddress.Parse("ff:ff:ff:ff:ff:ff");
            arpFrame.SourceMAC           = macLocal;
            arpFrame.ProtocolAddressType = EtherType.IPv4;
            arpFrame.HardwareAddressType = HardwareAddressType.Ethernet;
            arpFrame.Operation           = ARPOperation.Request;

            OutputHandler.PushTraffic(arpFrame);
        }
        private void Poison()
        {
            EthernetFrame ethFrame;
            ARPFrame      arpFrame;

            lock (ipaToIsolate)
            {
                foreach (ARPHostEntry heToIsolate in ipaToIsolate)
                {
                    lock (ipaToSpoof)
                    {
                        foreach (ARPHostEntry heToSpoof in ipaToSpoof)
                        {
                            if (heToIsolate != heToSpoof)
                            {
                                ethFrame = new EthernetFrame();
                                ethFrame.CanocialFormatIndicator = false;
                                ethFrame.Destination             = heToIsolate.MAC;
                                ethFrame.Source        = macAddressRedirectTo;
                                ethFrame.VlanTagExists = false;
                                ethFrame.EtherType     = EtherType.ARP;

                                arpFrame = new ARPFrame();
                                arpFrame.DestinationIP       = heToIsolate.IP;
                                arpFrame.DestinationMAC      = MACAddress.Parse("00:00:00:00:00:00");
                                arpFrame.SourceIP            = heToSpoof.IP;
                                arpFrame.SourceMAC           = macAddressRedirectTo;
                                arpFrame.ProtocolAddressType = EtherType.IPv4;
                                arpFrame.HardwareAddressType = HardwareAddressType.Ethernet;
                                arpFrame.Operation           = ARPOperation.Request;

                                ethFrame.EncapsulatedFrame = arpFrame;

                                wpc.SendPacket(ethFrame.FrameBytes);
                            }
                        }
                    }
                }
            }
        }
        public LiteX_Ethernet(Machine machine, int numberOfWriteSlots = 2, int numberOfReadSlots = 2) : base(machine)
        {
            Interlocked.Add(ref NumberOfInstances, 1);

            MAC = MACAddress.Parse("10:e2:d5:00:00:00").Next(NumberOfInstances - 1);

            writeSlots = new Slot[numberOfWriteSlots];
            readSlots  = new Slot[numberOfReadSlots];
            for (var i = 0; i < numberOfWriteSlots; i++)
            {
                writeSlots[i] = new Slot();
            }
            for (var i = 0; i < numberOfReadSlots; i++)
            {
                readSlots[i] = new Slot();
            }

            bbHelper = new BitBangHelper(width: 16, loggingParent: this);

            RegistersCollection = new DoubleWordRegisterCollection(this);
            DefineRegisters();
        }
示例#7
0
        public override string Convert(string Value)
        {
            var val = MACAddress.Parse(Value);

            return(val.Address.ToString());
        }
示例#8
0
        private void Poison()
        {
            EthernetFrame ethFrame;
            ARPFrame      arpFrame;

            lock (lVictims)
            {
                foreach (EthernetInterface ipi in lInterfaces)
                {
                    foreach (MITMAttackEntry aprVictim in lVictims)
                    {
                        if (!ipi.ARPTable.Contains(aprVictim.VictimBob) || !ipi.ARPTable.Contains(aprVictim.VictimAlice))
                        {
                            continue;
                        }

                        //Poisoning Victim 1

                        ethFrame = new EthernetFrame();
                        ethFrame.CanocialFormatIndicator = false;
                        ethFrame.Destination             = ipi.ARPTable.GetEntry(aprVictim.VictimBob).MAC;
                        ethFrame.Source        = ipi.PrimaryMACAddress;
                        ethFrame.VlanTagExists = false;
                        ethFrame.EtherType     = EtherType.ARP;

                        arpFrame = new ARPFrame();
                        arpFrame.DestinationIP = aprVictim.VictimBob;

                        if (aprMethod == APRAttackMethod.UseRequestPackets)
                        {
                            arpFrame.DestinationMAC = MACAddress.Parse("00:00:00:00:00:00");
                        }
                        else
                        {
                            arpFrame.DestinationMAC = ipi.ARPTable.GetEntry(aprVictim.VictimBob).MAC;
                        }

                        arpFrame.SourceIP            = aprVictim.VictimAlice;
                        arpFrame.SourceMAC           = ipi.PrimaryMACAddress;
                        arpFrame.ProtocolAddressType = EtherType.IPv4;
                        arpFrame.HardwareAddressType = HardwareAddressType.Ethernet;

                        if (aprMethod == APRAttackMethod.UseRequestPackets)
                        {
                            arpFrame.Operation = ARPOperation.Request;
                        }
                        else
                        {
                            arpFrame.Operation = ARPOperation.Reply;
                        }

                        ethFrame.EncapsulatedFrame = arpFrame;

                        ipi.Send(ethFrame);

                        //Poisoning Victim 2

                        ethFrame = new EthernetFrame();
                        ethFrame.CanocialFormatIndicator = false;
                        ethFrame.Destination             = ipi.ARPTable.GetEntry(aprVictim.VictimAlice).MAC;
                        ethFrame.Source        = ipi.PrimaryMACAddress;
                        ethFrame.VlanTagExists = false;
                        ethFrame.EtherType     = EtherType.ARP;

                        arpFrame = new ARPFrame();
                        arpFrame.DestinationIP = aprVictim.VictimAlice;

                        if (aprMethod == APRAttackMethod.UseRequestPackets)
                        {
                            arpFrame.DestinationMAC = MACAddress.Parse("00:00:00:00:00:00");
                        }
                        else
                        {
                            arpFrame.DestinationMAC = ipi.ARPTable.GetEntry(aprVictim.VictimAlice).MAC;
                        }

                        arpFrame.SourceIP            = aprVictim.VictimBob;
                        arpFrame.SourceMAC           = ipi.PrimaryMACAddress;
                        arpFrame.ProtocolAddressType = EtherType.IPv4;
                        arpFrame.HardwareAddressType = HardwareAddressType.Ethernet;

                        if (aprMethod == APRAttackMethod.UseRequestPackets)
                        {
                            arpFrame.Operation = ARPOperation.Request;
                        }
                        else
                        {
                            arpFrame.Operation = ARPOperation.Reply;
                        }

                        ethFrame.EncapsulatedFrame = arpFrame;

                        ipi.Send(ethFrame);
                    }
                }
            }
            InvokePoisoned();
        }