Exemplo n.º 1
0
 def prince_keyspace(self, task, chunk):
     binary = "pp64."
     if Initialize.get_os() != 1:
         binary = "./" + binary + "bin"
     else:
         binary += "exe"
     full_cmd = binary + " --keyspace " + get_wordlist(
         update_files(task['attackcmd'], True).replace(
             task['hashlistAlias'], ""))
     if Initialize.get_os() == 1:
         full_cmd = full_cmd.replace("/", '\\')
     try:
         logging.debug("CALL: " + full_cmd)
         output = subprocess.check_output(full_cmd,
                                          shell=True,
                                          cwd="prince")
     except subprocess.CalledProcessError:
         logging.error("Error during PRINCE keyspace measure")
         send_error("PRINCE keyspace measure failed!",
                    self.config.get_value('token'), task['taskId'], None)
         sleep(5)
         return False
     output = output.decode(encoding='utf-8').replace("\r\n",
                                                      "\n").split("\n")
     keyspace = "0"
     for line in output:
         if not line:
             continue
         keyspace = line
     # as the keyspace of prince can get very very large, we only save it in case it's small enough to fit in a long,
     # otherwise we assume that the user will abort the task earlier anyway
     if int(keyspace
            ) > 9000000000000000000:  # close to max size of a long long int
         return chunk.send_keyspace(-1, task['taskId'])
     return chunk.send_keyspace(int(keyspace), task['taskId'])
Exemplo n.º 2
0
 def build_prince_command(self, task, chunk):
     binary = "../../prince/pp64."
     if Initialize.get_os() != 1:
         binary = "./" + binary + "bin"
     else:
         binary += "exe"
     pre_args = " -s " + str(chunk['skip']) + " -l " + str(
         chunk['length']) + ' '
     pre_args += get_wordlist(
         update_files(task['attackcmd']).replace(task['hashlistAlias'], ''))
     post_args = " --machine-readable --quiet --status --remove --restore-disable --potfile-disable --session=hashtopolis"
     post_args += " --status-timer " + str(task['statustimer'])
     post_args += " --outfile-check-timer=" + str(task['statustimer'])
     post_args += " --outfile-check-dir=../../hashlist_" + str(
         task['hashlistId'])
     post_args += " -o ../../hashlists/" + str(
         task['hashlistId']
     ) + ".out --outfile-format=" + self.get_outfile_format() + " "
     post_args += " --remove-timer=" + str(task['statustimer'])
     post_args += " ../../hashlists/" + str(task['hashlistId'])
     post_args += get_rules_and_hl(update_files(task['attackcmd']),
                                   task['hashlistAlias']).replace(
                                       task['hashlistAlias'], '')
     return binary + pre_args + " | " + self.callPath + post_args + task[
         'cmdpars']