Island: Add events endpoint

PR #2187
Issue #2155
This commit is contained in:
ilija-lazoroski 2022-08-11 16:23:54 +02:00 committed by GitHub
parent 5558d075be
commit 956621dcf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -20,6 +20,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
- `/api/clear-simulation-data` endpoint. #2036
- `/api/registration-status` endpoint. #2149
- authentication to `/api/island/version`. #2109
- `/api/events` endpoint. #2155
### Changed
- Reset workflow. Now it's possible to delete data gathered by agents without

View File

@ -14,6 +14,7 @@ from monkey_island.cc.resources import (
AgentBinaries,
AgentConfiguration,
ClearSimulationData,
Events,
IPAddresses,
IslandLog,
PBAFileDownload,
@ -179,6 +180,8 @@ def init_restful_endpoints(api: FlaskDIWrapper):
api.add_resource(IslandLog)
api.add_resource(IPAddresses)
api.add_resource(Events)
# API Spec: These two should be the same resource, GET for download and POST for upload
api.add_resource(PBAFileDownload)
api.add_resource(PBAFileUpload)

View File

@ -8,3 +8,4 @@ from .ip_addresses import IPAddresses
from .agent_configuration import AgentConfiguration
from .pba_file_upload import PBAFileUpload, LINUX_PBA_TYPE, WINDOWS_PBA_TYPE
from .pba_file_download import PBAFileDownload
from .events import Events

View File

@ -0,0 +1,20 @@
import logging
from http import HTTPStatus
from flask import request
from monkey_island.cc.resources.AbstractResource import AbstractResource
logger = logging.getLogger(__name__)
class Events(AbstractResource):
urls = ["/api/events"]
# Agents needs this
def post(self):
event = request.json
logger.info(f"Event: {event}")
return {}, HTTPStatus.NO_CONTENT