Skip to content

Instantly share code, notes, and snippets.

@tombasche
Last active April 11, 2017 09:54
Show Gist options
  • Save tombasche/182f76ce16c919190b4242a1deb1690f to your computer and use it in GitHub Desktop.
Save tombasche/182f76ce16c919190b4242a1deb1690f to your computer and use it in GitHub Desktop.
Fuzzer to find folders and common files on websites
import requests
import os, sys
url = sys.argv[1]
dicts_dir = sys.argv[2]
result_dir = sys.argv[3]
def import_dict(dir, filepath):
file = open(os.path.join(dir,filepath), 'r')
return [item for item in file]
def find_files(root_dir):
root_list = []
for filename in os.listdir(root_dir):
if filename.endswith(".wordlist"):
root_list += import_dict(root_dir, filename)
return root_list
def write_result(line):
file = open(os.path.join(result_dir,'result.txt'), 'w')
file.write(line + "\n")
file.close()
for entry in find_files(dicts_dir):
r = requests.get(url + '/' + entry)
# we can safely assume most will not be 200
if r.status_code != '200':
print url + '/' + entry + ' = ERROR'
else:
print url + '/' + entry + ' = OK'
write_result(result_dir, url + '/' + entry)
# usage: python fuzzer.py http://www.example.com /dir/where/wordlists/are /dir/where/output/goes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment