From cb0981d8584c2a5bff24010984248fc037661b4d Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 2 Aug 2011 08:39:32 +0000 Subject: [PATCH] proper way of handling 0 length results (as in __goInferenceProxy) --- lib/techniques/error/use.py | 11 +++++++++-- lib/techniques/union/use.py | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/techniques/error/use.py b/lib/techniques/error/use.py index 4456db1f1..f43dbbc21 100644 --- a/lib/techniques/error/use.py +++ b/lib/techniques/error/use.py @@ -310,15 +310,22 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False): infoMsg += "%d entries" % stopLimit logger.info(infoMsg) - else: + elif count and not count.isdigit(): warnMsg = "it was not possible to count the number " - warnMsg += "of entries for the used SQL query. " + warnMsg += "of entries for the SQL query provided. " warnMsg += "sqlmap will assume that it returns only " warnMsg += "one entry" logger.warn(warnMsg) stopLimit = 1 + elif (not count or int(count) == 0): + warnMsg = "the SQL query provided does not " + warnMsg += "return any output" + logger.warn(warnMsg) + + return outputs + threadData = getCurrentThreadData() threadData.shared.limits = iter(xrange(startLimit, stopLimit)) numThreads = min(conf.threads, (stopLimit - startLimit)) diff --git a/lib/techniques/union/use.py b/lib/techniques/union/use.py index b95752e5a..9fa1a46fe 100644 --- a/lib/techniques/union/use.py +++ b/lib/techniques/union/use.py @@ -251,15 +251,22 @@ def unionUse(expression, unpack=True, dump=False): infoMsg += "%d entries" % stopLimit logger.info(infoMsg) - else: + elif count and not count.isdigit(): warnMsg = "it was not possible to count the number " - warnMsg += "of entries for the used SQL query. " + warnMsg += "of entries for the SQL query provided. " warnMsg += "sqlmap will assume that it returns only " warnMsg += "one entry" logger.warn(warnMsg) stopLimit = 1 + elif (not count or int(count) == 0): + warnMsg = "the SQL query provided does not " + warnMsg += "return any output" + logger.warn(warnMsg) + + return outputs + threadData = getCurrentThreadData() threadData.shared.limits = iter(xrange(startLimit, stopLimit)) numThreads = min(conf.threads, (stopLimit - startLimit))