Exemple #1
0
    def start_cracking(work):
        Cracker.mac_ssid_job = "%s-%s" % (work["handshake"]["mac"],
                                          work["handshake"]["ssid"])
        msg = "Running '%s' with rule '%s'" % (Cracker.mac_ssid_job,
                                               work["rule"]["name"])
        Comunicator.enable(interactive=False)
        Comunicator.dual_printer(Comunicator.logger.info, msg)

        _, Cracker.path_temp_file = mkstemp(prefix="psknow_crack")

        if work["handshake"]["file_type"] == "16800":
            with open(Cracker.path_temp_file, "w") as fd:
                fd.write(work["handshake"]["data"])
        else:
            with open(Cracker.path_temp_file, "wb") as fd:
                fd.write(b64decode(work["handshake"]["data"].encode("utf8")))

        # Memorize attack type - we need it to decode the output
        attack_type = work["handshake"]["handshake_type"]
        Cracker.crt_rule = work["rule"]

        attacked_file = Cracker.path_temp_file

        # Get commands needed to run hashcat
        generator_command, Cracker.attack_command, Cracker.scrambler =\
            Cracker.get_attack_command(Cracker.crt_rule, attack_type, attacked_file, work["handshake"]["ssid"])

        Comunicator.info_logger(
            "Trying rule %s on '%s-%s'" %
            (Cracker.crt_rule["name"], work["handshake"]["mac"],
             work["handshake"]["ssid"]))

        if Cracker.is_already_cracked(Cracker.attack_command):
            Comunicator.warning_logger(
                "'%s' has already been cracked. Attempting to send result." %
                Cracker.mac_ssid_job)
            Cracker.process_result()
            return

        if generator_command == "":
            Cracker.crt_process = SingleProcess(Cracker.attack_command)
        else:
            Cracker.crt_process = DoubleProcess(generator_command,
                                                Cracker.attack_command)
Exemple #2
0
    def start_cracking(work):
        Cracker.mac_ssid_job = "%s-%s" % (work["handshake"]["mac"],
                                          work["handshake"]["ssid"])
        msg = "Running '%s' with rule '%s'" % (Cracker.mac_ssid_job,
                                               work["rule"]["name"])
        Comunicator.enable(interactive=False)
        Comunicator.dual_printer(msg, Configuration.logger.info)

        _, Cracker.path_temp_file = mkstemp(prefix="psknow_crack")

        if work["handshake"]["file_type"] == "16800":
            with open(Cracker.path_temp_file, "w") as fd:
                fd.write(work["handshake"]["data"])
        else:
            with open(Cracker.path_temp_file, "wb") as fd:
                fd.write(b64decode(work["handshake"]["data"].encode("utf8")))

        # Memorize attack type - we need it to decode the output
        attack_type = work["handshake"]["handshake_type"]
        Cracker.crt_rule = work["rule"]

        attacked_file = Cracker.path_temp_file

        # Get commands needed to run hashcat
        generator_command, Cracker.attack_command, Cracker.scrambler =\
            Cracker.get_attack_command(Cracker.crt_rule, attack_type, attacked_file, work["handshake"]["ssid"])

        Configuration.logger.info(
            "Trying rule %s on '%s-%s'" %
            (Cracker.crt_rule["name"], work["handshake"]["mac"],
             work["handshake"]["ssid"]))

        if Cracker.is_potfile_duplicated(Cracker.attack_command):
            msg = "Duplication for %s happened. It is already present in potfile!" % Cracker.mac_ssid_job
            Configuration.dual_print(Configuration.logger.critical, msg)
            fast_stop()

        if generator_command == "":
            Cracker.crt_process = SingleProcess(Cracker.attack_command)
        else:
            Cracker.crt_process = DoubleProcess(generator_command,
                                                Cracker.attack_command)