2013-02-14 15:32:17 +04:00
|
|
|
#!/usr/bin/env python
|
2010-01-02 05:07:28 +03:00
|
|
|
|
|
|
|
"""
|
2014-01-13 21:24:49 +04:00
|
|
|
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
|
2010-10-15 03:18:29 +04:00
|
|
|
See the file 'doc/COPYING' for copying permission
|
2010-01-02 05:07:28 +03:00
|
|
|
"""
|
|
|
|
|
2010-01-02 05:02:12 +03:00
|
|
|
import httplib
|
|
|
|
import urllib2
|
|
|
|
|
2010-01-07 15:59:09 +03:00
|
|
|
from lib.core.data import conf
|
|
|
|
|
2013-09-12 01:17:18 +04:00
|
|
|
class HTTPSPKIAuthHandler(urllib2.HTTPSHandler):
|
|
|
|
def __init__(self, key_file):
|
2010-01-02 05:02:12 +03:00
|
|
|
urllib2.HTTPSHandler.__init__(self)
|
|
|
|
self.key_file = key_file
|
2010-01-02 05:07:28 +03:00
|
|
|
|
2010-01-02 05:02:12 +03:00
|
|
|
def https_open(self, req):
|
|
|
|
return self.do_open(self.getConnection, req)
|
2010-01-02 05:07:28 +03:00
|
|
|
|
2013-02-05 15:16:06 +04:00
|
|
|
def getConnection(self, host, timeout=None):
|
2013-09-12 01:17:18 +04:00
|
|
|
return httplib.HTTPSConnection(host, key_file=self.key_file, timeout=conf.timeout)
|