MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / storeHashesToFile

Function storeHashesToFile

lib/utils/hash.py:629–666  ·  view source on GitHub ↗
(attack_dict)

Source from the content-addressed store, hash-verified

627 retVal.close()
628
629def storeHashesToFile(attack_dict):
630 if not attack_dict:
631 return
632
633 items = OrderedSet()
634
635 for user, hashes in attack_dict.items():
636 for hash_ in hashes:
637 hash_ = hash_.split()[0] if hash_ and hash_.strip() else hash_
638 if hash_ and hash_ != NULL and hashRecognition(hash_):
639 item = None
640 if user and not user.startswith(DUMMY_USER_PREFIX):
641 item = "%s:%s\n" % (user, hash_)
642 else:
643 item = "%s\n" % hash_
644
645 if item and item not in items:
646 items.add(item)
647
648 if kb.choices.storeHashes is None:
649 message = "do you want to store hashes to a temporary file "
650 message += "for eventual further processing with other tools [y/N] "
651
652 kb.choices.storeHashes = readInput(message, default='N', boolean=True)
653
654 if items and kb.choices.storeHashes:
655 handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.HASHES, suffix=".txt")
656 os.close(handle)
657
658 infoMsg = "writing hashes to a temporary file '%s' " % filename
659 logger.info(infoMsg)
660
661 with openFile(filename, "w+") as f:
662 for item in items:
663 try:
664 f.write(item)
665 except (UnicodeError, TypeError):
666 pass
667
668def attackCachedUsersPasswords():
669 if kb.data.cachedUsersPasswords:

Callers 2

getPasswordHashesMethod · 0.90
attackDumpedTableFunction · 0.85

Calls 9

addMethod · 0.95
OrderedSetClass · 0.90
readInputFunction · 0.90
openFileFunction · 0.90
hashRecognitionFunction · 0.85
itemsMethod · 0.80
infoMethod · 0.80
closeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…