Skip to content

Instantly share code, notes, and snippets.

@joenorton8014
Last active March 27, 2018 00:54
Show Gist options
  • Save joenorton8014/e581cc23a0e0e1bd992340cb36b78eb9 to your computer and use it in GitHub Desktop.
Save joenorton8014/e581cc23a0e0e1bd992340cb36b78eb9 to your computer and use it in GitHub Desktop.
import requests
import os
from progressbar import ProgressBar
pbar = ProgressBar()
baseurl = 'http://10.0.0.55/'
folder_list = '/usr/share/wordlists/dirb/small.txt'
f = open(folder_list,'rb')
print "Starting bruteforcing..."
print "\n"
print "Using wordlist " + folder_list
print "\n"
get_count = os.popen('wc -l ' + folder_list + '| cut -d " " -f 1')
word_count = get_count.read().splitlines()[0]
print "File contains " + word_count + " items to bruteforce"
print "\n"
success_list = []
for folder in pbar(f.read().splitlines()):
url_requested = baseurl + str(folder)
try:
r = requests.get(url_requested)
if 200 <= r.status_code <= 299:
print 'Found a folder!: ' + url_requested + '- ' + str(r.status_code) + '\n'
success_list.append(url_requested + '- ' + str(r.status_code))
elif 300 <= r.status_code <= 399:
print 'Got a 300 code, probably a folder here: '+ url_requested + '- ' + str(r.status_code) + '\n'
success_list.append(url_requested + '- ' + str(r.status_code))
elif 500 <= r.status_code <= 599:
print 'Got a 500 code, maybe you broke something?: '+ url_requested + '- ' + str(r.status_code) + '\n'
success_list.append(url_requested + '- ' + str(r.status_code))
else:
pass
except:
pass
if len(success_list) == 0:
print "no folders found"
else:
print "\n"
print "Results: "
for folder_found in success_list:
print folder_found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment