Kevin-Robertson / Inveigh

.NET IPv4/IPv6 machine-in-the-middle tool for penetration testers
BSD 3-Clause "New" or "Revised" License
2.44k stars 433 forks source link

NullReference Exception if IPv6 is disabled #38

Open VbScrub opened 2 years ago

VbScrub commented 2 years ago

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Inveigh.Arguments.ParseArguments() at Inveigh.Program.Main(String[] arguments)

The error comes from line 295 in the Arguments.cs file because it is trying to insert into a null string:

Program.argMAC = Program.argMAC.Insert(2, ":").Insert(5, ":").Insert(8, ":").Insert(11, ":").Insert(14, ":");

The only solution was to enable IPv6 on my network adapter. Even if I use -IPv6 N I still get the error.

Kevin-Robertson commented 2 years ago

Thanks, this will be fixed soon. You can also get around it by feeding it a MAC with -MAC. Basically, it only needs the MAC for DHCPv6 spoofing so it's not needed when IPv6 is disabled. I should have included -MAC in the list of paramters that are not required when IPv6 is disabled.

T35R6braPwgDJKq commented 2 years ago

thanks - just wrapped the block with if(enabledDHCPv6) - worked

            if (Program.enabledDHCPv6)
            {
                if (string.IsNullOrEmpty(Program.argMAC))
                {

                    if (string.IsNullOrEmpty(Program.argSnifferIPv6))
                    {
                        Program.argMAC = GetLocalMACAddress(GetLocalIPAddress("IPv6"));
                    }
                    else
                    {
                        Program.argMAC = GetLocalMACAddress(Program.argSnifferIPv6);
                    }

                }

                Program.argMAC = Program.argMAC.Insert(2, ":").Insert(5, ":").Insert(8, ":").Insert(11, ":").Insert(14, ":");
            }
Kevin-Robertson commented 2 years ago

Thanks! That bug should be fixed in the dev branch version also.