纯小白版目录扫描工具

import requests

header = {
   'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
}

url = input('输入url(请确保URL无错):')

list = []
with open('dir.txt','r') as f:
    for i in f:
        list.append(i)      # 把字典里的数据 都存放在列表里

def run():
    for i in range(len(list)):      # 有多少行数据循环多少次
        data = list[i]
        res = url+data                  # 组合起来
        res = 'http://'+res.strip()      # 组合+去除空白符
        code = requests.get(res).status_code      # 检测状态码
        if code == 200:
            print('['+str(code)+']'+ '--->     ' + res)
        elif code == 403:
            print('['+str(code)+']'+ '--->     ' + res)
        elif code == 302 or code == 301:
            print('['+str(code)+']'+ '--->     ' + res)
        else:
            continue


def show():
   print("                        _  _                                ")
   print("                     __| |(_) _ __         ___    ___   __ _   _ __  ")
   print("                    / _` || || '__|       / __|  / __| / _` | | '_ \ ")
   print("                   | (_| || || |    ----- \__ \ | (__ | (_| | | | | |")
   print("                    \__,_||_||_|          |___/  \___| \__,_| |_| |_|")
   print("                                                            ")

if __name__ == '__main__':
    show()
    run()

可以自己放字典上去

别喷我 ~ 我没放字典

下载地址

https://muxue.lanzous.com/icyh96d

猜你喜欢

转载自www.cnblogs.com/muxueblog/p/12951585.html