Skip to content

Commit 1a4ea18

Browse files
committed
Consistency fix
1 parent d3ad408 commit 1a4ea18

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

lib/core/enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,4 @@ class AUTH_TYPE:
320320
BASIC = "basic"
321321
DIGEST = "digest"
322322
NTLM = "ntlm"
323+
CERT = "cert"

lib/core/option.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ def _setHTTPAuthentication():
10951095
if not conf.aType and not conf.aCred and not conf.aCert:
10961096
return
10971097

1098-
elif conf.aType and not conf.aCred:
1098+
elif conf.aType and not conf.aCred and not conf.aCert:
10991099
errMsg = "you specified the HTTP authentication type, but "
11001100
errMsg += "did not provide the credentials"
11011101
raise SqlmapSyntaxException(errMsg)
@@ -1111,18 +1111,22 @@ def _setHTTPAuthentication():
11111111

11121112
aTypeLower = conf.aType.lower()
11131113

1114-
if aTypeLower not in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST, AUTH_TYPE.NTLM):
1114+
if aTypeLower not in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST, AUTH_TYPE.NTLM, AUTH_TYPE.CERT):
11151115
errMsg = "HTTP authentication type value must be "
1116-
errMsg += "Basic, Digest or NTLM"
1116+
errMsg += "Basic, Digest, NTLM or Cert"
11171117
raise SqlmapSyntaxException(errMsg)
11181118
elif aTypeLower in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST):
11191119
regExp = "^(.*?):(.*?)$"
11201120
errMsg = "HTTP %s authentication credentials " % aTypeLower
1121-
errMsg += "value must be in format username:password"
1121+
errMsg += "value must be in format 'username:password'"
11221122
elif aTypeLower == AUTH_TYPE.NTLM:
11231123
regExp = "^(.*\\\\.*):(.*?)$"
11241124
errMsg = "HTTP NTLM authentication credentials value must "
1125-
errMsg += "be in format DOMAIN\username:password"
1125+
errMsg += "be in format 'DOMAIN\username:password'"
1126+
elif aTypeLower == AUTH_TYPE.CERT:
1127+
errMsg = "HTTP Cert authentication require "
1128+
errMsg += "usage of option `--auth-cert`"
1129+
raise SqlmapSyntaxException(errMsg)
11261130

11271131
aCredRegExp = re.search(regExp, conf.aCred)
11281132

@@ -1160,7 +1164,7 @@ def _setHTTPAuthentication():
11601164

11611165
if not aCertRegExp:
11621166
errMsg = "HTTP authentication certificate option "
1163-
errMsg += "must be in format key_file,cert_file"
1167+
errMsg += "must be in format 'key_file,cert_file'"
11641168
raise SqlmapSyntaxException(errMsg)
11651169

11661170
# os.path.expanduser for support of paths with ~
@@ -1169,7 +1173,7 @@ def _setHTTPAuthentication():
11691173

11701174
for ifile in (key_file, cert_file):
11711175
if not os.path.exists(ifile):
1172-
errMsg = "File '%s' does not exist" % ifile
1176+
errMsg = "file '%s' does not exist" % ifile
11731177
raise SqlmapSyntaxException(errMsg)
11741178

11751179
authHandler = HTTPSCertAuthHandler(key_file, cert_file)

lib/parse/cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def cmdLineParser():
107107

108108
request.add_option("--auth-type", dest="aType",
109109
help="HTTP authentication type "
110-
"(Basic, Digest or NTLM)")
110+
"(Basic, Digest, NTLM or Cert)")
111111

112112
request.add_option("--auth-cred", dest="aCred",
113113
help="HTTP authentication credentials "

sqlmap.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ headers = Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
7272

7373
# HTTP Authentication type. Useful only if the target URL requires
7474
# HTTP Basic, Digest or NTLM authentication and you have such data.
75-
# Valid: Basic, Digest or NTLM
75+
# Valid: Basic, Digest, NTLM or Cert
7676
aType =
7777

7878
# HTTP authentication credentials. Useful only if the target URL requires

0 commit comments

Comments
 (0)