예제 #1
0
    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}"
        if self.verbose: Color.showCmd(cmd)
        with open(self.out_file_cracked_path, 'w') as f:
            p = subprocess.call(cmd, stdout=f, shell=True)
        if self.verbose:
            Color.showVerbose("Cracked hashes saved in " +
                              self.out_file_cracked_path)
        return
예제 #2
0
    def execute(self, cmd):
        """
		Execute a os command with given string
		"""
        if self.verbose: Color.showCmd(cmd)  # show on screen
        now = Color.timedelta_to_string(datetime.now())
        self.color.logThis("[+] " + now + ", " + cmd)  # log on file
        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