Fix for an Issue #125

This commit is contained in:
Miroslav Stampar 2012-07-31 13:06:45 +02:00
parent 6f529542e3
commit f797a6d813
2 changed files with 12 additions and 8 deletions

View File

@ -993,6 +993,15 @@ def __setPrefixSuffix():
# to be tested for # to be tested for
conf.boundaries = [ boundary ] conf.boundaries = [ boundary ]
def __setAuthCred():
"""
Adds authentication credentials (if any) for current target to the password manager
(used by connection handler)
"""
if kb.passwordMgr:
kb.passwordMgr.add_password(None, "%s://%s" % (conf.scheme, conf.hostname), conf.authUsername, conf.authPassword)
def __setHTTPAuthentication(): def __setHTTPAuthentication():
""" """
Check and set the HTTP(s) authentication method (Basic, Digest, NTLM or Certificate), Check and set the HTTP(s) authentication method (Basic, Digest, NTLM or Certificate),
@ -1044,6 +1053,8 @@ def __setHTTPAuthentication():
kb.passwordMgr = urllib2.HTTPPasswordMgrWithDefaultRealm() kb.passwordMgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
__setAuthCred()
if aTypeLower == "basic": if aTypeLower == "basic":
authHandler = SmartHTTPBasicAuthHandler(kb.passwordMgr) authHandler = SmartHTTPBasicAuthHandler(kb.passwordMgr)

View File

@ -36,6 +36,7 @@ from lib.core.exception import sqlmapUserQuitException
from lib.core.option import authHandler from lib.core.option import authHandler
from lib.core.option import __setDBMS from lib.core.option import __setDBMS
from lib.core.option import __setKnowledgeBaseAttributes from lib.core.option import __setKnowledgeBaseAttributes
from lib.core.option import __setAuthCred
from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR
from lib.core.settings import HOST_ALIASES from lib.core.settings import HOST_ALIASES
from lib.core.settings import REFERER_ALIASES from lib.core.settings import REFERER_ALIASES
@ -332,14 +333,6 @@ def __setResultsFile():
logger.info("using '%s' as results file" % conf.resultsFilename) logger.info("using '%s' as results file" % conf.resultsFilename)
def __setAuthCred():
"""
Adds authentication credentials (if any) for current target to the password manager (used by connection handler).
"""
if kb.passwordMgr:
kb.passwordMgr.add_password(None, "%s://%s" % (conf.scheme, conf.hostname), conf.authUsername, conf.authPassword)
def __createFilesDir(): def __createFilesDir():
""" """
Create the file directory. Create the file directory.