Python--敏感目录扫描

Python--敏感目录扫描

目录扫描的意义

在现阶段安全测试中,目录扫描能大大提高渗透测试人员的工作效率。

在实战中,如果通过目录扫描,获取到敏感文件,如后台登录地址等,就可可以尝试暴库、SQL注入等方式进行安全测试;

如果发现敏感目录或敏感文件,能帮我们获取如php环境变量、robots.txt、网站指纹等信息;

如果扫描出了一些上传的文件,我们甚至可能通过上传功能(一句话恶意代码)获取网站的权限。

import requests

hearders={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Geocko/20100101 Firefox/60.0'}
url=input('url:')
txt=input('php.txt:')
url_list=[]
if txt==' ':
    txt='php.txt'
try:
    with open(txt,'r') as f:
        for a in f.readlines():
            a.replace('\n','')
            url_list.append(a)
except Exception as e:
    print(e)
    
for y in url_list:
    conn='http://'+y+'/'+txt
    try:
        res=requests.get(conn,hearders=hearders)
        print("%s--------------%s"%(conn,res))
    except Exception as e:
        print('%s--------------%s'%(conn,e.code))
    
            

猜你喜欢

转载自blog.csdn.net/qq_48985780/article/details/121342488
今日推荐