def save_cracked(self): """ Call hashcat's show command and save the cracked hashes from a given hashfile, hashtype and potfile """ cmd = f"{self.executable} {self.hash_type} {self.hash_file} {self.pot_file} {self.out_file_format_pwd} {self.extra_params} {self.show}" print(Color.cyan("\n" + cmd)) f = open(self.results.out_file_cracked_path, 'w') p = subprocess.call(cmd, stdout=f, shell=True) f.close() count = self.results.count_lines(self.results.out_file_cracked_path) self.results.cracked_total = count print("Cracked hashes saved in " + self.results.out_file_cracked_path + " ...") return
def execute(self, cmd): """ Execute a os command with given string """ print(Color.cyan("\n" + cmd)) p = subprocess.call(cmd, shell=True) ''' p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) (output, err) = p.communicate() p_status = p.wait() #print("Command output: ", output) #print("Command exit status/return code: ", p_status) ''' return
help= "shows a summary of the results and saves them to a file using the potfile" ) #parser.add_argument("-v", "--version", action='version', version='%(prog)s 1.1') return parser.parse_args() if __name__ == "__main__": """ configuration: all the config data attacks: configure attacks from config data hashcat: calls to hashcat individual attacks results: generates a report with the results """ os.system("") # enable command colors print(Color.cyan("\n...AutoCrackeo...")) arguments = get_arguments() conf = Configuration(arguments.hash_file, arguments.hash_type, arguments.config_file, arguments.extra_params) results = Results(conf.static_values) hashcat = Hashcat(conf.static_values, results) attacks = Attacks(hashcat) if arguments.config_file: # if -c/--config """ Execute a specific selection of hashcat attacks previously defined on the configuration json file This will be updated gradually as the efficiency of the attacks are measured """ # print start datetime