コード例 #1
0
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)