cosmetics

This commit is contained in:
Bernardo Damele 2011-07-01 10:04:34 +00:00
parent 4513ef409e
commit 861cdb1b14
2 changed files with 18 additions and 10 deletions

View File

@ -157,11 +157,12 @@ class Wordlist:
self.iter = iter(self.custom) self.iter = iter(self.custom)
else: else:
current = self.filenames[self.index] current = self.filenames[self.index]
infoMsg = "loading dictionary from: '%s'" % current infoMsg = "loading dictionary from '%s'" % current
singleTimeLogMessage(infoMsg) singleTimeLogMessage(infoMsg)
self.fp = open(current, "r") self.fp = open(current, "r")
self.cursize = os.path.getsize(current) self.cursize = os.path.getsize(current)
self.iter = self.fp.xreadlines() self.iter = self.fp.xreadlines()
self.index += 1 self.index += 1
def append(self, value): def append(self, value):

View File

@ -368,26 +368,33 @@ def dictionaryAttack(attack_dict):
if not kb.wordlist: if not kb.wordlist:
while not kb.wordlist: while not kb.wordlist:
message = "what dictionary do you want to use?\n" message = "what dictionary do you want to use?\n"
message += "[1] Default (Press Enter)\n" message += "[1] default dictionary file (press Enter)\n"
message += "[2] Custom\n" message += "[2] custom dictionary file\n"
message += "[3] File with list of dictionary files" message += "[3] file with list of dictionary files"
choice = readInput(message, default="1") choice = readInput(message, default="1")
try: try:
if choice == "2": if choice == "2":
message = "what's the custom dictionary's location?\n" message = "what's the custom dictionary's location?\n"
dictPaths = [readInput(message)] dictPaths = [readInput(message)]
logger.info("using custom dictionary")
elif choice == "3": elif choice == "3":
message = "what's the list file location?\n" message = "what's the list file location?\n"
listPath = readInput(message) listPath = readInput(message)
checkFile(listPath) checkFile(listPath)
dictPaths = getFileItems(listPath) dictPaths = getFileItems(listPath)
logger.info("using custom list of dictionaries")
else: else:
if hash_regex == HASH.ORACLE_OLD: #it's the slowest of all methods hence smaller default dict # It is the slowest of all methods hence smaller default dict
if hash_regex == HASH.ORACLE_OLD:
dictPaths = [paths.ORACLE_DEFAULT_PASSWD] dictPaths = [paths.ORACLE_DEFAULT_PASSWD]
else: else:
dictPaths = [paths.WORDLIST] dictPaths = [paths.WORDLIST]
logger.info("using default dictionary")
for dictPath in dictPaths: for dictPath in dictPaths:
checkFile(dictPath) checkFile(dictPath)
@ -452,16 +459,16 @@ def dictionaryAttack(attack_dict):
infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word) infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word)
if user and not user.startswith(DUMMY_USER_PREFIX): if user and not user.startswith(DUMMY_USER_PREFIX):
infoMsg += " for user: '%s'\n" % user infoMsg += " for user '%s'\n" % user
else: else:
infoMsg += " for hash: '%s'\n" % hash_ infoMsg += " for hash '%s'\n" % hash_
dataToStdout(infoMsg, True) dataToStdout(infoMsg, True)
attack_info.remove(item) attack_info.remove(item)
elif count % HASH_MOD_ITEM_DISPLAY == 0 or hash_regex in (HASH.ORACLE_OLD) or hash_regex == HASH.CRYPT_GENERIC and IS_WIN: elif count % HASH_MOD_ITEM_DISPLAY == 0 or hash_regex in (HASH.ORACLE_OLD) or hash_regex == HASH.CRYPT_GENERIC and IS_WIN:
status = 'current status: %d%s (%s...)' % (kb.wordlist.percentage(), '%', word.ljust(5)[:5]) status = 'current status: %d%s (%s...)' % (kb.wordlist.percentage(), '%', word.ljust(5)[:8])
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status)) dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status))
except KeyboardInterrupt: except KeyboardInterrupt:
@ -513,9 +520,9 @@ def dictionaryAttack(attack_dict):
infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word) infoMsg = "[%s] [INFO] found: '%s'" % (time.strftime("%X"), word)
if user and not user.startswith(DUMMY_USER_PREFIX): if user and not user.startswith(DUMMY_USER_PREFIX):
infoMsg += " for user: '%s'\n" % user infoMsg += " for user '%s'\n" % user
else: else:
infoMsg += " for hash: '%s'\n" % hash_ infoMsg += " for hash '%s'\n" % hash_
dataToStdout(infoMsg, True) dataToStdout(infoMsg, True)