@@ -239,10 +239,11 @@ def attackCachedUsersPasswords():
239239 if kb .data .cachedUsersPasswords :
240240 results = dictionaryAttack (kb .data .cachedUsersPasswords )
241241
242- for (user , hash_ , password ) in results :
243- for i in xrange (len (kb .data .cachedUsersPasswords [user ])):
244- if kb .data .cachedUsersPasswords [user ][i ] and hash_ .lower () in kb .data .cachedUsersPasswords [user ][i ].lower ():
245- kb .data .cachedUsersPasswords [user ][i ] += "%s clear-text password: %s" % ('\n ' if kb .data .cachedUsersPasswords [user ][i ][- 1 ] != '\n ' else '' , password )
242+ for result in results :
243+ for (user , hash_ , password ) in result :
244+ for i in xrange (len (kb .data .cachedUsersPasswords [user ])):
245+ if kb .data .cachedUsersPasswords [user ][i ] and hash_ .lower () in kb .data .cachedUsersPasswords [user ][i ].lower ():
246+ kb .data .cachedUsersPasswords [user ][i ] += "%s clear-text password: %s" % ('\n ' if kb .data .cachedUsersPasswords [user ][i ][- 1 ] != '\n ' else '' , password )
246247
247248def attackDumpedTable ():
248249 if kb .data .dumpedTable :
@@ -289,19 +290,20 @@ def attackDumpedTable():
289290
290291 results = dictionaryAttack (attack_dict )
291292
292- for (user , hash_ , password ) in results :
293- for i in range (count ):
294- for column in columns :
295- if column == colUser or column == '__infos__' :
296- continue
297- if len (table [column ]['values' ]) <= i :
298- continue
293+ for result in results :
294+ for (user , hash_ , password ) in result :
295+ for i in range (count ):
296+ for column in columns :
297+ if column == colUser or column == '__infos__' :
298+ continue
299+ if len (table [column ]['values' ]) <= i :
300+ continue
299301
300- value = table [column ]['values' ][i ]
302+ value = table [column ]['values' ][i ]
301303
302- if all (map (lambda x : x , [value , hash_ ])) and value .lower () == hash_ .lower ():
303- table [column ]['values' ][i ] += " (%s)" % password
304- table [column ]['length' ] = max (table [column ]['length' ], len (table [column ]['values' ][i ]))
304+ if all (map (lambda x : x , [value , hash_ ])) and value .lower () == hash_ .lower ():
305+ table [column ]['values' ][i ] += " (%s)" % password
306+ table [column ]['length' ] = max (table [column ]['length' ], len (table [column ]['values' ][i ]))
305307
306308def hashRecognition (value ):
307309 retVal = None
@@ -369,7 +371,7 @@ def __bruteProcessVariantA(attack_info, hash_regex, wordlist, suffix, retVal, pr
369371
370372 except :
371373 warnMsg = "there was a problem while hashing entry: %s. " % repr (word )
372- warnMsg += "Please report by e-mail to %s. " % ML
374+ warnMsg += "Please report by e-mail to %s" % ML
373375 logger .critical (warnMsg )
374376
375377 except KeyboardInterrupt :
@@ -421,7 +423,7 @@ def __bruteProcessVariantB(user, hash_, kwargs, hash_regex, wordlist, suffix, re
421423
422424 except :
423425 warnMsg = "there was a problem while hashing entry: %s. " % repr (word )
424- warnMsg += "Please report by e-mail to %s. " % ML
426+ warnMsg += "Please report by e-mail to %s" % ML
425427 logger .critical (warnMsg )
426428
427429 except KeyboardInterrupt :
@@ -580,7 +582,8 @@ def dictionaryAttack(attack_dict):
580582 warnMsg = "user aborted during dictionary attack phase"
581583 logger .warn (warnMsg )
582584
583- results .extend ([retVal .get () for i in xrange (retVal .qsize ())] if retVal else [])
585+ if retVal :
586+ results .append ([retVal .get () for i in xrange (retVal .qsize ())])
584587
585588 clearConsoleLine ()
586589
@@ -647,13 +650,14 @@ class Value():
647650 warnMsg = "user aborted during dictionary attack phase"
648651 logger .warn (warnMsg )
649652
650- results = [retVal .get () for i in xrange (retVal .qsize ())] if retVal else []
653+ if retVal :
654+ results .append ([retVal .get () for i in xrange (retVal .qsize ())])
651655
652656 clearConsoleLine ()
653657
654658 if len (hash_regexes ) == 0 :
655- warnMsg = "unknown hash Format . "
656- warnMsg += "Please report by e-mail to %s. " % ML
659+ warnMsg = "unknown hash format . "
660+ warnMsg += "Please report by e-mail to %s" % ML
657661 logger .warn (warnMsg )
658662
659663 if len (results ) == 0 :
0 commit comments