用Python實(shí)現(xiàn)批量掃描域名是否存在指定文件
初學(xué)Python練手項(xiàng)目,直接上代碼,后續(xù)技術(shù)進(jìn)步了可以加上指定字典掃描,現(xiàn)在還不會(huì)^_^
加上并發(fā)的話掃描速度會(huì)更快,現(xiàn)在也不會(huì)~
1 import requests 2 3 with open('domains.txt','r') as file: 4 domains =[line.strip() for line in file] 5 for domain in domains: 6 try: 7 response = requests.get(f'http://{domain}/admin') 8 if response.status_code == 200: 9 with open('res.txt','a') as file: 10 file.write(f'http://{domain}/admin\n') 11 except: 12 print(f'域名{domain}無法訪問') 13
運(yùn)行結(jié)果


浙公網(wǎng)安備 33010602011771號(hào)