Example #1
0
 async def _create_ability(self,
                           ability_id,
                           tactic=None,
                           technique_name=None,
                           technique_id=None,
                           name=None,
                           test=None,
                           description=None,
                           executor=None,
                           platform=None,
                           cleanup=None,
                           payloads=None,
                           parsers=None,
                           requirements=None,
                           privilege=None,
                           timeout=60,
                           access=None,
                           buckets=None,
                           repeatable=False,
                           code=None,
                           language=None,
                           build_target=None,
                           variations=None,
                           **kwargs):
     ps = []
     for module in parsers:
         ps.append(
             Parser.load(dict(module=module,
                              parserconfigs=parsers[module])))
     rs = []
     for requirement in requirements:
         for module in requirement:
             rs.append(
                 Requirement.load(
                     dict(module=module,
                          relationship_match=requirement[module])))
     ability = Ability(ability_id=ability_id,
                       name=name,
                       test=test,
                       tactic=tactic,
                       technique_id=technique_id,
                       technique=technique_name,
                       code=code,
                       language=language,
                       executor=executor,
                       platform=platform,
                       description=description,
                       build_target=build_target,
                       cleanup=cleanup,
                       payloads=payloads,
                       parsers=ps,
                       requirements=rs,
                       privilege=privilege,
                       timeout=timeout,
                       repeatable=repeatable,
                       variations=variations,
                       buckets=buckets,
                       **kwargs)
     ability.access = access
     return await self.store(ability)
Example #2
0
 async def _load_executor_parsers(parsers):
     ps = []
     for module in parsers:
         ps.append(
             Parser.load(dict(module=module,
                              parserconfigs=parsers[module])))
     return ps
Example #3
0
 async def _create_ability(self,
                           ability_id,
                           tactic=None,
                           technique_name=None,
                           technique_id=None,
                           name=None,
                           test=None,
                           description=None,
                           executor=None,
                           platform=None,
                           cleanup=None,
                           payloads=None,
                           parsers=None,
                           requirements=None,
                           privilege=None,
                           timeout=60,
                           access=None,
                           buckets=None,
                           repeatable=False,
                           code=None,
                           language=None,
                           build_target=None,
                           variations=None):
     ps = []
     for module in parsers:
         pcs = [(ParserConfig(**m)) for m in parsers[module]]
         ps.append(Parser(module=module, parserconfigs=pcs))
     rs = []
     for requirement in requirements:
         for module in requirement:
             relation = [
                 Relationship(source=r['source'],
                              edge=r.get('edge'),
                              target=r.get('target'))
                 for r in requirement[module]
             ]
             rs.append(Requirement(module=module, relationships=relation))
     ability = Ability(ability_id=ability_id,
                       name=name,
                       test=test,
                       tactic=tactic,
                       technique_id=technique_id,
                       technique=technique_name,
                       code=code,
                       language=language,
                       executor=executor,
                       platform=platform,
                       description=description,
                       build_target=build_target,
                       cleanup=cleanup,
                       payloads=payloads,
                       parsers=ps,
                       requirements=rs,
                       privilege=privilege,
                       timeout=timeout,
                       repeatable=repeatable,
                       variations=variations,
                       buckets=buckets)
     ability.access = access
     return await self.store(ability)
Example #4
0
 def from_json(cls, json):
     parsers = [Parser.from_json(p) for p in json['parsers']]
     requirements = [Requirement.from_json(r) for r in json['requirements']]
     return cls(ability_id=json['ability_id'], tactic=json['tactic'], technique_id=json['technique_id'],
                technique=json['technique_name'], name=json['name'], test=json['test'],
                description=json['description'], cleanup=json['cleanup'], executor=json['executor'],
                platform=json['platform'], payload=json['payload'], parsers=parsers,
                requirements=requirements, privilege=json['privilege'], timeout=json['timeout'], access=json['access'])
Example #5
0
 async def _create_ability(self,
                           ability_id,
                           tactic,
                           technique_name,
                           technique_id,
                           name,
                           test,
                           description,
                           executor,
                           platform,
                           cleanup=None,
                           payload=None,
                           parsers=None,
                           requirements=None,
                           privilege=None,
                           timeout=60):
     ps = []
     for module in parsers:
         pcs = [(ParserConfig(**m)) for m in parsers[module]]
         ps.append(Parser(module=module, parserconfigs=pcs))
     rs = []
     for requirement in requirements:
         for module in requirement:
             relation = [
                 Relationship(source=r['source'],
                              edge=r.get('edge'),
                              target=r.get('target'))
                 for r in requirement[module]
             ]
             rs.append(Requirement(module=module, relationships=relation))
     return await self.store(
         Ability(ability_id=ability_id,
                 name=name,
                 test=test,
                 tactic=tactic,
                 technique_id=technique_id,
                 technique=technique_name,
                 executor=executor,
                 platform=platform,
                 description=description,
                 cleanup=cleanup,
                 payload=payload,
                 parsers=ps,
                 requirements=rs,
                 privilege=privilege,
                 timeout=timeout))