Example #1
0
    def straight_attacks(self, attack_name, attacks, all_wordlists, all_rules):
        """
		Parse configuration's STRAIGHT attack parameters and call the corresponding hashcat class method
		"""
        for attack in attacks:  # for every attack
            wordlists = Attacks.get_file_from_index(attack["wordlists"],
                                                    all_wordlists)
            if "rules" in attack:
                if attack_name == "straight_with_rules_manual":
                    r = attack["rules"]
                else:
                    rules = Attacks.get_file_from_index(
                        attack["rules"], all_rules)

            for w in wordlists:  # for every wordlist
                if attack_name == "straight":
                    self.hashcat.straight(w)
                elif attack_name == "straight_with_combined_rules_files":
                    if len(rules) == 2:  # only if 2 rule files are given
                        self.hashcat.straight_with_combined_rules_files(
                            w, rules[0], rules[1])
                    else:
                        print(
                            Color.red(
                                "Straight combined rules: You have to define two rule files!"
                            ))
                elif attack_name == "straight_with_rules_manual":
                    self.hashcat.straight_with_rules_manual(w, r)
                elif attack_name == "straight_with_rules_files":
                    for r in rules:  # apply all the defined rules
                        self.hashcat.straight_with_rules_file(w, r)
        return
Example #2
0
    def combinator_attacks(self, attack_name, attacks, all_wordlists):
        """
		Parse configuration's COMBINATOR attack parameters and call the corresponding hashcat class method
		"""
        for attack in attacks:  # for every attack
            wordlists = Attacks.get_file_from_index(attack["wordlists"],
                                                    all_wordlists)
            if len(wordlists) == 2:  # only if 2 wordlists are given
                w1 = wordlists[0]
                w2 = wordlists[1]
                if attack_name == "combinator":
                    self.hashcat.combinator(w1, w2)
                elif attack_name == "":
                    j = attack["rules_left"]
                    k = attack["rules_right"]
                    self.hashcat.combinator(w1, w2, j, k)
            else:
                print(
                    Color.red(
                        "Combined rules: You have to define two rule files!"))
        return
Example #3
0
                                               conf.attacks[attack_name],
                                               conf.wordlists)
                elif "brute_force" in attack_name:
                    attacks.brute_force_attacks(attack_name,
                                                conf.attacks[attack_name],
                                                conf.masks)
                elif "hybrid" in attack_name:
                    attacks.hybrid_attacks(attack_name,
                                           conf.attacks[attack_name],
                                           conf.wordlists, conf.masks)
                elif "one_word_per_hash" in attack_name:
                    attacks.OneWordPerHashAttacks(attack_name,
                                                  conf.attacks[attack_name],
                                                  conf.wordlists)
                else:
                    print(Color.red("This attack name is not recognized!"))
        except Exception as e:
            # if custom exception for exiting attacks --> continue from here
            if str(e) == "skip_attacks":
                print(Color.red(" --> Skipping attacks"))
            # else, show exception and exit
            else:
                Color.show_error(e)

        # print end datetime and duration
        end_date = datetime.now()
        print("\nEnd date: " + Results.datetime_to_string(end_date))
        duration = end_date - start_date
        print("Duration: " + Results.timedelta_to_string(duration))

    if arguments.results:  # if -r/--results