Skip to content

Commit 310a829

Browse files
committed
Patch for #2827
1 parent b1662f5 commit 310a829

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.1.12.15"
22+
VERSION = "1.1.12.16"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
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: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
from lib.core.settings import ROTATING_CHARS
8282
from lib.core.wordlist import Wordlist
8383
from thirdparty.colorama.initialise import init as coloramainit
84+
from thirdparty.oset.pyoset import oset
8485
from thirdparty.pydes.pyDes import des
8586
from thirdparty.pydes.pyDes import CBC
8687

@@ -555,37 +556,37 @@ def storeHashesToFile(attack_dict):
555556
if not attack_dict:
556557
return
557558

559+
items = oset()
560+
561+
for user, hashes in attack_dict.items():
562+
for hash_ in hashes:
563+
hash_ = hash_.split()[0] if hash_ and hash_.strip() else hash_
564+
if hash_ and hash_ != NULL and hashRecognition(hash_):
565+
item = None
566+
if user and not user.startswith(DUMMY_USER_PREFIX):
567+
item = "%s:%s\n" % (user.encode(UNICODE_ENCODING), hash_.encode(UNICODE_ENCODING))
568+
else:
569+
item = "%s\n" % hash_.encode(UNICODE_ENCODING)
570+
571+
if item and item not in items:
572+
items.add(item)
573+
558574
if kb.storeHashesChoice is None:
559575
message = "do you want to store hashes to a temporary file "
560576
message += "for eventual further processing with other tools [y/N] "
561577

562578
kb.storeHashesChoice = readInput(message, default='N', boolean=True)
563579

564-
if not kb.storeHashesChoice:
565-
return
566-
567-
handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.HASHES, suffix=".txt")
568-
os.close(handle)
580+
if kb.storeHashesChoice:
581+
handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.HASHES, suffix=".txt")
582+
os.close(handle)
569583

570-
infoMsg = "writing hashes to a temporary file '%s' " % filename
571-
logger.info(infoMsg)
572-
573-
items = set()
574-
575-
with open(filename, "w+") as f:
576-
for user, hashes in attack_dict.items():
577-
for hash_ in hashes:
578-
hash_ = hash_.split()[0] if hash_ and hash_.strip() else hash_
579-
if hash_ and hash_ != NULL and hashRecognition(hash_):
580-
item = None
581-
if user and not user.startswith(DUMMY_USER_PREFIX):
582-
item = "%s:%s\n" % (user.encode(UNICODE_ENCODING), hash_.encode(UNICODE_ENCODING))
583-
else:
584-
item = "%s\n" % hash_.encode(UNICODE_ENCODING)
584+
infoMsg = "writing hashes to a temporary file '%s' " % filename
585+
logger.info(infoMsg)
585586

586-
if item and item not in items:
587-
f.write(item)
588-
items.add(item)
587+
with open(filename, "w+") as f:
588+
for item in items:
589+
f.write(item)
589590

590591
def attackCachedUsersPasswords():
591592
if kb.data.cachedUsersPasswords:

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ f872699e948d0692ce11b54781da814c lib/core/log.py
4646
760d9df2a27ded29109b390ab202e72d lib/core/replication.py
4747
a2466b62e67f8b31736bac4dac590e51 lib/core/revision.py
4848
02d4762140a72fd44668d3dab5eabda9 lib/core/session.py
49-
6c29683312b1a40cdf81fa378efc9fc2 lib/core/settings.py
49+
6c134f0e75978056a01a6442bbef1ac8 lib/core/settings.py
5050
35bffbad762eb9e03db9e93b1c991103 lib/core/shell.py
5151
a59ec28371ae067a6fdd8f810edbee3d lib/core/subprocessng.py
5252
d93501771b41315f9fb949305b6ed257 lib/core/target.py
@@ -105,7 +105,7 @@ a2d2087353fb64a8441c3247ae0ad719 lib/utils/deps.py
105105
b806de9710a02436e576ac9065816021 lib/utils/getch.py
106106
fe3a38f820ae05a95f92ab53e22b46d0 lib/utils/har.py
107107
1bdd3e6483d3d7c4fd6ec59e9526b542 lib/utils/hashdb.py
108-
193c294d960c310808495a63167eab00 lib/utils/hash.py
108+
148ab1b7662d441a2e5537ebc8dcb755 lib/utils/hash.py
109109
f20ae1aa6a8d1d5373ace1f7ed3476a7 lib/utils/htmlentities.py
110110
5fb9aaf874daa47ea2b672a22740e56b lib/utils/__init__.py
111111
67dbbf9cc9aa9665c1efcebdba5b1559 lib/utils/pivotdumptable.py

0 commit comments

Comments
 (0)