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

Function _bruteProcessVariantA

lib/utils/hash.py:827–903  ·  view source on GitHub ↗
(attack_info, hash_regex, suffix, retVal, proc_id, proc_count, wordlists, custom_wordlist, api)

Source from the content-addressed store, hash-verified

825 return retVal
826
827def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc_count, wordlists, custom_wordlist, api):
828 if IS_WIN:
829 coloramainit()
830
831 count = 0
832 rotator = 0
833 hashes = set(item[0][1] for item in attack_info)
834
835 wordlist = Wordlist(wordlists, proc_id, getattr(proc_count, "value", 0), custom_wordlist)
836
837 try:
838 for word in wordlist:
839 if not attack_info:
840 break
841
842 count += 1
843
844 if isinstance(word, six.binary_type):
845 word = getUnicode(word)
846 elif not isinstance(word, six.string_types):
847 continue
848
849 if suffix:
850 word = word + suffix
851
852 try:
853 current = __functions__[hash_regex](password=word, uppercase=False)
854
855 if current in hashes:
856 for item in attack_info[:]:
857 ((user, hash_), _) = item
858
859 if hash_ == current:
860 retVal.put((user, hash_, word))
861
862 clearConsoleLine()
863
864 infoMsg = "\r[%s] [INFO] cracked password '%s'" % (time.strftime("%X"), word)
865
866 if user and not user.startswith(DUMMY_USER_PREFIX):
867 infoMsg += " for user '%s'\n" % user
868 else:
869 infoMsg += " for hash '%s'\n" % hash_
870
871 dataToStdout(infoMsg, True)
872
873 attack_info.remove(item)
874
875 elif (proc_id == 0 or getattr(proc_count, "value", 0) == 1) and count % HASH_MOD_ITEM_DISPLAY == 0 or hash_regex == HASH.ORACLE_OLD or hash_regex == HASH.CRYPT_GENERIC and IS_WIN:
876 rotator += 1
877
878 if rotator >= len(ROTATING_CHARS):
879 rotator = 0
880
881 status = "current status: %s... %s" % (word.ljust(5)[:5], ROTATING_CHARS[rotator])
882
883 if not api:
884 dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))

Callers 1

dictionaryAttackFunction · 0.85

Calls 7

WordlistClass · 0.90
getUnicodeFunction · 0.90
clearConsoleLineFunction · 0.90
dataToStdoutFunction · 0.90
getSafeExStringFunction · 0.90
putMethod · 0.80
removeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…