Skip to content

Instantly share code, notes, and snippets.

@YasserGersy
Created July 9, 2018 23:35
Show Gist options
  • Save YasserGersy/4b750c424726524e2f3146cadeb941ce to your computer and use it in GitHub Desktop.
Save YasserGersy/4b750c424726524e2f3146cadeb941ce to your computer and use it in GitHub Desktop.
Find directory listing in websites using wfuzz
import sys,os,requests
print """
____________________________________________________
Dir listing finder
usage python dirlister.py domains_path list_path
requirements wfuzz , python-requests
_____________________________________________________
"""
lst_path='/big.txt'
domains_path='/sites.txt'
def test(d):
#0 offline , 1 HTTP , 2 HTTPS
res=0
try:
url='http://'+d.strip()
requests.get(url)
res=1
except Exception,ex1:
res=0
print str(ex1)
try:
url='https://'+d.strip()
requests.get(url)
res=2
except:
res=res
return res
domains_path=sys.argv[1]
lst_path =sys.argv[2]
try:
domains=open(domains_path,'r').readlines()
domains=list(set(domains))
except:
domains=[domains_path]
print 'Found domains = ' +str(len(domains))
for dom in domains:
dom=dom.strip()
statue=test(dom)
if statue==0:
continue
proto='http'+('s' if statue==2 else '')+'://'
cmd='wfuzz -c -z file,'+lst_path+' --sc 200 --hc 300,301,302,303,304,305,306,307,308,400,401,404,405,500,501,504,505,409,429,403 '+proto+dom+'/FUZZ/'
print '--------------------------------------------------------\n'+cmd+'\n---------\n'
os.system(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment