Island: Add resource for /api/machines endpoint

This commit is contained in:
Kekoa Kaaikala 2022-09-30 17:18:35 +00:00
parent 0516e1e015
commit eeca5fbea2
2 changed files with 17 additions and 0 deletions

View File

@ -12,3 +12,4 @@ from .agent_events import AgentEvents
from .agents import Agents
from .agent_signals import AgentSignals, TerminateAllAgents
from .agent_logs import AgentLogs
from .machines import Machines

View File

@ -0,0 +1,16 @@
from http import HTTPStatus
from monkey_island.cc.repository import IMachineRepository
from monkey_island.cc.resources.AbstractResource import AbstractResource
from monkey_island.cc.resources.request_authentication import jwt_required
class Machines(AbstractResource):
urls = ["/api/machines"]
def __init__(self, machine_repository: IMachineRepository):
self._machine_repository = machine_repository
@jwt_required
def get(self):
return self._machine_repository.get_machines(), HTTPStatus.OK