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

Skip to content

Commit 33bb9c5

Browse files
committed
much cleaner approach in that "flat" representation of retrieved items in union technique
1 parent 7fb190f commit 33bb9c5

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

lib/core/common.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,6 +2427,18 @@ def unArrayizeValue(value):
24272427

24282428
return value
24292429

2430+
def flattenValue(value):
2431+
"""
2432+
Returns an iterator representing flat representation of a given value
2433+
"""
2434+
2435+
for i in iter(value):
2436+
if isinstance(i, (list, tuple)):
2437+
for j in flattenValue(i):
2438+
yield j
2439+
else:
2440+
yield i
2441+
24302442
def getSortedInjectionTests():
24312443
"""
24322444
Returns prioritized test list by eventually detected DBMS from error

lib/techniques/union/use.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from lib.core.common import clearConsoleLine
2020
from lib.core.common import dataToStdout
2121
from lib.core.common import extractRegexResult
22+
from lib.core.common import flattenValue
2223
from lib.core.common import getConsoleWidth
2324
from lib.core.common import getUnicode
2425
from lib.core.common import hashDBRetrieve
@@ -316,7 +317,7 @@ def unionThread():
316317
items = output.replace(kb.chars.start, "").replace(kb.chars.stop, "").split(kb.chars.delimiter)
317318

318319
if conf.verbose == 1:
319-
status = "[%s] [INFO] %s: %s" % (time.strftime("%X"), "resumed" if threadData.resumed else "retrieved", safecharencode(",".join("\"%s\"" % _ for _ in arrayizeValue(unArrayizeValue(items)))))
320+
status = "[%s] [INFO] %s: %s" % (time.strftime("%X"), "resumed" if threadData.resumed else "retrieved", safecharencode(",".join("\"%s\"" % _ for _ in flattenValue(arrayizeValue(items)))))
320321

321322
if len(status) > width:
322323
status = "%s..." % status[:width - 3]

0 commit comments

Comments
 (0)