dirbuster.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Python4Pentesters 作者: tatanus 项目源码 文件源码
def test_dir(url, depth, max_depth, dir_list):
    if (depth > max_depth):
        return
    depth = depth +1

    found = list()
    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)
                found.append(new_url)
        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"

    # loop over each identified valid directory and recurse into it
    for new_url in found:
        test_dir(new_url, depth, max_depth, dir_list)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号