Skip to content

Commit 2f5a5e5

Browse files
committed
Fine tuning raw/binary/blob password hash cases
1 parent 9a7d9a6 commit 2f5a5e5

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/core/patch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import lib.utils.search
1717
import lib.utils.sqlalchemy
1818
import thirdparty.ansistrm.ansistrm
19+
import thirdparty.chardet.universaldetector
1920

2021
from lib.request.templates import getPageTemplate
2122

@@ -54,6 +55,9 @@ def _(self, *args):
5455
_http_client.LineAndFileWrapper._readline = _http_client.LineAndFileWrapper.readline
5556
_http_client.LineAndFileWrapper.readline = _
5657

58+
# to prevent too much "guessing" in case of binary data retrieval
59+
thirdparty.chardet.universaldetector.MINIMUM_THRESHOLD = 0.90
60+
5761
def resolveCrossReferences():
5862
"""
5963
Place for cross-reference resolution

lib/core/settings.py

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

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

lib/utils/hash.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ def attackDumpedTable():
637637
col_passwords = set()
638638
attack_dict = {}
639639
binary_fields = OrderedSet()
640+
replacements = {}
640641

641642
for column in sorted(columns, key=len, reverse=True):
642643
if column and column.lower() in COMMON_USER_COLUMNS:
@@ -668,7 +669,9 @@ def attackDumpedTable():
668669
value = table[column]["values"][i]
669670

670671
if column in binary_fields and re.search(HASH_BINARY_COLUMNS_REGEX, column) is not None:
672+
previous = value
671673
value = encodeHex(getBytes(value), binary=False)
674+
replacements[value] = previous
672675

673676
if hashRecognition(value):
674677
found = True
@@ -703,7 +706,8 @@ def attackDumpedTable():
703706

704707
for (_, hash_, password) in results:
705708
if hash_:
706-
lut[hash_.lower()] = password
709+
key = hash_ if hash_ not in replacements else replacements[hash_]
710+
lut[key.lower()] = password
707711

708712
debugMsg = "post-processing table dump"
709713
logger.debug(debugMsg)

0 commit comments

Comments
 (0)