| 12 | from thirdparty.six.moves import urllib as _urllib |
| 13 | |
| 14 | class HTTPSPKIAuthHandler(_urllib.request.HTTPSHandler): |
| 15 | def __init__(self, auth_file): |
| 16 | _urllib.request.HTTPSHandler.__init__(self) |
| 17 | self.auth_file = auth_file |
| 18 | |
| 19 | def https_open(self, req): |
| 20 | return self.do_open(self.getConnection, req) |
| 21 | |
| 22 | def getConnection(self, host, timeout=None): |
| 23 | try: |
| 24 | # Reference: https://docs.python.org/2/library/ssl.html#ssl.SSLContext.load_cert_chain |
| 25 | return _http_client.HTTPSConnection(host, cert_file=self.auth_file, key_file=self.auth_file, timeout=conf.timeout) |
| 26 | except IOError as ex: |
| 27 | errMsg = "error occurred while using key " |
| 28 | errMsg += "file '%s' ('%s')" % (self.auth_file, getSafeExString(ex)) |
| 29 | raise SqlmapConnectionException(errMsg) |
no outgoing calls
no test coverage detected
searching dependent graphs…