def __init__(self, *, hashes_file: str = None, uncracked_hashes: str = None, slurm=None, cracker=None, potfile: Path = None): """ Initialization of auxiliary/hashes/hashes_status ama module """ auxiliary_options = { 'hashes_file': Argument(hashes_file, True, "Hashes file to check status"), 'uncracked_hashes': Argument(uncracked_hashes, False, "File to save uncracked hashes"), 'cracker': Argument(cracker, False, f"Hash cracker (<{John.MAINNAME}|{Hashcat.MAINNAME}>)"), 'potfile': Argument(potfile, False, "Potfile of hash cracker"), } init_options = { 'mname': HashesStatus.MNAME, 'author': HashesStatus.AUTHOR, 'description': HashesStatus.DESCRIPTION, 'fulldescription': HashesStatus.FULLDESCRIPTION, 'references': HashesStatus.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': slurm } super().__init__(**init_options)
def __init__(self, *, hashType:str = None, hashesFile:str = None, wordlists: List[str] = None, slurm=None): """ Initialization of John combination attack Args: hashType (str): Jonh's hash type hashesFile (str): Hashes file to attack slurm (Slurm): Instance of Slurm class """ attackOptions = { 'hash_type': Argument(hashType, False, "Hashcat hash type"), 'hashes_file': Argument(hashesFile, True, "Hashes file"), 'wordlists': Argument(wordlists, True, "Hashes file"), } if slurm is None: slurm = Slurm() initOptions = { 'mname' : JohnCombination.MNAME, 'author': JohnCombination.AUTHOR, 'description': JohnCombination.DESCRIPTION, 'fulldescription': JohnCombination.FULLDESCRIPTION, 'attackOptions': attackOptions, 'slurm': slurm } super().__init__(**initOptions)
def __init__(self, *, hashes: str = None, timeout: int = None, greppable: bool = False, pre_attack: Auxiliary = None, post_attack: Auxiliary = None): attack_options = { 'hashes': Argument(hashes, True, "Hashes to identify (hash or hashes file)"), 'timeout': Argument(timeout, False, "Timeout in seconds"), 'greppable': Argument(greppable, False, "Show output in JSON form ") } init_options = { 'mname': STH.MNAME, 'author': STH.AUTHOR, 'description': STH.DESCRIPTION, 'fulldescription': STH.FULLDESCRIPTION, 'references': STH.REFERENCES, 'pre_attack': pre_attack, 'attack_options': attack_options, 'post_attack': post_attack, 'slurm': None } super().__init__(**init_options)
def __init__(self, *, hashType=None, hashesFile=None, masksFile=None, wordlist=None, slurm=None, inverse=False): """ Initialization of John hybrid attack Args: hashType (str): Jonh's hash type hashesFile (str): Hashes file masksFile (str): Masks file wordlist (str): Wordlist slurm (Slurm): Instance of Slurm class """ attackOptions = { 'hash_type': Argument(hashType, True, "John hash type"), 'hashes_file': Argument(hashesFile, True, "Hashes file"), 'masks_file': Argument(masksFile, True, "Masks file"), 'wordlist': Argument(wordlist, True, "Wordlist file"), 'inverse': Argument(inverse, True, "False: wordlits + masks <> True: masks + wordlist") } if slurm is None: slurm = Slurm() initOptions = { 'mname': JohnHybrid.MNAME, 'author': JohnHybrid.AUTHOR, 'description': JohnHybrid.DESCRIPTION, 'fulldescription': JohnHybrid.FULLDESCRIPTION, 'attackOptions': attackOptions, 'slurm': slurm } super().__init__(**initOptions)
def __init__(self, *, wordlist:str = None, output: str = None, minlength: int = None, maxlength: int = None, charsets: List[str] = None, simplemasks: List[str] = None, hiderare:int = 0, quiet: bool = True): auxiliary_options = { 'wordlist': Argument(wordlist, True, "Wordlist to analyze"), 'output': Argument(output, False, "File name to save generated masks and occurrence"), # password filters 'min_length': Argument(minlength, False, "Minimum password length"), 'max_length': Argument(maxlength, False, "Maximum password length"), 'charsets': Argument(charsets, False, "Password charset filter (e.g. loweralpha,numeric)"), 'simple_masks': Argument(simplemasks, False, "Password mask filter (e.g.stringdigit,allspecial)"), 'hiderare': Argument(hiderare, True, "Hide statistics lower than the supplied percent"), } init_options = { 'mname': PackStatsgen.MNAME, 'author': PackStatsgen.AUTHOR, 'description': PackStatsgen.DESCRIPTION, 'fulldescription': PackStatsgen.FULLDESCRIPTION, 'references': PackStatsgen.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': None } super().__init__(**init_options)
def __init__(self, wordlist: str = None, quiet: bool = False): auxiliary_options = { 'wordlist': Argument(wordlist, True, "Wordlist to refine"), #'quiet': Argument(quiet, True, "Don't print cupp's fancy banner") } init_options = { 'mname': CuppRefine.MNAME, 'author': CuppRefine.AUTHOR, 'description': CuppRefine.DESCRIPTION, 'fulldescription': CuppRefine.FULLDESCRIPTION, 'references': CuppRefine.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': None } super().__init__(**init_options)
def __init__(self, *, quiet=False): """ Initialization of Cupp - Download wordlists """ auxiliary_options = { 'quiet': Argument(quiet, True, "Don't print cupp's fancy banner") } init_options = { 'mname': CuppDownload.MNAME, 'author': CuppDownload.AUTHOR, 'description': CuppDownload.DESCRIPTION, 'fulldescription': CuppDownload.FULLDESCRIPTION, 'references': CuppDownload.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': None } super().__init__(**init_options)
def __init__(self, *, hash_type: str = None, hashes_file: str = None, masks_file:str = None, masks_attack:str = "mask_attack.py", sleep:int = 1, slurm: Slurm = None, pre_attack = None, post_attack = None): """ Initialization of wordlist attack using hashcat """ attack_options = { 'hash_type': Argument(hash_type, True, "Hashcat hash type"), 'hashes_file': Argument(hashes_file, True, "Hashes file"), 'masks_file': Argument(masks_file, True, "Masks file"), 'masks_attack': Argument(masks_attack, True, "Generated mask attack script"), 'sleep': Argument(sleep, True, 'Sleep time between each attack (seconds)') } if slurm is None: slurm_options = { "account": Argument(None, False, "Cluster account to submit the job"), "dependency": Argument(None, False, "Defer the start of this job until the specified dependencies have been satisfied completed"), "chdir" : Argument(os.getcwd(), True, "Working directory path"), "error": Argument(None, False, "Error file"), "job_name" : Argument('attack', False, "Name for the job allocation"), "cluster" : Argument(None, False, "Cluster Name"), "distribution": Argument('block', True, "Distribution methods for remote processes (<block|cyclic|plane|arbitrary>)"), "mail_type": Argument(None, False, "Event types to notify user by email(<BEGIN|END|FAIL|REQUEUE|ALL|TIME_LIMIT_PP>)"), "main_user": Argument(None, False, "User email"), "mem": Argument(None, False, "Memory per node (<size[units]>)"), "mem_per_cpu": Argument(None, False, "Minimum memory required per allocated CPU (<size[units]>)"), "cpus_per_task": Argument(1, True, "Number of processors per task"), "nodes": Argument(1, True, "Number of nodes(<minnodes[-maxnodes]>)"), "gpu": Argument(1, True, "Number of GPUS"), "ntasks": Argument(1, True, "Number of tasks"), "nice": Argument(None, False, "Run the job with an adjusted scheduling"), "output": Argument('slurm-%j.out', True, "Output file name"), "open_mode": Argument('truncate', True, "Output open mode (<append|truncate>)"), "partition": Argument(None, True, "Partition to submit job"), "reservation": Argument(None, False, "Resource reservation name"), "time": Argument(None, False, "Limit of time (format: DD-HH:MM:SS)"), "test_only": Argument(False, True, "Validate the batch script and return an estimate of when a job would be scheduled to run. No job is actually submitted"), "verbose": Argument(False, True, "Increase the verbosity of sbatch's informational messages"), "nodelist": Argument(None, False, "Nodelist"), "wait": Argument(False, True, "Do not exit until the submitted job terminates"), "exclude": Argument(None, False, "Do not exit until the submitted job terminates"), 'batch_script': Argument('attack.sh', True, "Name for the generated batch script"), 'pmix': Argument('pmix_v3', True, "MPI type") } slurm = Slurm(**slurm_options) init_options = { 'mname' : HashcatMasks.MNAME, 'author': HashcatMasks.AUTHOR, 'description': HashcatMasks.DESCRIPTION, 'fulldescription': HashcatMasks.FULLDESCRIPTION, 'references': HashcatMasks.REFERENCES, 'pre_attack': pre_attack, 'attack_options': attack_options, 'post_attack': post_attack, 'slurm': slurm } super().__init__(**init_options)
def __init__(self, *, wordlist: str = None, output: str = None, charsets: List[str] = None, min_length: int = None, max_length: int = None, min_digit:int = None, max_digit:int = None, min_upper:int = None, max_upper:int = None, min_lower:int = None, max_lower:int = None, min_special:int = None, max_special:int = None, min_complexity:int = None, max_complexity:int = None, min_occurrence:int = None, max_occurrence:int = None, min_time:int = None, max_time:int = None, target_time:int = None, hiderare: int = 0, show_masks:bool = False, quiet: bool = False, sorting = "optindex"): auxiliary_options = { 'wordlist': Argument(wordlist, True, "Wordlist to analyze"), 'output': Argument(output, True, "File name to save generated masks and occurrence"), 'charsets': Argument(charsets, False, "Password charset filter (e.g. loweralpha,numeric)"), 'min_length': Argument(min_length, False, "Minimum password length"), 'max_length': Argument(max_length, False, "Maximum password length"), 'min_special': Argument(min_special, False, "Minimum number of special characters"), 'min_upper': Argument(min_upper, False, "Minimum number of uppercase characters"), 'min_lower': Argument(min_lower, False, "Minimum number of lowercase characters"), 'min_digit': Argument(min_digit, False, "Minimum number of digit"), 'max_special': Argument(max_special, False, "Maximum number of special characters"), 'max_upper': Argument(max_upper, False, "Maximum number of uppercase characters"), 'max_digit': Argument(max_digit, False, "Maximum number of digit"), 'max_lower': Argument(max_lower, False, "Maximum number of lowercase characters"), 'min_complexity': Argument(min_complexity, False, "Minimum complexity"), 'max_complexity': Argument(max_complexity, False, "Maximum complexity"), 'min_occurrence': Argument(min_occurrence, False, "Minimum occurrence"), 'max_occurrence': Argument(max_occurrence, False, "Maximum occurrence"), 'min_time': Argument(min_time, False, "Minimum mask runtime (seconds)"), 'max_time': Argument(max_time, False, "Maximum mask runtime (seconds)"), 'target_time': Argument(target_time, False, "Target time of all masks (seconds)"), 'sorting': Argument(sorting, True, "Mask sorting (<optindex|occurrence|complexity>)"), 'hiderare': Argument(hiderare, True, "Hide statistics lower than the supplied percent"), 'show_masks': Argument(show_masks, True, "Show matching mask"), } init_options = { 'mname': PackWholegen.MNAME, 'author': PackWholegen.AUTHOR, 'description': PackWholegen.DESCRIPTION, 'fulldescription': PackWholegen.FULLDESCRIPTION, 'references': PackWholegen.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': None } super().__init__(**init_options)
def run(self, quiet: bool = False, attack_output: Any = None): """ Execution of auxiliary/hashes/hashes_status ama module """ #import pdb; pdb.set_trace() global_hashes_status = {'cracked': [], 'uncracked': []} try: cracker_name = self.options['cracker'].value if cracker_name is not None: if cracker_name not in [John.MAINNAME, Hashcat.MAINNAME]: raise Exception("Selected invalid cracker: {cracker_name}") elif cracker_name == John.MAINNAME: crackers = [John] else: #cracker_name == Hashcat.MAINNAME crackers = [Hashcat] else: crackers = get_availables_hashes_crackers() hashes_file = self.options['hashes_file'].value potfile = self.options['potfile'].value for cracker in crackers: hashes_status = cracker.hashes_file_status( hashes_file, potfile) for cracked_hash in hashes_status['cracked']: if cracked_hash not in global_hashes_status['cracked']: global_hashes_status['cracked'].append(cracked_hash) for uncracked_hash in hashes_status['uncracked']: if uncracked_hash not in global_hashes_status['uncracked']: global_hashes_status['uncracked'].append( uncracked_hash) if uncracked_hashes := self.options.get( 'uncracked_hashes', Argument.get_empty()).value: with open(uncracked_hashes, 'w') as uncracked_hashes_file: #hashes_status['uncracked'] struct is [[UNCRACKED_HASH], [OTHER_UNCRACKED_HASH], ...] for [uhash] in global_hashes_status['uncracked']: uncracked_hashes_file.write(f"{uhash}\n") print_status( f"Uncracked hashes have written to {uncracked_hashes} file" ) # print status of hashes in hashesFile if not quiet: status_hashes_table = (f""" Cracked Hashes: {tabulate(global_hashes_status["cracked"],headers = ["Hash", "Type", "Password", "Cracker"])} Uncracked Hashes: {tabulate(global_hashes_status["uncracked"],headers = ["Hash"])} """) print(status_hashes_table) return hashes_status
def __init__( self, *, users=None, passwords=None, #users_passwd_file=None, port=None, ip4=True, output=None, output_format="text", verbose=True, stopInSuccess=False, stopInSuccessPerTarget=True, targets=None, service=None, slurm=None): attack_options = { 'users': Argument(users, True, "User or users file to login"), #'users_passwd_file': Argument(users_passwd_file), 'passwords': Argument(passwords, True, "Password or Passwords file"), 'port': Argument(port, False, "Service port"), 'ip4': Argument(ip4, True, "Use Ip4 otherwise use IP6"), 'output': Argument(output, False, "Output file"), 'output_format': Argument(output_format, True, "Output format file <text|json|jsonv1>"), 'verbose': Argument(verbose, True, "Show login+pass for each attempt"), 'stop_in_success': Argument(stopInSuccess, True, "Exit when a login/pass pair is found (global)"), 'stop_in_success_per_target': Argument(stopInSuccessPerTarget, True, "Exit when a login/pass pair is found (per target)"), 'targets': Argument( targets, True, "Server (DNS, IP or 192.168.0.0/24) or servers (one target per line, ':' to specify port) to attack" ), 'service': Argument(service, True, "Service to crack") } if slurm is None: slurm_options = { "account": Argument(None, False, "Cluster account to submit the job"), "dependency": Argument( None, False, "Defer the start of this job until the specified dependencies have been satisfied completed" ), "chdir": Argument(os.getcwd(), True, "Working directory path"), "error": Argument(None, False, "Error file"), "job_name": Argument('attack', False, "Name for the job allocation"), "cluster": Argument(None, False, "Cluster Name"), "distribution": Argument( 'block', True, "Distribution methods for remote processes (<block|cyclic|plane|arbitrary>)" ), "mail_type": Argument( None, False, "Event types to notify user by email(<BEGIN|END|FAIL|REQUEUE|ALL|TIME_LIMIT_PP>)" ), "main_user": Argument(None, False, "User email"), "mem": Argument(None, False, "Memory per node (<size[units]>)"), "mem_per_cpu": Argument( None, False, "Minimum memory required per allocated CPU (<size[units]>)" ), "cpus_per_task": Argument(1, True, "Number of processors per task"), "nodes": Argument(1, True, "Number of nodes(<minnodes[-maxnodes]>)"), "ntasks": Argument(1, True, "Number of tasks"), "nice": Argument(None, False, "Run the job with an adjusted scheduling"), "output": Argument('slurm-%j.out', True, "Output file name"), "open_mode": Argument('truncate', True, "Output open mode (<append|truncate>)"), "partition": Argument(None, True, "Partition to submit job"), "reservation": Argument(None, False, "Resource reservation name"), "time": Argument(None, False, "Limit of time (format: DD-HH:MM:SS)"), "test_only": Argument( False, True, "Validate the batch script and return an estimate of when a job would be scheduled to run. No job is actually submitted" ), "verbose": Argument( False, True, "Increase the verbosity of sbatch's informational messages" ), "nodelist": Argument(None, False, "Nodelist"), "wait": Argument(False, True, "Do not exit until the submitted job terminates"), "exclude": Argument(None, False, "Do not exit until the submitted job terminates"), 'batch_script': Argument('attack.sh', True, "Name for the generated batch script"), 'pmix': Argument('pmix_v3', True, "MPI type") } slurm = Slurm(**slurm_options) init_options = { 'mname': HydraWordlist.MNAME, 'author': HydraWordlist.AUTHOR, 'description': HydraWordlist.DESCRIPTION, 'fulldescription': HydraWordlist.FULLDESCRIPTION, 'references': HydraWordlist.REFERENCES, 'attack_options': attack_options, 'slurm': slurm } super().__init__(**init_options)
def __init__(self, *, statsgen_output: str = None, output: str = None, min_length: int = None, max_length: int = None, target_time: int = None, min_time:int = None, max_time:int = None, min_complexity: int = None, max_complexity: int = None, min_occurrence: int = None, max_occurrence: int = None, sorting:str = "optindex", check_masks: List[str] = None, check_masks_file: str = None, show_masks: bool = False, quiet: bool = True): auxiliary_options = { 'stats': Argument(statsgen_output, True, "Statsgen output file"), 'output': Argument(output, True, "File name to save generated masks"), # password filters 'min_length': Argument(min_length, False, "Minimum password length"), 'max_length': Argument(max_length, False, "Maximum password length"), 'min_time': Argument(min_time, False, "Minimum mask runtime (seconds)"), 'max_time': Argument(max_time, False, "Maximum mask runtime (seconds)"), 'target_time': Argument(target_time, False, "Target time of all masks (seconds)"), 'min_complexity': Argument(min_complexity, False, "Minimum complexity"), 'max_complexity': Argument(max_complexity, False, "Maximum complexity"), 'min_occurrence': Argument(min_occurrence, False, "Minimum occurrence"), 'max_occurrence': Argument(max_occurrence, False, "Maximum occurrence"), 'sorting': Argument(sorting, True, "Mask sorting (<optindex|occurrence|complexity>)"), 'check_masks': Argument(check_masks, False, "Check mask coverage(e.g. ?u?l?d,?l?d?d)"), 'check_masks_file': Argument(check_masks_file, False, "Check mask coverage in a file"), 'show_masks': Argument(show_masks, True, "Show matching mask"), } init_options = { 'mname': PackMaskgen.MNAME, 'author': PackMaskgen.AUTHOR, 'description': PackMaskgen.DESCRIPTION, 'fulldescription': PackMaskgen.FULLDESCRIPTION, 'references': PackMaskgen.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': None } super().__init__(**init_options)
def __init__(self, *, output: str = None, min_length: int = None, max_length: int = None, min_digit: int = None, max_digit: int = None, min_upper: int = None, max_upper: int = None, min_lower: int = None, max_lower: int = None, min_special: int = None, max_special: int = None, show_masks: bool = False, quiet: bool = True): auxiliary_options = { 'output': Argument(output, True, "File to save generated masks"), # mask filters 'min_length': Argument(min_length, True, "Minimum password length"), 'max_length': Argument(max_length, True, "Maximum password length"), 'min_special': Argument(min_special, False, "Minimum number of special characters"), 'min_upper': Argument(min_upper, False, "Minimum number of uppercase characters"), 'min_lower': Argument(min_lower, False, "Minimum number of lowercase characters"), 'min_digit': Argument(min_digit, False, "Minimum number of digit"), 'max_special': Argument(max_special, False, "Maximum number of special characters"), 'max_upper': Argument(max_upper, False, "Maximum number of uppercase characters"), 'max_digit': Argument(max_digit, False, "Maximum number of digit"), 'max_lower': Argument(max_lower, False, "Maximum number of lowercase characters"), # miscellaneous 'show_masks': Argument(show_masks, True, "Show matching mask"), } init_options = { 'mname': PackPolicygen.MNAME, 'author': PackPolicygen.AUTHOR, 'description': PackPolicygen.DESCRIPTION, 'fulldescription': PackPolicygen.FULLDESCRIPTION, 'references': PackPolicygen.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': None } super().__init__(**init_options)
def __init__(self, *, url: str = None, depth: int = 2, min_length: int = 3, offsite: bool = False, exclude: str = None, allowed: str = None, write: str = None, lowercase: bool = False, with_numbers: bool = False, convert_umlauts: bool = True, meta: bool = False, meta_file: str = None, email: bool = False, email_file: str = None, count: bool = False, verbose: bool = True, debug: bool = False): """ Initialization of Cewl """ auxiliary_options = { "url": Argument(url, True, "The site to spider"), "depth": Argument(depth, True, "Depth to spider to"), "min_length": Argument(min_length, True, "Minimum word length"), "offsite": Argument(offsite, True, "Let the spider visit other sites"), "exclude": Argument(exclude, False, "A file containing a list of paths to exclude"), "allowed": Argument(allowed, False, "A regex pattern that path must match to be followed"), "write": Argument(write, False, "Write the output to the file"), "lowercase": Argument(lowercase, True, "Lowercase all parsed words"), "with_numbers": Argument(with_numbers, True, "Accept words with numbers in as well as just letters"), "convert_umlauts": Argument(convert_umlauts, True, "Convert common ISO-8859-1 (Latin-1) umlauts"), "meta": Argument(meta, False, "Include meta data"), "meta_file": Argument(meta_file, False, "Output file for meta data"), "email": Argument(email, False, "Include email addresses"), "email_file": Argument(email_file, False, "Output file for email addresses"), "count": Argument(count, True, "Show the count for each word found"), "verbose": Argument(verbose, True, "Verbose"), "debug": Argument(debug, False, "Extra debug information") } init_options = { 'mname': Cewl.MNAME, 'author': Cewl.AUTHOR, 'description': Cewl.DESCRIPTION, 'fulldescription': Cewl.FULLDESCRIPTION, 'references': Cewl.REFERENCES, 'auxiliary_options': auxiliary_options, 'slurm': None } super().__init__(**init_options)