コード例 #1
0
        protected void ProcessRequest(byte[] data, UDPListener udpListener, IPEndPoint ipEndPoint, string replyIP)
        {
            string          clientIP = ipEndPoint.Address.ToString();
            NetBIOSNSPacket packet   = new NetBIOSNSPacket(data);

            if (packet.Header.IsQuery())
            {
                if (Check(packet.Question.Name, packet.Question.Type, clientIP, out string message))
                {
                    byte[] buffer = packet.GetBytes(this.TTL, replyIP);
                    SendTo(buffer, udpListener, ipEndPoint);
                }

                Output("NBNS", clientIP, packet.Question.Name, packet.Question.Type, message);
            }
        }
コード例 #2
0
        internal static void ProcessNBNSRequest(byte[] data, string clientIP, int clientPort, string sourceIP, int sourcePort)
        {
            NetBIOSNSPacket packet   = new NetBIOSNSPacket(data);
            NBNSListener    listener = new NBNSListener();

            if (packet.Header.IsQuery())
            {
                if (listener.Check(packet.Question.Name, packet.Question.Type, clientIP, out string message))
                {
                    byte[] buffer = packet.GetBytes(UInt32.Parse(Program.argNBNSTTL), Program.argSpooferIP);

                    if (!Utilities.ArrayIsNullOrEmpty(buffer))
                    {
                        UDPSocket.SendTo(clientIP, clientPort, sourceIP, sourcePort, buffer, false);
                    }
                }

                Output.SpooferOutput("NBNS", packet.Question.Type, packet.Question.Name, clientIP, message);
            }
        }