From f797a6d813222e4adbde2ea8e1d569abccc14679 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 31 Jul 2012 13:06:45 +0200 Subject: [PATCH] Fix for an Issue #125 --- lib/core/option.py | 11 +++++++++++ lib/core/target.py | 9 +-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index e5b349a90..4e618adc6 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -993,6 +993,15 @@ def __setPrefixSuffix(): # to be tested for 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(): """ Check and set the HTTP(s) authentication method (Basic, Digest, NTLM or Certificate), @@ -1044,6 +1053,8 @@ def __setHTTPAuthentication(): kb.passwordMgr = urllib2.HTTPPasswordMgrWithDefaultRealm() + __setAuthCred() + if aTypeLower == "basic": authHandler = SmartHTTPBasicAuthHandler(kb.passwordMgr) diff --git a/lib/core/target.py b/lib/core/target.py index c18bac017..4d1201538 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -36,6 +36,7 @@ from lib.core.exception import sqlmapUserQuitException from lib.core.option import authHandler from lib.core.option import __setDBMS 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 HOST_ALIASES from lib.core.settings import REFERER_ALIASES @@ -332,14 +333,6 @@ def __setResultsFile(): 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(): """ Create the file directory.