diff --git a/lib/core/settings.py b/lib/core/settings.py index 763654306..67d495497 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.1.12.15" +VERSION = "1.1.12.16" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/lib/utils/hash.py b/lib/utils/hash.py index f1ffc01be..ac16701fe 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -81,6 +81,7 @@ from lib.core.settings import UNICODE_ENCODING from lib.core.settings import ROTATING_CHARS from lib.core.wordlist import Wordlist from thirdparty.colorama.initialise import init as coloramainit +from thirdparty.oset.pyoset import oset from thirdparty.pydes.pyDes import des from thirdparty.pydes.pyDes import CBC @@ -555,37 +556,37 @@ def storeHashesToFile(attack_dict): if not attack_dict: return + items = oset() + + for user, hashes in attack_dict.items(): + for hash_ in hashes: + hash_ = hash_.split()[0] if hash_ and hash_.strip() else hash_ + if hash_ and hash_ != NULL and hashRecognition(hash_): + item = None + if user and not user.startswith(DUMMY_USER_PREFIX): + item = "%s:%s\n" % (user.encode(UNICODE_ENCODING), hash_.encode(UNICODE_ENCODING)) + else: + item = "%s\n" % hash_.encode(UNICODE_ENCODING) + + if item and item not in items: + items.add(item) + if kb.storeHashesChoice is None: message = "do you want to store hashes to a temporary file " message += "for eventual further processing with other tools [y/N] " kb.storeHashesChoice = readInput(message, default='N', boolean=True) - if not kb.storeHashesChoice: - return + if kb.storeHashesChoice: + handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.HASHES, suffix=".txt") + os.close(handle) - handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.HASHES, suffix=".txt") - os.close(handle) + infoMsg = "writing hashes to a temporary file '%s' " % filename + logger.info(infoMsg) - infoMsg = "writing hashes to a temporary file '%s' " % filename - logger.info(infoMsg) - - items = set() - - with open(filename, "w+") as f: - for user, hashes in attack_dict.items(): - for hash_ in hashes: - hash_ = hash_.split()[0] if hash_ and hash_.strip() else hash_ - if hash_ and hash_ != NULL and hashRecognition(hash_): - item = None - if user and not user.startswith(DUMMY_USER_PREFIX): - item = "%s:%s\n" % (user.encode(UNICODE_ENCODING), hash_.encode(UNICODE_ENCODING)) - else: - item = "%s\n" % hash_.encode(UNICODE_ENCODING) - - if item and item not in items: - f.write(item) - items.add(item) + with open(filename, "w+") as f: + for item in items: + f.write(item) def attackCachedUsersPasswords(): if kb.data.cachedUsersPasswords: diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 54bdeca5e..972b26e6f 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -46,7 +46,7 @@ f872699e948d0692ce11b54781da814c lib/core/log.py 760d9df2a27ded29109b390ab202e72d lib/core/replication.py a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py 02d4762140a72fd44668d3dab5eabda9 lib/core/session.py -6c29683312b1a40cdf81fa378efc9fc2 lib/core/settings.py +6c134f0e75978056a01a6442bbef1ac8 lib/core/settings.py 35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py d93501771b41315f9fb949305b6ed257 lib/core/target.py @@ -105,7 +105,7 @@ a2d2087353fb64a8441c3247ae0ad719 lib/utils/deps.py b806de9710a02436e576ac9065816021 lib/utils/getch.py fe3a38f820ae05a95f92ab53e22b46d0 lib/utils/har.py 1bdd3e6483d3d7c4fd6ec59e9526b542 lib/utils/hashdb.py -193c294d960c310808495a63167eab00 lib/utils/hash.py +148ab1b7662d441a2e5537ebc8dcb755 lib/utils/hash.py f20ae1aa6a8d1d5373ace1f7ed3476a7 lib/utils/htmlentities.py 5fb9aaf874daa47ea2b672a22740e56b lib/utils/__init__.py 67dbbf9cc9aa9665c1efcebdba5b1559 lib/utils/pivotdumptable.py