def test_dir(url, depth, max_depth, dir_list):
if (depth > max_depth):
return
depth = depth +1
for d in dir_list:
new_url = url + "/" + d
try:
# make a SSL handler that ignores SSL CERT issues
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urllib2.urlopen(new_url, context=ctx)
if response and response.getcode() == 200:
print "[+] FOUND %s" % (new_url)
thread.start_new_thread(test_dir, (new_url, depth, max_depth, dir_list, ))
except urllib2.HTTPError, e:
if e.code == 401:
print "[!] Authorization Required %s " % (new_url)
elif e.code == 403:
print "[!] Forbidden %s " % (new_url)
elif e.code == 404:
print "[-] Not Found %s " % (new_url)
elif e.code == 503:
print "[!] Service Unavailable %s " % (new_url)
else:
print "[?] Unknwon"
评论列表
文章目录