2727from lib .controller .checks import checkConnection
2828from lib .core .common import Backend
2929from lib .core .common import boldifyMessage
30+ from lib .core .common import checkFile
3031from lib .core .common import dataToStdout
3132from lib .core .common import getPublicTypeMembers
3233from lib .core .common import extractRegexResult
133134from lib .request .connect import Connect as Request
134135from lib .request .dns import DNSServer
135136from lib .request .basicauthhandler import SmartHTTPBasicAuthHandler
136- from lib .request .certhandler import HTTPSCertAuthHandler
137137from lib .request .httpshandler import HTTPSHandler
138+ from lib .request .pkihandler import HTTPSPKIAuthHandler
138139from lib .request .rangehandler import HTTPRangeHandler
139140from lib .request .redirecthandler import SmartRedirectHandler
140141from lib .request .templates import getPageTemplate
@@ -1102,17 +1103,17 @@ def _setAuthCred():
11021103
11031104def _setHTTPAuthentication ():
11041105 """
1105- Check and set the HTTP(s) authentication method (Basic, Digest, NTLM or Certificate ),
1106- username and password for first three methods, or key file and certification file for
1107- certificate authentication
1106+ Check and set the HTTP(s) authentication method (Basic, Digest, NTLM or PKI ),
1107+ username and password for first three methods, or PEM private key file for
1108+ PKI authentication
11081109 """
11091110
11101111 global authHandler
11111112
1112- if not conf .authType and not conf .authCred and not conf .authCert :
1113+ if not conf .authType and not conf .authCred and not conf .authPrivate :
11131114 return
11141115
1115- elif conf .authType and not conf .authCred and not conf .authCert :
1116+ elif conf .authType and not conf .authCred and not conf .authPrivate :
11161117 errMsg = "you specified the HTTP authentication type, but "
11171118 errMsg += "did not provide the credentials"
11181119 raise SqlmapSyntaxException (errMsg )
@@ -1122,15 +1123,15 @@ def _setHTTPAuthentication():
11221123 errMsg += "but did not provide the type"
11231124 raise SqlmapSyntaxException (errMsg )
11241125
1125- if not conf .authCert :
1126+ if not conf .authPrivate :
11261127 debugMsg = "setting the HTTP authentication type and credentials"
11271128 logger .debug (debugMsg )
11281129
11291130 aTypeLower = conf .authType .lower ()
11301131
1131- if aTypeLower not in (AUTH_TYPE .BASIC , AUTH_TYPE .DIGEST , AUTH_TYPE .NTLM , AUTH_TYPE .CERT ):
1132+ if aTypeLower not in (AUTH_TYPE .BASIC , AUTH_TYPE .DIGEST , AUTH_TYPE .NTLM , AUTH_TYPE .PKI ):
11321133 errMsg = "HTTP authentication type value must be "
1133- errMsg += "Basic, Digest, NTLM or Cert "
1134+ errMsg += "Basic, Digest, NTLM or PKI "
11341135 raise SqlmapSyntaxException (errMsg )
11351136 elif aTypeLower in (AUTH_TYPE .BASIC , AUTH_TYPE .DIGEST ):
11361137 regExp = "^(.*?):(.*?)$"
@@ -1140,9 +1141,9 @@ def _setHTTPAuthentication():
11401141 regExp = "^(.*\\ \\ .*):(.*?)$"
11411142 errMsg = "HTTP NTLM authentication credentials value must "
11421143 errMsg += "be in format 'DOMAIN\username:password'"
1143- elif aTypeLower == AUTH_TYPE .CERT :
1144- errMsg = "HTTP Cert authentication require "
1145- errMsg += "usage of option `--auth-cert `"
1144+ elif aTypeLower == AUTH_TYPE .PKI :
1145+ errMsg = "HTTP PKI authentication require "
1146+ errMsg += "usage of option `--auth-pki `"
11461147 raise SqlmapSyntaxException (errMsg )
11471148
11481149 aCredRegExp = re .search (regExp , conf .authCred )
@@ -1174,26 +1175,12 @@ def _setHTTPAuthentication():
11741175
11751176 authHandler = HTTPNtlmAuthHandler .HTTPNtlmAuthHandler (kb .passwordMgr )
11761177 else :
1177- debugMsg = "setting the HTTP(s) authentication certificate "
1178+ debugMsg = "setting the HTTP(s) authentication PEM private key "
11781179 logger .debug (debugMsg )
11791180
1180- aCertRegExp = re .search ("^(.+?),\s*(.+?)$" , conf .authCert )
1181-
1182- if not aCertRegExp :
1183- errMsg = "HTTP authentication certificate option "
1184- errMsg += "must be in format 'key_file,cert_file'"
1185- raise SqlmapSyntaxException (errMsg )
1186-
1187- # os.path.expanduser for support of paths with ~
1188- key_file = os .path .expanduser (aCertRegExp .group (1 ))
1189- cert_file = os .path .expanduser (aCertRegExp .group (2 ))
1190-
1191- for ifile in (key_file , cert_file ):
1192- if not os .path .exists (ifile ):
1193- errMsg = "file '%s' does not exist" % ifile
1194- raise SqlmapSyntaxException (errMsg )
1195-
1196- authHandler = HTTPSCertAuthHandler (key_file , cert_file )
1181+ key_file = os .path .expanduser (conf .authPrivate )
1182+ checkFile (key_file )
1183+ authHandler = HTTPSPKIAuthHandler (key_file )
11971184
11981185def _setHTTPMethod ():
11991186 """
0 commit comments