Skip to content

Instantly share code, notes, and snippets.

@goop32
Created December 22, 2021 21:56
Show Gist options
  • Save goop32/0f09205ddf81efeb1e6d713b2c2667d8 to your computer and use it in GitHub Desktop.
Save goop32/0f09205ddf81efeb1e6d713b2c2667d8 to your computer and use it in GitHub Desktop.
mjolkdir, a super simple directory scanning utility
#!/usr/bin/env python3
import requests, argparse
# get and parse arguments w/ argparse
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--url", help = "specify URL to scan")
parser.add_argument("-w", "--wordlist", help = "specify wordlist for use in scanner")
parser.add_argument("-v", "--verbose", help = "use 1 to enable verbose mode, which is basically just throwing you all status codes")
args = parser.parse_args()
# define our URL and wordlist path
url = args.url
wordlist = open(args.wordlist, 'r')
verbose = False
if args.verbose:
verbose = True
# try each directory until something is found
for line in wordlist:
path = line.strip()
requrl = (url + path)
r = requests.get(requrl)
if r.status_code == 200:
print(str(r.status_code) + " " + requrl)
elif verbose is True:
print(str(r.status_code) + " " + requrl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment