forked from p15670423/monkey
Island: Add resource for /api/machines endpoint
This commit is contained in:
parent
0516e1e015
commit
eeca5fbea2
|
@ -12,3 +12,4 @@ from .agent_events import AgentEvents
|
||||||
from .agents import Agents
|
from .agents import Agents
|
||||||
from .agent_signals import AgentSignals, TerminateAllAgents
|
from .agent_signals import AgentSignals, TerminateAllAgents
|
||||||
from .agent_logs import AgentLogs
|
from .agent_logs import AgentLogs
|
||||||
|
from .machines import Machines
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue