查看服务器是否开放了不安全的Http方法,代码如下: from http.client import HTTPConnection import sys import re domain = HTTPConnection(sys.ar
from http.client import HTTPConnection
import sys
import re
domain = HTTPConnection(sys.argv[1], int(sys.argv[2]))
domain.request('OPTIONS', sys.argv[3])
resp = domain.getresponse()
print('状态码:', resp.status)
print()
for name, value in resp.getheaders():
if re.match('Allow',name):
print(name, value)
if re.match('Allow',name) and (re.match('.*PUT',value) or re.match('.*DELETE',value) or re.match('.*TRACE',value)):
print('远端服务器开启了不安全的HTTP方法!')
使用语法为:python3 xx.py 域名 端口 目录
!运行实例如下:
C:\python36>Python3 不安全的http方法传输.py 218.201.202.249 80 /
状态码: 403
Allow GET, HEAD, POST, PUT, DELETE, OPTIONS
远端服务器开启了不安全的HTTP方法!
--结束END--
本文标题: python3基础学习(查看服务器开放的
本文链接: https://www.lsjlt.com/news/192435.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-13
2024-05-13
2024-05-11
2024-05-11
2024-05-10
2024-05-07
2024-04-30
2024-04-30
2024-04-30
2024-04-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0