Skip to content

Commit f797a6d

Browse files
committed
Fix for an Issue sqlmapproject#125
1 parent 6f52954 commit f797a6d

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lib/core/option.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,15 @@ def __setPrefixSuffix():
993993
# to be tested for
994994
conf.boundaries = [ boundary ]
995995

996+
def __setAuthCred():
997+
"""
998+
Adds authentication credentials (if any) for current target to the password manager
999+
(used by connection handler)
1000+
"""
1001+
1002+
if kb.passwordMgr:
1003+
kb.passwordMgr.add_password(None, "%s://%s" % (conf.scheme, conf.hostname), conf.authUsername, conf.authPassword)
1004+
9961005
def __setHTTPAuthentication():
9971006
"""
9981007
Check and set the HTTP(s) authentication method (Basic, Digest, NTLM or Certificate),
@@ -1044,6 +1053,8 @@ def __setHTTPAuthentication():
10441053

10451054
kb.passwordMgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
10461055

1056+
__setAuthCred()
1057+
10471058
if aTypeLower == "basic":
10481059
authHandler = SmartHTTPBasicAuthHandler(kb.passwordMgr)
10491060

lib/core/target.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from lib.core.option import authHandler
3737
from lib.core.option import __setDBMS
3838
from lib.core.option import __setKnowledgeBaseAttributes
39+
from lib.core.option import __setAuthCred
3940
from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR
4041
from lib.core.settings import HOST_ALIASES
4142
from lib.core.settings import REFERER_ALIASES
@@ -332,14 +333,6 @@ def __setResultsFile():
332333

333334
logger.info("using '%s' as results file" % conf.resultsFilename)
334335

335-
def __setAuthCred():
336-
"""
337-
Adds authentication credentials (if any) for current target to the password manager (used by connection handler).
338-
"""
339-
340-
if kb.passwordMgr:
341-
kb.passwordMgr.add_password(None, "%s://%s" % (conf.scheme, conf.hostname), conf.authUsername, conf.authPassword)
342-
343336
def __createFilesDir():
344337
"""
345338
Create the file directory.

0 commit comments

Comments
 (0)