def launch_module(module): ok = False modulesToLaunch = [] try: # Launch only a specific module for i in args: if args[i] and i in b: modulesToLaunch.append(i) except: # if no args pass # Launch all modules if not modulesToLaunch: modulesToLaunch = module for i in modulesToLaunch: try: Header().title_info(i.capitalize()) # print title pwdFound = module[i].run(i.capitalize()) # run the module print_output(i.capitalize(), pwdFound) # print the results # return value - not used but needed yield True, i.capitalize(), pwdFound except: traceback.print_exc() print error_message = traceback.format_exc() yield False, i.capitalize(), error_message
def print_output(software_name, pwdFound): if pwdFound: # if the debug logging level is not apply => print the title if logging.getLogger().isEnabledFor(logging.INFO) == False: Header().title(software_name) toWrite = [] for pwd in pwdFound: password_category = False # detect which kinds of password has been found lower_list = [s.lower() for s in pwd.keys()] password = [s for s in lower_list if "password" in s] if password: password_category = password else: key = [s for s in lower_list if "key" in s] # for the wifi if key: password_category = key else: hash = [s for s in lower_list if "hash" in s] if hash: password_category = hash else: cmd = [s for s in lower_list if "cmd" in s] if cmd: password_category = cmd # No password found if not password_category: print_debug("FAILED", "Password not found !!!") else: print_debug("OK", '%s found !!!' % password_category[0].title()) toWrite.append(pwd) # Store all passwords found on a table => for dictionary attack if master password set constant.nbPasswordFound += 1 try: constant.passwordFound.append(pwd[password_category[0]]) except: pass for p in pwd.keys(): print '%s: %s' % (p, pwd[p]) print # write credentials into a text file checks_write(toWrite, software_name) else: logging.info("[!] No passwords found\n")
def launch_module(b): ok = False modulesToLaunch = [] # Launch only a specific module for i in args: if args[i] and i in b: modulesToLaunch.append(i) # Launch all modules if not modulesToLaunch: modulesToLaunch = b for i in modulesToLaunch: Header().title_info(i.capitalize()) # print title pwdFound = b[i].run(i.capitalize()) # run the module print_output(i.capitalize(), pwdFound) # print the results
def running(): global category_choosed category_choosed = "all" # Print the title Header().first_title() start_time = time.time() for r in runLaZagne(): pass write_in_file(stdoutRes) print_footer() elapsed_time = time.time() - start_time print '\nelapsed time = ' + str(elapsed_time)
def launch_module(module, need_high_privileges=False, need_system_privileges=False, not_need_to_be_in_env=False, cannot_be_impersonate_using_tokens=False): modulesToLaunch = [] try: # Launch only a specific module for i in args: if args[i] and i in module: modulesToLaunch.append(i) except: # if no args pass # Launch all modules if not modulesToLaunch: modulesToLaunch = module for i in modulesToLaunch: if not_need_to_be_in_env and module[i].need_to_be_in_env: continue if need_high_privileges ^ module[i].need_high_privileges: continue if need_system_privileges ^ module[i].need_system_privileges: continue if cannot_be_impersonate_using_tokens and module[ i].cannot_be_impersonate_using_tokens: continue try: Header().title_info(i.capitalize()) # print title pwdFound = module[i].run(i.capitalize()) # run the module print_output(i.capitalize(), pwdFound) # print the results # return value - not used but needed yield True, i.capitalize(), pwdFound except: traceback.print_exc() print error_message = traceback.format_exc() yield False, i.capitalize(), error_message
def run(self, software_name=None): # Need admin privileges if not windll.Shell32.IsUserAnAdmin(): if logging.getLogger().isEnabledFor(logging.INFO) == True: Header().title('Windows Secrets') print_debug('WARNING', '[!] This script should be run as admin!') return # if hives already exists if self.check_existing_systemFiles(): self.delete_existing_systemFiles() # delete it # save system hives for f in self.sysFile: try: subprocess.Popen('reg.exe save hklm\%s %s.save' % (f, f), shell=True, stdout=subprocess.PIPE).stdout.read() except Exception, e: print_debug('DEBUG', '{0}'.format(e)) print_debug('ERROR', 'Failed to save %s hive' % f) return
# Fix value by default for user environnment (appdata and userprofile) constant.finalResults = {'User': user} yield 'User', user # Retrieve passwords that need high privileges for r in runModule(category_choosed, not_need_to_be_in_env=True): yield r stdoutRes.append(constant.finalResults) if __name__ == '__main__': # Print the title Header().first_title() parser = MyParser() parser.add_argument('--version', action='version', version='Version ' + str(constant.CURRENT_VERSION), help='laZagne version') # ------------------------------------------- Permanent options ------------------------------------------- # Version and verbosity PPoptional = argparse.ArgumentParser( add_help=False, formatter_class=lambda prog: argparse.HelpFormatter( prog, max_help_position=constant.MAX_HELP_POSITION)) PPoptional._optionals.title = 'optional arguments' PPoptional.add_argument('-v',
# -*- coding: utf-8 -*-