minor fix for a bug reported by nightman

This commit is contained in:
Miroslav Stampar 2011-01-11 12:27:22 +00:00
parent 643c464268
commit e3146464da

View File

@ -349,29 +349,36 @@ def dictionaryAttack(attack_dict):
for word in kb.wordlist: for word in kb.wordlist:
count += 1 count += 1
current = __functions__[hash_regex](password = word, uppercase = False)
for item in attack_info: try:
((user, hash_), _) = item current = __functions__[hash_regex](password = word, uppercase = False)
if hash_ == current: for item in attack_info:
results.append((user, hash_, word)) ((user, hash_), _) = item
clearConsoleLine()
infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word) if hash_ == current:
results.append((user, hash_, word))
clearConsoleLine()
if user and not user.startswith(DUMMY_USER_PREFIX): infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word)
infoMsg += " for user: '%s'\n" % user
else:
infoMsg += " for hash: '%s'\n" % hash_
dataToStdout(infoMsg, True) if user and not user.startswith(DUMMY_USER_PREFIX):
infoMsg += " for user: '%s'\n" % user
else:
infoMsg += " for hash: '%s'\n" % hash_
attack_info.remove(item) dataToStdout(infoMsg, True)
elif count % 1117 == 0 or count == length or hash_regex in (HASH.ORACLE_OLD): attack_info.remove(item)
status = '%d/%d words (%d%s)' % (count, length, round(100.0*count/length), '%')
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status)) elif count % 1117 == 0 or count == length or hash_regex in (HASH.ORACLE_OLD):
status = '%d/%d words (%d%s)' % (count, length, round(100.0*count/length), '%')
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))
except:
warnMsg = "there was a problem while hashing entry: %s. " % repr(word)
warnMsg += "Please report by e-mail to sqlmap-users@lists.sourceforge.net."
logger.critical(warnMsg)
clearConsoleLine() clearConsoleLine()
@ -382,27 +389,32 @@ def dictionaryAttack(attack_dict):
for word in kb.wordlist: for word in kb.wordlist:
current = __functions__[hash_regex](password = word, uppercase = False, **kwargs) current = __functions__[hash_regex](password = word, uppercase = False, **kwargs)
count += 1 count += 1
try:
if hash_ == current:
if regex == HASH.ORACLE_OLD: #only for cosmetic purposes
word = word.upper()
results.append((user, hash_, word))
clearConsoleLine()
if hash_ == current: infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word)
if regex == HASH.ORACLE_OLD: #only for cosmetic purposes
word = word.upper()
results.append((user, hash_, word))
clearConsoleLine()
infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word) if user and not user.startswith(DUMMY_USER_PREFIX):
infoMsg += " for user: '%s'\n" % user
else:
infoMsg += " for hash: '%s'\n" % hash_
if user and not user.startswith(DUMMY_USER_PREFIX): dataToStdout(infoMsg, True)
infoMsg += " for user: '%s'\n" % user
else:
infoMsg += " for hash: '%s'\n" % hash_
dataToStdout(infoMsg, True) break
break elif count % 1117 == 0 or count == length or hash_regex in (HASH.ORACLE_OLD):
status = '%d/%d words (%d%s) (user: %s)' % (count, length, round(100.0*count/length), '%', user)
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))
elif count % 1117 == 0 or count == length or hash_regex in (HASH.ORACLE_OLD): except:
status = '%d/%d words (%d%s) (user: %s)' % (count, length, round(100.0*count/length), '%', user) warnMsg = "there was a problem while hashing entry: %s. " % repr(word)
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status)) warnMsg += "Please report by e-mail to sqlmap-users@lists.sourceforge.net."
logger.critical(warnMsg)
clearConsoleLine() clearConsoleLine()