def setup_logging_and_parse_arguments(blocktitle, yaml_conf=None): # ---------------------------------------------------------------------------- # Get parse commandline and default arguments # ---------------------------------------------------------------------------- args, defaults = _parse_arguments(yaml_conf=yaml_conf) # ---------------------------------------------------------------------------- # Setup logbook before everything else # ---------------------------------------------------------------------------- logger.configure_logging(os.path.join(args.save, 'logbook.txt')) # ---------------------------------------------------------------------------- # Write arguments to file, as txt # ---------------------------------------------------------------------------- tools.write_dictionary_to_file( sorted(vars(args).items()), filename=os.path.join(args.save, 'args.txt')) # ---------------------------------------------------------------------------- # Log arguments # ---------------------------------------------------------------------------- with logger.LoggingBlock(blocktitle, emph=True): for argument, value in sorted(vars(args).items()): reset = colorama.Style.RESET_ALL color = reset if (argument in defaults and value == defaults[argument]) else colorama.Fore.CYAN logging.info('{}{}: {}{}'.format(color, argument, value, reset)) # ---------------------------------------------------------------------------- # Postprocess # ---------------------------------------------------------------------------- args = postprocess_args(args) return args
def __init__(self): self.driver = webdriver.Chrome() configure_logging() self.logger = get_logger() self.login_btn = '//*[@id="perfect"]/header[1]/div/div[2]/div[3]/ul/li[1]/a' self.username_field_id = 'user_login' self.password_field_id = 'user_pass' self.checkbox_id = 'rememberme' self.login_btn_id = 'wp-submit' self.error_field_id = 'login_error'
except Exception: setattr(opt, log_arg[0], log_arg[1]) opt.netG = os.path.join(exp_dir, opt.netG) if not os.path.exists(opt.netG): logging.info('Skipping {}, file not exists!'.format(opt.netG)) continue # Define Saver opt.saver = utils.VideoSaver(opt) # Define Tensorboard Summary opt.summary = utils.TensorboardSummary(opt.saver.eval_dir) # Logger logger.configure_logging( os.path.abspath(os.path.join(opt.experiment_dir, 'logbook.txt'))) # CUDA device = 'cuda' if torch.cuda.is_available( ) and not opt.no_cuda else 'cpu' opt.device = device if torch.cuda.is_available() and device == 'cpu': logging.info( "WARNING: You have a CUDA device, so you should probably run with --cuda" ) # Adjust scales utils.adjust_scales2image(opt.img_size, opt) # Initial parameters opt.scale_idx = 0
import logging from argparse import ArgumentParser from subprocess import check_output from settings import VALID_BROWSERS, GOOGLE_CHROME_CONFIG_DIR, MOZILLA_FIREFOX_CONFIG_DIR from utils.logger import configure_logging from utils.filesystem import get_json_from_file, read_lines_from_file """ This script will combine some bash commands to look for TOTP secrets in either Chrome or Firefox Only works with plain text TOTP codes atm. Author: Erik Lamers <*****@*****.**> """ logger = configure_logging(__name__) def parse_args(args=None): parser = ArgumentParser( description='Tries to find TOTP codes for a account ' 'and generates the corresponding 2FA codes') parser.add_argument('browser', help='The browser to try to find TOTP secrets for, ' 'valid options are {}'.format( ', '.join(VALID_BROWSERS))) parser.add_argument('--override-config-dir', help='Override the default config dir for browser') parser.add_argument('--override-search-extensions',