MCPcopy
hub / github.com/apache/caldera / AdvancedPack

Class AdvancedPack

app/api/packs/advanced.py:7–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6
7class AdvancedPack(BaseWorld):
8
9 def __init__(self, services):
10 self.app_svc = services.get('app_svc')
11 self.auth_svc = services.get('auth_svc')
12 self.contact_svc = services.get('contact_svc')
13 self.data_svc = services.get('data_svc')
14 self.rest_svc = services.get('rest_svc')
15
16 async def enable(self):
17 self.app_svc.application.router._frozen = False
18 self.app_svc.application.router.add_route('GET', '/advanced/sources', self._section_sources)
19 self.app_svc.application.router.add_route('GET', '/advanced/objectives', self._section_objectives)
20 self.app_svc.application.router.add_route('GET', '/advanced/planners', self._section_planners)
21 self.app_svc.application.router.add_route('GET', '/advanced/contacts', self._section_contacts)
22 self.app_svc.application.router.add_route('GET', '/advanced/obfuscators', self._section_obfuscators)
23 self.app_svc.application.router.add_route('GET', '/advanced/configurations', self._section_configurations)
24 self.app_svc.application.router.add_route('GET', '/advanced/exfills', self._section_exfil_files)
25
26 @check_authorization
27 @template('planners.html')
28 async def _section_planners(self, request):
29 planners = [p.display for p in await self.data_svc.locate('planners')]
30 return dict(planners=planners)
31
32 @check_authorization
33 @template('contacts.html')
34 async def _section_contacts(self, request):
35 contacts = [dict(name=c.name, description=c.description) for c in self.contact_svc.contacts]
36 return dict(contacts=contacts)
37
38 @check_authorization
39 @template('obfuscators.html')
40 async def _section_obfuscators(self, request):
41 obfuscators = [o.display for o in await self.data_svc.locate('obfuscators')]
42 return dict(obfuscators=obfuscators)
43
44 @check_authorization
45 @template('configurations.html')
46 async def _section_configurations(self, request):
47 return dict(config=self.get_config(), plugins=[p for p in await self.data_svc.locate('plugins')])
48
49 @check_authorization
50 @template('sources.html')
51 async def _section_sources(self, request):
52 access = await self.auth_svc.get_permissions(request)
53 return dict(sources=[s.display for s in await self.data_svc.locate('sources', match=dict(access=tuple(access)))])
54
55 @check_authorization
56 @template('objectives.html')
57 async def _section_objectives(self, request):
58 access = await self.auth_svc.get_permissions(request)
59 return dict(objectives=[o.display for o in await self.data_svc.locate('objectives', match=dict(access=tuple(access)))])
60
61 @check_authorization
62 @template('exfilled_files.html')
63 async def _section_exfil_files(self, request):
64 access = await self.auth_svc.get_permissions(request)

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected