Skip to content

Instantly share code, notes, and snippets.

@ramuta
Last active February 1, 2020 11:58
Show Gist options
  • Save ramuta/9857f9561446d887e6f293cb725e1ee1 to your computer and use it in GitHub Desktop.
Save ramuta/9857f9561446d887e6f293cb725e1ee1 to your computer and use it in GitHub Desktop.
reqscanner.py
# Simple directory scanner written in Python (needs requests library)
# Author: Matej Ramuta
# Usage: python reqscanner.py domain.com wordlist.txt
# domain.com must not end with a slash!
import requests
import sys
domain = str(sys.argv[1]).replace("http://", "").replace("https://", "")
wordfile = sys.argv[2]
with open("{}".format(wordfile), "r") as wordlist:
for word in wordlist:
result = requests.get("http://{domain}/{word}".format(domain=domain, word=word))
if result.status_code == 200:
print "200 http://{domain}/{word}".format(domain=domain, word=word)
# Simple directory scanner written in Python (v2)
# Author: Matej Ramuta
# Usage: python reqscanner.py https://domain.com wordlist.txt
# domain.com must not end with a slash!
import sys
import os
domain = str(sys.argv[1])
wordfile = sys.argv[2]
with open("{}".format(wordfile), "r") as wordlist:
for word in wordlist:
result = os.popen("curl --silent -I {domain}/{word}".format(domain=domain, word=word)).read()
if "200" in result:
print("----------------------")
print("{domain}/{word}".format(domain=domain, word=word))
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment