def main(): print(colorama.Fore.GREEN + banner) if platform.system == "windows": from third.colorama import win32 parser = argparse.ArgumentParser() flag_parser = parser.add_mutually_exclusive_group(required=False) flag_parser.add_argument('-I', dest='show', action='store_true', help="CURL -I mode") parser.add_argument('-t', dest='thread_num', type=int, help="thread options", default=10) parser.add_argument('-u', dest='urls', type=str, help="url options") parser.add_argument('-w', dest='wordlists', type=str, help="wordlists options") parser.add_argument('-X', dest='method', type=str, help="http-method options", choices=['get', 'post'], default='get') parser.add_argument('-d', dest='data', type=str, help="post data") args = parser.parse_args() if args.show and args.urls: resp = requests.get(args.urls) print(resp.status_code) print(resp.headers) sys.exit(1) elif args.urls and args.wordlists and args.data != None: if "FUZZ" in args.data: brute = Brute(args) brute.to_do() sys.exit(1) else: print("u need FUZZ word =。= ") sys.exit(1) elif args.urls and args.wordlists: dirscan = DirScan(args) dirscan.start() sys.exit(1) else: txt = ''' -w Please enter the WORDLIST file address -t Please enter the THREAD number -u Please enter the URL number -I CURL -I mode -d Post data FUZZ need "FUZZ" word in data , data usage:"username=admin&password=FUZZ" -X http-method support Post and Get (default) ''' print(txt) sys.exit(1)
def run(self): gc.collect() while not self._queue.empty(): urls = self._queue.get() resp = requests.get(urls, headers=headers) try: if resp.status_code == 200: sys.stdout.write( '\r' + colorama.Fore.GREEN + '[+]\t200\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) elif resp.status_code == 403: sys.stdout.write( '\r' + colorama.Fore.CYAN + '[!]\t403\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) elif resp.status_code == 302: sys.stdout.write( '\r' + colorama.Fore.BLUE + '[+]\t302\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) elif resp.status_code == 301: sys.stdout.write( '\r' + colorama.Fore.BLUE + '[+]\t301\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) elif resp.status_code == 405: sys.stdout.write( '\r' + colorama.Fore.CYAN + '[!]\t405\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) elif resp.status_code == 400: sys.stdout.write( '\r' + colorama.Fore.CYAN + '[-]\t400\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) elif resp.status_code == 500: sys.stdout.write( '\r' + colorama.Fore.RED + '[-]\t500\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) elif resp.status_code == 404: sys.stdout.write( '\r' + colorama.Fore.RED + '[-]\t404\t{}\t\t{}\n'.format( resp.headers['content-length'], urls)) except EOFError as e: sys.exit(1)
def fuzz(self): # global IS_EXIT gc.collect() while not self.queue.empty(): if self.method.strip() == "post": urls = self.queue.get() resp = requests.post(urls, headers=headers, verify=False) elif self.method.strip() == "get": urls = self.queue.get() resp = requests.get(urls, headers=headers, verify=False) try: if resp.status_code == 200: if self.filter == None or 200 not in self.filter: sys.stdout.write('\r' + colorama.Fore.GREEN + '[+]\t200\t\t\t{}\n'.format(urls)) elif resp.status_code == 403: if self.filter == None or 403 not in self.filter: sys.stdout.write('\r' + colorama.Fore.CYAN + '[!]\t403\t\t\t{}\n'.format(urls)) elif resp.status_code == 302: if self.filter == None or 302 not in self.filter: sys.stdout.write('\r' + colorama.Fore.BLUE + '[+]\t302\t\t\t{}\n'.format(urls)) elif resp.status_code == 301: if self.filter == None or 301 not in self.filter: sys.stdout.write('\r' + colorama.Fore.BLUE + '[+]\t301\t\t\t{}\n'.format(urls)) elif resp.status_code == 405: if self.filter == None or 405 not in self.filter: sys.stdout.write('\r' + colorama.Fore.CYAN + '[!]\t405\t\t\t{}\n'.format(urls)) elif resp.status_code == 400: if self.filter == None or 400 not in self.filter: sys.stdout.write('\r' + colorama.Fore.CYAN + '[-]\t400\t\t\t{}\n'.format(urls)) elif resp.status_code == 500: if self.filter == None or 500 not in self.filter: sys.stdout.write('\r' + colorama.Fore.RED + '[-]\t500\t\t\t{}\n'.format(urls)) elif resp.status_code == 404: if self.filter == None or 404 not in self.filter: sys.stdout.write('\r' + colorama.Fore.RED + '[-]\t404\t\t\t{}\n'.format(urls)) except Exception as e: print("error") sys.exit(1)
def main(): print(colorama.Fore.GREEN + banner) if sys.version_info < (3, 0): sys.stdout.write('nfuzz requires Python 3.x') if platform.system == "windows": from third.colorama import win32 parser = argparse.ArgumentParser() flag_parser = parser.add_mutually_exclusive_group(required=False) flag_parser.add_argument('-I', dest='CURL_I', action='store_true', help="CURL -I mode") flag_parser.add_argument('-C', dest='CURL', action='store_true', help="CURL mode") parser.add_argument('-t', dest='thread_num', type=int, help="thread options", default=10) parser.add_argument('-u', dest='urls', type=str, help="url options") parser.add_argument('-w', dest='wordlists', type=str, help="wordlists options") parser.add_argument('-X', dest='method', type=str, help="http-method options", choices=['get', 'post'], default='get') parser.add_argument('-d', dest='data', type=str, help="post data") parser.add_argument('--hc', dest='filter', type=int, help="http status code filter", nargs='*') args = parser.parse_args() if args.CURL_I and args.urls: if args.method.strip() == "get": resp = requests.get(args.urls, verify=False) print(resp.status_code) print(resp.headers) sys.exit(1) elif args.method.strip() == "post": resp = requests.post(args.urls, verify=False) print(resp.status_code) print(resp.headers) sys.exit(1) elif args.CURL and args.urls: if args.method.strip() == "get": resp = requests.get(args.urls, verify=False) print(resp.text) sys.exit(1) elif args.method.strip() == "post": resp = requests.post(args.urls, verify=False) print(resp.text) sys.exit(1) elif args.urls and args.wordlists and args.data != None: if "FUZZ" in args.data: brute = Brute(args) brute.to_do() sys.exit(1) else: print(colorama.Fore.RED + "u need FUZZ word =。= ") sys.exit(1) elif args.urls and args.wordlists: if "FUZZ" in args.urls: brute = Brute(args) brute.to_do() sys.exit(1) else: print(colorama.Fore.RED + "u need FUZZ word =。= ") else: txt = ''' -w Please enter the WORDLIST file address -t Please enter the THREAD number -u Please enter the URL number , usage:"http://www.baidu.com/FUZZ/error.html" -I CURL -I mode -C CURL mode -d Post data , usage:"username=admin&password=FUZZ" -X http-method support Post and Get (default) --hc http_status_code filter , usage:"--hc 404 500" ''' print(txt) sys.exit(1)