Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ed106e

Browse files
committed
Patch for an Issue #1434
1 parent 38541b0 commit 5ed106e

6 files changed

Lines changed: 15 additions & 13 deletions

File tree

lib/core/dicts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@
223223
"--replicate": "use '--dump-format=SQLITE' instead",
224224
"--no-unescape": "use '--no-escape' instead",
225225
"--binary": "use '--binary-fields' instead",
226+
"--auth-private": "use '--auth-file' instead",
226227
"--check-payload": None,
227228
"--check-waf": None,
228229
}

lib/core/option.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,13 +1264,13 @@ def _setHTTPAuthentication():
12641264

12651265
global authHandler
12661266

1267-
if not conf.authType and not conf.authCred and not conf.authPrivate:
1267+
if not conf.authType and not conf.authCred and not conf.authFile:
12681268
return
12691269

1270-
if conf.authPrivate and not conf.authType:
1270+
if conf.authFile and not conf.authType:
12711271
conf.authType = AUTH_TYPE.PKI
12721272

1273-
elif conf.authType and not conf.authCred and not conf.authPrivate:
1273+
elif conf.authType and not conf.authCred and not conf.authFile:
12741274
errMsg = "you specified the HTTP authentication type, but "
12751275
errMsg += "did not provide the credentials"
12761276
raise SqlmapSyntaxException(errMsg)
@@ -1285,7 +1285,7 @@ def _setHTTPAuthentication():
12851285
errMsg += "Basic, Digest, NTLM or PKI"
12861286
raise SqlmapSyntaxException(errMsg)
12871287

1288-
if not conf.authPrivate:
1288+
if not conf.authFile:
12891289
debugMsg = "setting the HTTP authentication type and credentials"
12901290
logger.debug(debugMsg)
12911291

@@ -1336,7 +1336,7 @@ def _setHTTPAuthentication():
13361336
debugMsg = "setting the HTTP(s) authentication PEM private key"
13371337
logger.debug(debugMsg)
13381338

1339-
_ = safeExpandUser(conf.authPrivate)
1339+
_ = safeExpandUser(conf.authFile)
13401340
checkFile(_)
13411341
authHandler = HTTPSPKIAuthHandler(_)
13421342

lib/core/optiondict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"headers": "string",
3838
"authType": "string",
3939
"authCred": "string",
40-
"authPrivate": "string",
40+
"authFile": "string",
4141
"proxy": "string",
4242
"proxyCred": "string",
4343
"proxyFile": "string",

lib/parse/cmdline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def cmdLineParser(argv=None):
144144
help="HTTP authentication credentials "
145145
"(name:password)")
146146

147-
request.add_option("--auth-private", dest="authPrivate",
148-
help="HTTP authentication PEM private key file")
147+
request.add_option("--auth-file", dest="authFile",
148+
help="HTTP authentication PEM cert/private key file")
149149

150150
request.add_option("--ignore-401", dest="ignore401", action="store_true",
151151
help="Ignore HTTP Error 401 (Unauthorized)")

lib/request/pkihandler.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
from lib.core.data import conf
1212

1313
class HTTPSPKIAuthHandler(urllib2.HTTPSHandler):
14-
def __init__(self, key_file):
14+
def __init__(self, auth_file):
1515
urllib2.HTTPSHandler.__init__(self)
16-
self.key_file = key_file
16+
self.auth_file = auth_file
1717

1818
def https_open(self, req):
1919
return self.do_open(self.getConnection, req)
2020

2121
def getConnection(self, host, timeout=None):
22-
return httplib.HTTPSConnection(host, key_file=self.key_file, timeout=conf.timeout)
22+
# Reference: https://docs.python.org/2/library/ssl.html#ssl.SSLContext.load_cert_chain
23+
return httplib.HTTPSConnection(host, cert_file=self.auth_file, key_file=self.auth_file, timeout=conf.timeout)

sqlmap.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ authType =
9393
# Syntax: username:password
9494
authCred =
9595

96-
# HTTP Authentication PEM private key. Useful only if the target URL requires
96+
# HTTP Authentication PEM private/cert key file. Useful only if the target URL requires
9797
# PKI authentication and you have such data.
9898
# Syntax: key_file
99-
authPrivate =
99+
authFile =
100100

101101
# Use a proxy to connect to the target URL.
102102
# Syntax: (http|https|socks4|socks5)://address:port

0 commit comments

Comments
 (0)