1 Star 0 Fork 1

javaalpha/sqlmap

forked from yeqingchen1/sqlmap 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
pkihandler.py 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
Miroslav Stampar 提交于 2019-05-08 18:47 +08:00 . Last preparations for DREI
#!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from lib.core.data import conf
from lib.core.common import getSafeExString
from lib.core.exception import SqlmapConnectionException
from thirdparty.six.moves import http_client as _http_client
from thirdparty.six.moves import urllib as _urllib
class HTTPSPKIAuthHandler(_urllib.request.HTTPSHandler):
def __init__(self, auth_file):
_urllib.request.HTTPSHandler.__init__(self)
self.auth_file = auth_file
def https_open(self, req):
return self.do_open(self.getConnection, req)
def getConnection(self, host, timeout=None):
try:
# Reference: https://docs.python.org/2/library/ssl.html#ssl.SSLContext.load_cert_chain
return _http_client.HTTPSConnection(host, cert_file=self.auth_file, key_file=self.auth_file, timeout=conf.timeout)
except IOError as ex:
errMsg = "error occurred while using key "
errMsg += "file '%s' ('%s')" % (self.auth_file, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/javaalpha/sqlmap.git
git@gitee.com:javaalpha/sqlmap.git
javaalpha
sqlmap
sqlmap
master

搜索帮助