python-3.x - 如何在 python 中发送 PURGE 方法并检查响应
问题描述
现在我创建一个项目。并尝试创建一个未经身份验证的缓存清除扫描程序。我试过这个但不工作
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import requests
with open('new-target.txt', 'rb') as f:
L = f.seek(-2, os.SEEK_END)
while f.read(1) != b'\n':
f.seek(-2, os.SEEK_CUR)
a = f.readline().decode()
filepath = a
with open(filepath) as fp:
line = fp.readline()
cnt = 1
while line:
x = "{}".format(line.strip())
resp = requests.purge(x + "/")
responsee = resp.status_code
if responsee == 200:
print("\033[1;32;40m [Method - PURGE] \033[0m 1;31;40m Vulnerable: \033" + x)
line = fp.readline()
cnt += 1
给出了这个错误:
回溯(最后一次调用):文件“/root/Masaüstü/Pentesting Tools/PURGE-PUT-Method-Scanner.py”,第 23 行,resp = requests.purge(x + "/") AttributeError: module 'requests ' 没有属性 'purge'
解决方案
你得到的 Traceback 似乎很简单。您在这种情况下使用的模块请求不具有purge
您尝试在第 23 行调用的该属性。
请参考文档中列出的方法:
推荐阅读
- ubuntu - 无法使用 mod_wsgi 和 Apache2 在 Ubuntu 上部署烧瓶应用程序
- python - 基于两个嵌套列表的字典一一对应列表
- python - Python中大小和内容的不同列表仍然共享id,内存重要吗?
- javascript - 使用 Vue 将字符串转换为数学运算
- kotlin - 有没有一种简单的方法可以从内部类调用父超级函数?
- python - 如何为列表中的每个 URL 创建列表/结果?
- mysql - 如何在 1-N 表关系中选择特定值或任何其他值
- r - 从 R 访问 OpenAI (json) API
- swift - SwiftUI 与“AttributedGraph”崩溃
- c# - Crystal Report 在托管网站上上传数据库后停止