def do_run_jtr_wordlist_mode(pJTR: JohnTheRipper, pWordlist: str, pRule: str) -> None: lCrackingMode = "Wordlist {}".format(os.path.basename(pWordlist)) if pRule: lCrackingMode += " with rule {}".format(pRule) lWatcher = Watcher(pCrackingMode=lCrackingMode, pJTR=pJTR) lWatcher.start_timer() lWatcher.print_mode_start_message() pJTR.run_wordlist_mode(pWordlist=pWordlist, pRule=pRule) lWatcher.stop_timer() lWatcher.print_mode_finsihed_message() gReporter.appendRecord( pMode=lCrackingMode, pMask="", pWordlist=pWordlist, pRule=pRule, pNumberPasswordsCracked=lWatcher.number_passwords_cracked_by_this_mode, pNumberPasswordsCrackedPerSecond=lWatcher. number_passwords_cracked_by_this_mode_per_second, pPercentPasswordsCracked=lWatcher. percent_passwords_cracked_by_this_mode)
def do_run_jtr_prince_mode(pJTR: JohnTheRipper) -> None: lCrackingMode = "John the Ripper (JTR) Prince Mode" lWatcher = Watcher(pCrackingMode=lCrackingMode, pJTR=pJTR) lWatcher.start_timer() lWatcher.print_mode_start_message() pJTR.prince_element_count_min = 2 pJTR.prince_element_count_max = 3 pJTR.path_to_wordlist = "dictionaries" pJTR.wordlist = "prince.txt" pJTR.run_prince_mode() pJTR.prince_element_count_min = 2 pJTR.prince_element_count_max = 2 pJTR.wordlist = "short-list.txt" pJTR.run_prince_mode() pJTR.wordlist = "top-10000-english-words.txt" pJTR.run_prince_mode() lWatcher.stop_timer() lWatcher.print_mode_finsihed_message() gReporter.appendRecord( pMode=lCrackingMode, pMask="", pWordlist="", pRule="", pNumberPasswordsCracked=lWatcher.number_passwords_cracked_by_this_mode, pNumberPasswordsCrackedPerSecond=lWatcher. number_passwords_cracked_by_this_mode_per_second, pPercentPasswordsCracked=lWatcher. percent_passwords_cracked_by_this_mode)
def do_run_jtr_single_mode(pJTR: JohnTheRipper) -> None: lCrackingMode = "John the Ripper (JTR) Single Crack" lWatcher = Watcher(pCrackingMode=lCrackingMode, pJTR=pJTR) lWatcher.start_timer() lWatcher.print_mode_start_message() pJTR.run_single_crack() lWatcher.stop_timer() lWatcher.print_mode_finsihed_message() gReporter.appendRecord( pMode=lCrackingMode, pMask="", pWordlist="", pRule="", pNumberPasswordsCracked=lWatcher.number_passwords_cracked_by_this_mode, pNumberPasswordsCrackedPerSecond=lWatcher. number_passwords_cracked_by_this_mode_per_second, pPercentPasswordsCracked=lWatcher. percent_passwords_cracked_by_this_mode)
def run_main_program(pParser: Parser): Printer.verbose = pParser.verbose Printer.debug = pParser.debug if pParser.show_examples: Printer.print_example_usage() exit(0) lJTR = JohnTheRipper( pJTRExecutableFilePath=pParser.config_file.JTR_EXECUTABLE_FILE_PATH, pJTRPotFilePath=pParser.config_file.JTR_POT_FILE_PATH, pHashFilePath=pParser.hash_file, pHashFormat=pParser.hash_format, pPassThrough=pParser.jtr_pass_through, pVerbose=pParser.verbose, pDebug=pParser.debug) lWatcher = Watcher(pJTR=lJTR, pCrackingMode="Cracking Job") lWatcher.start_timer() lWatcher.print_program_starting_message() # Hopefully user has some knowledge of system to give good base words if pParser.run_basewords_mode: run_jtr_baseword_mode(pJTR=lJTR, pBaseWords=pParser.basewords) # John the Ripper Single Crack mode if pParser.run_jtr_single_crack: run_jtr_single_mode(pJTR=lJTR) if pParser.run_hailmary_mode: run_jtr_hailmary_mode(pJTR=lJTR) # Techniques mode for i in pParser.techniques: run_jtr_prayer_mode(pJTR=lJTR, pMethod=i) # Pathwell mode if pParser.run_pathwell_mode: run_pathwell_mode(pJTR=lJTR, pFirstMask=pParser.first_pathwell_mask, pLastMask=pParser.last_pathwell_mask, pMaxAllowedCharactersToBruteForce=pParser. config_file.MAX_CHARS_TO_BRUTEFORCE) # Smart brute-force if pParser.run_brute_force: run_jtr_brute_force_mode( pJTR=lJTR, pMinCharactersToBruteForce=pParser.min_characters_to_brute_force, pMaxCharactersToBruteForce=pParser.max_characters_to_brute_force, pMaxAllowedCharactersToBruteForce=pParser.config_file. MAX_CHARS_TO_BRUTEFORCE) # John the Ripper Prince mode if pParser.run_jtr_prince_mode: run_jtr_prince_mode(pJTR=lJTR) # If the user chooses -s option, begin statistical analysis to aid targeted cracking routines if pParser.run_stat_crack: run_statistical_crack_mode(pJTR=lJTR, pPercentile=pParser.percentile, pMaxAllowedCharactersToBruteForce=pParser. config_file.MAX_CHARS_TO_BRUTEFORCE) if pParser.recycle_passwords: run_jtr_recycle_mode(pJTR=lJTR) lWatcher.stop_timer() lWatcher.print_program_finsihed_message(pReporter=gReporter)