Beispiel #1
0
    def __init__(self,
                 name: str,
                 description: str,
                 loot_name: str,
                 multithreaded: bool,
                 intrusive: bool,
                 critical: bool,
                 intrusion_level: int = 3,
                 priority: int = 1):
        self.name = name
        self.description = description
        self.loot_name = loot_name

        self.required_programs = []

        self.multithreaded = multithreaded
        self.intrusive = intrusive
        self.intrusion_level = intrusion_level  # TODO: Intrusion level for all modules instead of bool
        self.priority = priority  # TODO: Execute priority - some modules should execute after others have ran
        self.critical_module = critical

        self.logger = get_logger(name)

        self.logger.debug("Created {NAME} module instance".format(NAME=name))

        # Suppress the DEBUG output from the urllib3.connectionpool
        logging.getLogger("urllib3").setLevel(logging.WARNING)
Beispiel #2
0
def load() -> None:
    """
    Load all of the modules from the folder
    """
    global logger
    logger = config.get_logger("Module Provider")
    __check_plugin_folder()
    __load_init_modules()
    __load_modules()
    __check_module_dependencies()
Beispiel #3
0
def test_get_logger_verbose_no_parse():
    ArgHandler.__args = argparse.Namespace()
    ArgHandler.__args.verbose = None
    ArgHandler.__args.very_verbose = None
    logger = config.get_logger("TestVerboseNoParse")
    assert logger.handlers[0].level is logging.WARNING
Beispiel #4
0
def test_get_logger_verbose():
    ArgHandler.parse_arguments(["-T", "::1", "-v"])
    logger = config.get_logger("TestVerbose")
    assert logger.handlers[0].level is logging.INFO
Beispiel #5
0
    def __init__(self, name: str):
        self.name = name

        self.logger = get_logger(name)

        self.logger.debug("Created {NAME} report instance".format(NAME=name))
Beispiel #6
0
    """
    Generate the reports
    """
    # TODO: Load report generators dynamicaly
    logger.debug("Generating reports")
    report = JSONReport()
    report.generate_report(Loot.loot)

    report = TerminalReport()
    report.generate_report(Loot.loot)
    logger.debug("Finished generating reports")


if __name__ == "__main__":
    init()
    logger = config.get_logger("Main")
    try:
        main()
    except NotImplementedError as e:
        logger.error(e)
        sys.exit(ExitCode.NotImplemented)
    except Exception as e:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        tb = traceback.format_exception(exc_type, exc_value, exc_traceback)
        print(utils.error_message(), "Unknown error encountered ({ERR}) - please report this via Github\n{EXCEPTION}"
              .format(ERR=e.args[0], EXCEPTION="".join(tb)))
        sys.exit(ExitCode.UnknownError)
    finally:
        print()
        print(utils.normal_message(), "Thank you for using Lancer")
        config.save_config()