mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-03 19:55:47 +03:00
Consistency fix
This commit is contained in:
parent
d3ad408a21
commit
1a4ea186ca
|
@ -320,3 +320,4 @@ class AUTH_TYPE:
|
||||||
BASIC = "basic"
|
BASIC = "basic"
|
||||||
DIGEST = "digest"
|
DIGEST = "digest"
|
||||||
NTLM = "ntlm"
|
NTLM = "ntlm"
|
||||||
|
CERT = "cert"
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ def _setHTTPAuthentication():
|
||||||
if not conf.aType and not conf.aCred and not conf.aCert:
|
if not conf.aType and not conf.aCred and not conf.aCert:
|
||||||
return
|
return
|
||||||
|
|
||||||
elif conf.aType and not conf.aCred:
|
elif conf.aType and not conf.aCred and not conf.aCert:
|
||||||
errMsg = "you specified the HTTP authentication type, but "
|
errMsg = "you specified the HTTP authentication type, but "
|
||||||
errMsg += "did not provide the credentials"
|
errMsg += "did not provide the credentials"
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
@ -1111,18 +1111,22 @@ def _setHTTPAuthentication():
|
||||||
|
|
||||||
aTypeLower = conf.aType.lower()
|
aTypeLower = conf.aType.lower()
|
||||||
|
|
||||||
if aTypeLower not in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST, AUTH_TYPE.NTLM):
|
if aTypeLower not in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST, AUTH_TYPE.NTLM, AUTH_TYPE.CERT):
|
||||||
errMsg = "HTTP authentication type value must be "
|
errMsg = "HTTP authentication type value must be "
|
||||||
errMsg += "Basic, Digest or NTLM"
|
errMsg += "Basic, Digest, NTLM or Cert"
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
elif aTypeLower in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST):
|
elif aTypeLower in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST):
|
||||||
regExp = "^(.*?):(.*?)$"
|
regExp = "^(.*?):(.*?)$"
|
||||||
errMsg = "HTTP %s authentication credentials " % aTypeLower
|
errMsg = "HTTP %s authentication credentials " % aTypeLower
|
||||||
errMsg += "value must be in format username:password"
|
errMsg += "value must be in format 'username:password'"
|
||||||
elif aTypeLower == AUTH_TYPE.NTLM:
|
elif aTypeLower == AUTH_TYPE.NTLM:
|
||||||
regExp = "^(.*\\\\.*):(.*?)$"
|
regExp = "^(.*\\\\.*):(.*?)$"
|
||||||
errMsg = "HTTP NTLM authentication credentials value must "
|
errMsg = "HTTP NTLM authentication credentials value must "
|
||||||
errMsg += "be in format DOMAIN\username:password"
|
errMsg += "be in format 'DOMAIN\username:password'"
|
||||||
|
elif aTypeLower == AUTH_TYPE.CERT:
|
||||||
|
errMsg = "HTTP Cert authentication require "
|
||||||
|
errMsg += "usage of option `--auth-cert`"
|
||||||
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
||||||
aCredRegExp = re.search(regExp, conf.aCred)
|
aCredRegExp = re.search(regExp, conf.aCred)
|
||||||
|
|
||||||
|
@ -1160,7 +1164,7 @@ def _setHTTPAuthentication():
|
||||||
|
|
||||||
if not aCertRegExp:
|
if not aCertRegExp:
|
||||||
errMsg = "HTTP authentication certificate option "
|
errMsg = "HTTP authentication certificate option "
|
||||||
errMsg += "must be in format key_file,cert_file"
|
errMsg += "must be in format 'key_file,cert_file'"
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
||||||
# os.path.expanduser for support of paths with ~
|
# os.path.expanduser for support of paths with ~
|
||||||
|
@ -1169,7 +1173,7 @@ def _setHTTPAuthentication():
|
||||||
|
|
||||||
for ifile in (key_file, cert_file):
|
for ifile in (key_file, cert_file):
|
||||||
if not os.path.exists(ifile):
|
if not os.path.exists(ifile):
|
||||||
errMsg = "File '%s' does not exist" % ifile
|
errMsg = "file '%s' does not exist" % ifile
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
||||||
authHandler = HTTPSCertAuthHandler(key_file, cert_file)
|
authHandler = HTTPSCertAuthHandler(key_file, cert_file)
|
||||||
|
|
|
@ -107,7 +107,7 @@ def cmdLineParser():
|
||||||
|
|
||||||
request.add_option("--auth-type", dest="aType",
|
request.add_option("--auth-type", dest="aType",
|
||||||
help="HTTP authentication type "
|
help="HTTP authentication type "
|
||||||
"(Basic, Digest or NTLM)")
|
"(Basic, Digest, NTLM or Cert)")
|
||||||
|
|
||||||
request.add_option("--auth-cred", dest="aCred",
|
request.add_option("--auth-cred", dest="aCred",
|
||||||
help="HTTP authentication credentials "
|
help="HTTP authentication credentials "
|
||||||
|
|
|
@ -72,7 +72,7 @@ headers = Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
|
||||||
|
|
||||||
# HTTP Authentication type. Useful only if the target URL requires
|
# HTTP Authentication type. Useful only if the target URL requires
|
||||||
# HTTP Basic, Digest or NTLM authentication and you have such data.
|
# HTTP Basic, Digest or NTLM authentication and you have such data.
|
||||||
# Valid: Basic, Digest or NTLM
|
# Valid: Basic, Digest, NTLM or Cert
|
||||||
aType =
|
aType =
|
||||||
|
|
||||||
# HTTP authentication credentials. Useful only if the target URL requires
|
# HTTP authentication credentials. Useful only if the target URL requires
|
||||||
|
|
Loading…
Reference in New Issue
Block a user