From 9d22185064b87707da963de4be469305a25675d3 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 18 Apr 2022 14:48:53 +0200 Subject: [PATCH 1/3] Island: Remove "/api/client-monkey" endpoint --- monkey/monkey_island/cc/app.py | 2 -- .../monkey_island/cc/resources/client_run.py | 24 ------------------- 2 files changed, 26 deletions(-) delete mode 100644 monkey/monkey_island/cc/resources/client_run.py diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index 792888a19..574c6c119 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -17,7 +17,6 @@ from monkey_island.cc.resources.blackbox.monkey_blackbox_endpoint import MonkeyB from monkey_island.cc.resources.blackbox.telemetry_blackbox_endpoint import ( TelemetryBlackboxEndpoint, ) -from monkey_island.cc.resources.client_run import ClientRun from monkey_island.cc.resources.configuration_export import ConfigurationExport from monkey_island.cc.resources.configuration_import import ConfigurationImport from monkey_island.cc.resources.edge import Edge @@ -123,7 +122,6 @@ def init_api_resources(api): "/api/monkey//", ) api.add_resource(LocalRun, "/api/local-monkey") - api.add_resource(ClientRun, "/api/client-monkey") api.add_resource(Telemetry, "/api/telemetry", "/api/telemetry/") api.add_resource(IslandMode, "/api/island-mode") diff --git a/monkey/monkey_island/cc/resources/client_run.py b/monkey/monkey_island/cc/resources/client_run.py deleted file mode 100644 index 4c2d02180..000000000 --- a/monkey/monkey_island/cc/resources/client_run.py +++ /dev/null @@ -1,24 +0,0 @@ -import logging - -import flask_restful -from flask import jsonify, request - -from monkey_island.cc.services.node import NodeService - -logger = logging.getLogger(__name__) - - -class ClientRun(flask_restful.Resource): - def get(self): - client_ip = request.remote_addr - if client_ip == "127.0.0.1": - monkey = NodeService.get_monkey_island_monkey() - else: - monkey = NodeService.get_monkey_by_ip(client_ip) - if monkey is not None: - is_monkey_running = not monkey["dead"] - else: - logger.info("Monkey is not running") - is_monkey_running = False - - return jsonify(is_running=is_monkey_running) From e086b62fba4d161476cbdd7429ff82c087aef01c Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 18 Apr 2022 14:49:27 +0200 Subject: [PATCH 2/3] Docs: Update FAQ island log documentation --- docs/content/FAQ/_index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/FAQ/_index.md b/docs/content/FAQ/_index.md index 5bd0bbc3f..a25039a86 100644 --- a/docs/content/FAQ/_index.md +++ b/docs/content/FAQ/_index.md @@ -185,9 +185,9 @@ The Monkey Island's log file is located in the The log enables you to see which requests were requested from the server and extra logs from the backend logic. The log will contain entries like these: ```log -2019-07-23 10:52:23,927 - wsgi.py:374 - _log() - INFO - 200 GET /api/local-monkey (10.15.1.75) 17.54ms -2019-07-23 10:52:23,989 - client_run.py:23 - get() - INFO - Monkey is not running -2019-07-23 10:52:24,027 - report.py:580 - get_domain_issues() - INFO - Domain issues generated for reporting +2022-04-18 13:48:43,914 - pywsgi.py:1226 - write() - INFO - 192.168.56.1 - - [2022-04-18 13:48:43] "GET /api/agent/download/windows HTTP/1.1" 200 21470665 0.293586 +2022-04-18 13:48:49,970 - pywsgi.py:1226 - write() - INFO - 192.168.56.1 - - [2022-04-18 13:48:49] "GET /api/island-mode HTTP/1.1" 200 128 0.003426 +2022-04-18 13:48:49,988 - report.py:355 - get_domain_issues() - INFO - Domain issues generated for reporting ``` It's also possible to change the default log level by editing `log_level` value in a [server configuration file](../../reference/server_configuration). From 38714bb1788df8a18c0fc4ec78b1f1f84c748ff2 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 18 Apr 2022 14:50:57 +0200 Subject: [PATCH 3/3] Changelog: Add entry for removal of "/api/client-monkey" endpoint --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f7998f3..efc2f2157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/). - WebLogic exploiter. #1869 - The /api/t1216-pba/download endpoint. #1864 - Island log download button from "Telemetries"(previously called "Logs") page. #1640 +- "/api/client-monkey" endpoint. #1889 ### Fixed - A bug in network map page that caused delay of telemetry log loading. #1545