Skip to content

Commit c8eea24

Browse files
committed
Implements #5295
1 parent 1be7a5a commit c8eea24

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204

205205
"General": {
206206
"trafficFile": "string",
207+
"abortOnEmpty": "boolean",
207208
"answers": "string",
208209
"batch": "boolean",
209210
"base64Parameter": "string",

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.7.1.7"
23+
VERSION = "1.7.1.8"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,9 @@ def cmdLineParser(argv=None):
628628
general.add_argument("-t", dest="trafficFile",
629629
help="Log all HTTP traffic into a textual file")
630630

631+
general.add_argument("--abort-on-empty", dest="abortOnEmpty", action="store_true",
632+
help="Abort data retrieval on empty results")
633+
631634
general.add_argument("--answers", dest="answers",
632635
help="Set predefined answers (e.g. \"quit=N,follow=N\")")
633636

lib/request/inject.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,15 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
501501
kb.safeCharEncode = False
502502

503503
if not any((kb.testMode, conf.dummy, conf.offline, conf.noCast, conf.hexConvert)) and value is None and Backend.getDbms() and conf.dbmsHandler and kb.fingerprinted:
504-
warnMsg = "in case of continuous data retrieval problems you are advised to try "
505-
warnMsg += "a switch '--no-cast' "
506-
warnMsg += "or switch '--hex'" if hasattr(queries[Backend.getIdentifiedDbms()], "hex") else ""
507-
singleTimeWarnMessage(warnMsg)
504+
if conf.abortOnEmpty:
505+
errMsg = "aborting due to empty data retrieval"
506+
logger.critical(errMsg)
507+
raise SystemExit
508+
else:
509+
warnMsg = "in case of continuous data retrieval problems you are advised to try "
510+
warnMsg += "a switch '--no-cast' "
511+
warnMsg += "or switch '--hex'" if hasattr(queries[Backend.getIdentifiedDbms()], "hex") else ""
512+
singleTimeWarnMessage(warnMsg)
508513

509514
# Dirty patch (MSSQL --binary-fields with 0x31003200...)
510515
if Backend.isDbms(DBMS.MSSQL) and conf.binaryFields:

sqlmap.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@ sessionFile =
702702
# Log all HTTP traffic into a textual file.
703703
trafficFile =
704704

705+
# Abort data retrieval on empty results.
706+
abortOnEmpty = False
707+
705708
# Set predefined answers (e.g. "quit=N,follow=N").
706709
answers =
707710

0 commit comments

Comments
 (0)