Fix for Issue #177

This commit is contained in:
Miroslav Stampar 2010-03-16 13:11:44 +00:00
parent 323cf2b7f2
commit 1dfe558d3d
4 changed files with 21 additions and 2 deletions

View File

@ -31,6 +31,8 @@ from lib.controller.checks import checkRegexp
from lib.controller.checks import checkConnection from lib.controller.checks import checkConnection
from lib.core.common import paramToDict from lib.core.common import paramToDict
from lib.core.common import parseTargetUrl from lib.core.common import parseTargetUrl
from lib.core.common import pop
from lib.core.common import push
from lib.core.common import readInput from lib.core.common import readInput
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
@ -103,6 +105,10 @@ def start():
if kb.targetUrls and len(kb.targetUrls) > 1: if kb.targetUrls and len(kb.targetUrls) > 1:
infoMsg = "sqlmap got a total of %d targets" % len(kb.targetUrls) infoMsg = "sqlmap got a total of %d targets" % len(kb.targetUrls)
logger.info(infoMsg) logger.info(infoMsg)
if conf.multipleTargets:
push(conf.raise404)
conf.raise404 = False
hostCount = 0 hostCount = 0
cookieStr = "" cookieStr = ""
@ -267,7 +273,12 @@ def start():
logger.error(e) logger.error(e)
else: else:
logger.error(e) logger.error(e)
if conf.multipleTargets:
conf.raise404 = pop()
return return
if conf.multipleTargets:
conf.raise404 = pop()
if conf.loggedToOut: if conf.loggedToOut:
logger.info("Fetched data logged to text files under '%s'" % conf.outputPath) logger.info("Fetched data logged to text files under '%s'" % conf.outputPath)

View File

@ -939,3 +939,9 @@ def posixToNtSlashes(filepath):
def ntToPosixSlashes(filepath): def ntToPosixSlashes(filepath):
return filepath.replace('\\', '/') return filepath.replace('\\', '/')
def push(value):
conf.stack.append(value)
def pop():
return conf.stack.pop()

View File

@ -957,12 +957,14 @@ def __setConfAttributes():
conf.path = None conf.path = None
conf.port = None conf.port = None
conf.progressWidth = 54 conf.progressWidth = 54
conf.raise404 = True
conf.retriesCount = 0 conf.retriesCount = 0
conf.scheme = None conf.scheme = None
#conf.seqMatcher = difflib.SequenceMatcher(lambda x: x in " \t") #conf.seqMatcher = difflib.SequenceMatcher(lambda x: x in " \t")
conf.seqMatcher = difflib.SequenceMatcher(None) conf.seqMatcher = difflib.SequenceMatcher(None)
conf.seqLock = None conf.seqLock = None
conf.sessionFP = None conf.sessionFP = None
conf.stack = []
conf.start = True conf.start = True
conf.threadContinue = True conf.threadContinue = True
conf.threadException = False conf.threadException = False

View File

@ -70,7 +70,7 @@ class Connect:
direct = kwargs.get('direct', False) direct = kwargs.get('direct', False)
multipart = kwargs.get('multipart', False) multipart = kwargs.get('multipart', False)
silent = kwargs.get('silent', False) silent = kwargs.get('silent', False)
raise404 = kwargs.get('raise404', True) raise404 = kwargs.get('raise404', None)
page = "" page = ""
cookieStr = "" cookieStr = ""
@ -181,7 +181,7 @@ class Connect:
errMsg = "not authorized, try to provide right HTTP " errMsg = "not authorized, try to provide right HTTP "
errMsg += "authentication type and valid credentials" errMsg += "authentication type and valid credentials"
raise sqlmapConnectionException, errMsg raise sqlmapConnectionException, errMsg
elif e.code == 404 and raise404: elif e.code == 404 and (raise404 or (raise404 is None and conf.raise404)):
errMsg = "page not found" errMsg = "page not found"
raise sqlmapConnectionException, errMsg raise sqlmapConnectionException, errMsg
else: else: