Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 905fef0

Browse files
committed
now user can explicitly state number of UNION affected columns via --union-cols (e.g. --union-cols=5)
1 parent 7c537f6 commit 905fef0

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

lib/core/option.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,9 +1743,11 @@ def __basicOptionValidation():
17431743
errMsg = "value for --time-sec option must be an integer greater than 0"
17441744
raise sqlmapSyntaxException, errMsg
17451745

1746-
if isinstance(conf.uCols, basestring) and ("-" not in conf.uCols or len(conf.uCols.split("-")) != 2):
1747-
errMsg = "value for --union-cols must be a range with hyphon (e.g. 1-10)"
1748-
raise sqlmapSyntaxException, errMsg
1746+
if isinstance(conf.uCols, basestring):
1747+
if not conf.uCols.isdigit() and ("-" not in conf.uCols or len(conf.uCols.split("-")) != 2):
1748+
errMsg = "value for --union-cols must be a range with hyphon "
1749+
errMsg += "(e.g. 1-10) or integer value (e.g. 5)"
1750+
raise sqlmapSyntaxException, errMsg
17491751

17501752
if conf.charset:
17511753
try:

lib/techniques/blind/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
116116

117117
if conf.threads == 1 and not timeBasedCompare:
118118
warnMsg = "running in a single-thread mode. Please consider "
119-
warnMsg += "usage of --threads switch to speedup data fetching"
119+
warnMsg += "usage of --threads switch for faster data retrieval"
120120
singleTimeWarnMessage(warnMsg)
121121

122122
if conf.verbose in (1, 2) and not showEta:

lib/techniques/inband/union/test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ def __unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix
196196
query = agent.prefixQuery("UNION ALL SELECT %s" % kb.uChar)
197197
total = conf.uColsStop+1 - conf.uColsStart
198198

199-
count = __findUnionCharCount(comment, place, parameter, value, prefix, suffix)
199+
# In case that user explicitly stated number of columns affected
200+
if conf.uColsStop == conf.uColsStart:
201+
count = conf.uColsStart
202+
else:
203+
count = __findUnionCharCount(comment, place, parameter, value, prefix, suffix)
200204

201205
if count:
202206
if Backend.getIdentifiedDbms() in FROM_TABLE and query.endswith(FROM_TABLE[Backend.getIdentifiedDbms()]):

lib/techniques/inband/union/use.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ def __configUnionCols(columns):
113113
return
114114

115115
columns = columns.replace(" ", "")
116-
colsStart, colsStop = columns.split("-")
116+
if "-" in columns:
117+
colsStart, colsStop = columns.split("-")
118+
else:
119+
colsStart, colsStop = columns, columns
117120

118121
if not colsStart.isdigit() or not colsStop.isdigit():
119122
raise sqlmapSyntaxException, "--union-cols must be a range of integers"

0 commit comments

Comments
 (0)