private void ParseDatagramNBTNames(IPEndPoint from, byte[] data)
        {
            NetBIOSUdpHeader netBIOSHeader = NetBIOSUdpHeader.FromRequest(data);
            // TODO : Check name encoding and assert the ExtractString is inline
            // with it.
            string domain = NetBIOSHelpers.DecodeName(
                data.ExtractString(49, NetBIOSHelpers.NetbiosNameLength));
            string name = NetBIOSHelpers.DecodeName(
                data.ExtractString(15, NetBIOSHelpers.NetbiosNameLength));
            string role1 = NetBIOSHelpers.GetRoleById(
                data.ExtractData(45, NetBIOSHelpers.NetbiosRoleIdLength));
            string role2 = NetBIOSHelpers.GetRoleById(
                data.ExtractData(79, NetBIOSHelpers.NetbiosRoleIdLength));

            if (_analyze)
            {
                switch (role2)
                {
                case "Domain Controller":
                case "Browser Election":
                case "Local Master Browser":
                    Console.WriteLine(
                        "[Analyze mode: Browser] Datagram Request from IP: {0} hostname: {1} via the: {2} to: {3}. Service: {4}",
                        from, name, role1, domain, role2);
                    RAPThisDomain(from, domain);
                    break;

                default:
                    break;
                }
            }
        }
        private void BecomeBackup(IPEndPoint from, byte[] data)
        {
            try {
                int    dataOffset    = data.ToUInt16(Endianness.LittleEndian, 139);
                byte[] browserPacket = data.ExtractData(82 + dataOffset);
                string reqType       = DecodeRequestType(browserPacket[0]);

                if (reqType != "Become Backup Browser")
                {
                    return;
                }
                string serverName = Encoding.ASCII.GetString(browserPacket.ExtractData(1));
                string domain     = NetBIOSHelpers.DecodeName(
                    data.ExtractString(49, NetBIOSHelpers.NetbiosNameLength));
                string name = NetBIOSHelpers.DecodeName(
                    data.ExtractString(15, NetBIOSHelpers.NetbiosNameLength));
                string role = NetBIOSHelpers.GetRoleById(
                    data.ExtractData(45, NetBIOSHelpers.NetbiosRoleIdLength));
                if (_analyze)
                {
                    Console.WriteLine("[Analyze mode: Browser] Datagram Request from IP: {0} hostname: {1} via the: {2} wants to become a Local Master Browser Backup on this domain: {3}.",
                                      from, name, role, domain);
                    RAPThisDomain(from, domain);
                }
            }
            catch (Exception e) { return; }
        }