예제 #1
0
파일: Router.cs 프로젝트: ztxyzu/EvilFOCA
        /// <summary>
        /// Indica si es necesario encapsular el contenido del paquete (ipv6) en Ipv4 para el ataque de mitm slaac
        /// http://www.elladodelmal.com/2012/04/man-in-middle-en-redes-ipv4-por-medio.html
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        private bool EncapsulateIpv6IntoIpv4(Packet p)
        {
            EthernetPacket pEthernet = (EthernetPacket)p;

            if (pEthernet.PayloadPacket is IPv6Packet)
            {
                IPv6Packet ipv6 = (IPv6Packet)pEthernet.PayloadPacket;

                for (int iA = 0; iA < Program.CurrentProject.data.GetAttacks().Count; iA++)
                {
                    if (Program.CurrentProject.data.GetAttacks()[iA].attackStatus == AttackStatus.Attacking &&
                        Program.CurrentProject.data.GetAttacks()[iA].attackType == AttackType.SlaacMitm)
                    {
                        if (pEthernet.DestinationHwAddress.Equals(Program.CurrentProject.data.GetDevice().MacAddress))
                        {
                            if (Program.CurrentProject.data.GetAttacks()[iA] is evilfoca.Data.MitmAttack)
                            {
                                evilfoca.Data.MitmAttack mitm = (evilfoca.Data.MitmAttack)Program.CurrentProject.data.GetAttacks()[iA];
                                if ((ipv6.SourceAddress.Equals(mitm.t1.ip)) && (ipv6.DestinationAddress.Equals(mitm.t2.ip)) ||
                                    (ipv6.DestinationAddress.Equals(mitm.t1.ip)) && (ipv6.SourceAddress.Equals(mitm.t2.ip)))
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }

            return(false);
        }
예제 #2
0
        private void btStartNeighborSpoof_Click(object sender, EventArgs e)
        {
            List<IPAddress> lstGateway = panelNeighborAdvSpoof.GetGatewayList();
            List<IPAddress> lstTargets = panelNeighborAdvSpoof.GetTargetsList();

            if (lstGateway.Count == 0)
                ShowMessage("You've to set a 'gateway'", 1000, FormMessage.IconType.Error);
            else if (lstTargets.Count == 0)
                ShowMessage("You've to set at least any target", 1000, FormMessage.IconType.Error);
            else
            {
                IPAddress gateway = (IPAddress)lstGateway[0];

                foreach (IPAddress target in lstTargets)
                {
                    PhysicalAddress macTarget = Program.CurrentProject.data.GetNeighborMAC(target);
                    PhysicalAddress macGateway = Program.CurrentProject.data.GetNeighborMAC(gateway);
                    if ((macTarget == null) || (macGateway == null))
                        return; // Se descarta el target. Algo raro pasa, ¿Como tener la IP sin la mac en la lista de vecinos?
                    MitmAttack attack = new Data.MitmAttack(new Target(gateway, macGateway), new Target(target, macTarget), AttackType.NeighborAdvertisementSpoofing);
                    Program.CurrentProject.data.AddAttack(attack);
                    attack.Start();

                    AddAttackToListViewEx(attack);

                    Program.LogThis("Performing a MITM (Neighbor spoofing) attack between " + attack.t1.ip.ToString() + " and " + attack.t2.ip.ToString(), Logs.Log.LogType.NeighborSpoofing);
                }

                panelNeighborAdvSpoof.ClearGateway();
                panelNeighborAdvSpoof.ClearTargets();
            }
        }
예제 #3
0
        private void btnWpadv6Attack_Click(object sender, EventArgs e)
        {
            List<IPAddress> lstTargets = wpadv6TargetPanel.GetTargetsList();
            foreach (IPAddress target in lstTargets)
            {
                PhysicalAddress macTarget = Program.CurrentProject.data.GetNeighborMAC(target);
                if (macTarget == null)
                    return; // Se descarta el target. Algo raro pasa, ¿Como tener la IP sin la mac en la lista de vecinos?

                MitmAttack attack = new Data.MitmAttack(new Target(Program.CurrentProject.data.GetIPv6LocalLinkFromDevice(Program.CurrentProject.data.GetDevice()), null), new Target(target, macTarget), AttackType.WpadIPv6);
                Program.CurrentProject.data.AddAttack(attack);
                attack.Start();

                AddAttackToListViewEx(attack);

                Program.LogThis("Performing a MITM (WPAD) attack " + attack.t2.ip.ToString(), Logs.Log.LogType.WpadIPv6);
            }
            wpadv6TargetPanel.ClearTargets();
        }
예제 #4
0
        private void btMitmSLAAC_Click(object sender, EventArgs e)
        {
            try
            {
                if (IPAddress.Parse(tbSlaacMitmPrefix.Text).GetAddressBytes().Length != 16)
                {
                    ShowMessage("Prefix must be an Ipv6 address", 1000, FormMessage.IconType.Error);
                    return;
                }
            }
            catch
            {
                ShowMessage("Invalid Prefix", 1000, FormMessage.IconType.Error);
                return;
            }
            List<IPAddress> lstTargets = panelTargetSLAACMitm.GetTargetsList();

            if (lstTargets.Count == 0)
                ShowMessage("You've to set at least any target", 1000, FormMessage.IconType.Error);
            else
            {
                foreach (IPAddress target in lstTargets)
                {
                    PhysicalAddress macTarget = Program.CurrentProject.data.GetNeighborMAC(target);

                    MitmAttack attack = new Data.MitmAttack(null, new Target(target, macTarget), AttackType.SlaacMitm) { prefix = (IPAddress.Parse(tbSlaacMitmPrefix.Text).GetAddressBytes()) };
                    Program.CurrentProject.data.AddAttack(attack);
                    attack.Start();

                    AddAttackToListViewEx(attack);

                    Program.LogThis(String.Format("Performing a MITM (SLAAC) attack between {0} and Attacker gateway ", attack.t2.ip.ToString()), Logs.Log.LogType.NeighborSpoofing);
                }

                panelTargetSLAACMitm.ClearTargets();
            }
        }