From 89d2c7c0420768648e6111591821549608a72a91 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 22 Dec 2011 20:54:20 +0000 Subject: [PATCH] minor update --- lib/core/dump.py | 5 +++-- lib/core/settings.py | 3 +++ lib/utils/hash.py | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/core/dump.py b/lib/core/dump.py index 0da0fd976..2aba175ee 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -411,8 +411,9 @@ class Dump: rtable.beginTransaction() if count > TRIM_STDOUT_DUMP_SIZE: - warnMsg = "console output will be trimmed " - warnMsg += "due to the large table size" + warnMsg = "console output will be trimmed to " + warnMsg += "last %d rows due to " % TRIM_STDOUT_DUMP_SIZE + warnMsg += "large table size" logger.warning(warnMsg) for i in xrange(count): diff --git a/lib/core/settings.py b/lib/core/settings.py index 271978f3e..9d93e5f31 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -431,3 +431,6 @@ LARGE_OUTPUT_THRESHOLD = 1024**2 # On huge tables there is a considerable slowdown if every row retrieval requires ORDER BY (most noticable in table dumping using ERROR injections) SLOW_ORDER_COUNT_THRESHOLD = 10000 + +# Give up on hash recognition if nothing was found in first given number of rows +HASH_RECOGNITION_QUIT_THRESHOLD = 10000 diff --git a/lib/utils/hash.py b/lib/utils/hash.py index 1f0785c10..860b74528 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -62,6 +62,7 @@ from lib.core.settings import COMMON_USER_COLUMNS from lib.core.settings import DUMMY_USER_PREFIX from lib.core.settings import GENERAL_IP_ADDRESS_REGEX from lib.core.settings import HASH_MOD_ITEM_DISPLAY +from lib.core.settings import HASH_RECOGNITION_QUIT_THRESHOLD from lib.core.settings import IS_WIN from lib.core.settings import ITOA64 from lib.core.settings import PYVERSION @@ -322,6 +323,7 @@ def attackDumpedTable(): columns = table.keys() count = table["__infos__"]["count"] + found = False colUser = '' colPasswords = set() attack_dict = {} @@ -332,6 +334,9 @@ def attackDumpedTable(): break for i in xrange(count): + if not found and i > HASH_RECOGNITION_QUIT_THRESHOLD: + break + for column in columns: if column == colUser or column == '__infos__': continue @@ -342,6 +347,8 @@ def attackDumpedTable(): value = table[column]['values'][i] if hashRecognition(value): + found = True + if colUser and i < len(table[colUser]['values']): if table[colUser]['values'][i] not in attack_dict: attack_dict[table[colUser]['values'][i]] = []