def __init__(self, reporter=None): Parser.__init__(self, description='Loki configuration parser.', author='Jason Reaves', reporter=reporter)
def __init__(self, reporter=None): Parser.__init__(self, description='Remcos configuration parser.', author='Talos', reporter=reporter)
def __init__(self, reporter=None): Parser.__init__(self, description='Redsip configuration parser.', author='kevoreilly', reporter=reporter)
def __init__(self, reporter=None): Parser.__init__(self, description='DridexDropper configuration parser.', author='kevoreilly', reporter=reporter)
def iter_parsers(name=None, source=None, config_only=True, _recursive=True): """ Iterates all registered parsers. :param str name: Filters parser based on a particular name. (":" notation is also supported) :param str source: Filters parser based on a particular source. (source is either the name of a python package or path to local directory) :param bool config_only: Whether to only include parsers listed in the parser configuration file. (ie. ignore component parsers like "Foo.Implant") :param bool _recursive: Whether to generate sub parsers. (This is used internally, don't change it unless you know what you are doing) :yields: tuple containing: (Source tuple, parser) :raises ValueError: If a parser name or source could not be found. """ global _sources if name and not source: # If name is using ":" notation, assume it is being organized by "source_name:parser_name" # (os.path.basename is necessary in-case source is a file path containing ":"'s) orig_name = name _, _, name = os.path.basename(name).rpartition(':') source = orig_name[:-(len(name) + 1)] # Use default source if one is not provided. source = source or _default_source or None sources = [] if source: if source in _sources: sources.append((source, _sources[source])) else: sources += _sources.items() for source_name, source in sources: # Import source. if source.is_pkg: try: package = importlib.import_module(source.path) except ImportError: raise ValueError('Could not import source: {}'.format( source.path)) else: package = _create_package(source.path) package_prefix = package.__name__ + '.' # Find list of parser names to generate if name: try: parser = _generate_parser(name, source.config, package_prefix, recursive=_recursive) yield source, parser except ValueError as e: logger.debug('[{}] {}'.format(source_name, e)) # Parser couldn't be found for this source. continue else: # If parser name is not provided provide all parsers from the given source. for parser_name in source.config.keys(): parser = _generate_parser(parser_name, source.config, package_prefix, recursive=_recursive) yield source, parser # Also list all the component parsers if requested. if not config_only: _import_all_modules(package) for klass in set(Parser.iter_subclasses()): # Ignore classes without DESCRIPTIONS since they are usually base classes. if klass.DESCRIPTION and klass.__module__.startswith( package_prefix): parser_name = '{}.{}'.format( klass.__module__[len(package_prefix):], klass.__name__) klass.name = parser_name yield source, klass
def __init__(self, reporter=None): Parser.__init__(self, description='HttpBrowser configuration parser.', author='kev', reporter=reporter)
def __init__(self, reporter=None): Parser.__init__(self, description='EvilGrab configuration parser.', author='kev', reporter=reporter)
def __init__(self, reporter=None): Parser.__init__(self, description='Qakbot config parser', author="kevoreilly", reporter=reporter)
def __init__(self, reporter=None): Parser.__init__(self, description='Retefe configuration parser.', author='Tomasuh', reporter=reporter)