From ec9d3822a60de8290935671432aab4d7da1dbfb3 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Sat, 26 Feb 2022 12:55:09 +0530 Subject: [PATCH] Island: Remove logic to download 32-bit monkeys --- .../cc/resources/monkey_download.py | 48 ++----------------- .../cc/services/run_local_monkey.py | 2 +- 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/monkey/monkey_island/cc/resources/monkey_download.py b/monkey/monkey_island/cc/resources/monkey_download.py index 24e03280c..ee77091af 100644 --- a/monkey/monkey_island/cc/resources/monkey_download.py +++ b/monkey/monkey_island/cc/resources/monkey_download.py @@ -11,61 +11,23 @@ from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH logger = logging.getLogger(__name__) MONKEY_DOWNLOADS = [ - { - "type": "linux", - "machine": "x86_64", - "filename": "monkey-linux-64", - }, - { - "type": "linux", - "machine": "i686", - "filename": "monkey-linux-32", - }, - { - "type": "linux", - "machine": "i386", - "filename": "monkey-linux-32", - }, { "type": "linux", "filename": "monkey-linux-64", }, { "type": "windows", - "machine": "x86", - "filename": "monkey-windows-32.exe", - }, - { - "type": "windows", - "machine": "amd64", "filename": "monkey-windows-64.exe", }, - { - "type": "windows", - "machine": "64", - "filename": "monkey-windows-64.exe", - }, - { - "type": "windows", - "machine": "32", - "filename": "monkey-windows-32.exe", - }, - { - "type": "windows", - "filename": "monkey-windows-32.exe", - }, ] -def get_monkey_executable(host_os, machine): +def get_monkey_executable(host_os): for download in MONKEY_DOWNLOADS: - if host_os == download.get("type") and machine == download.get("machine"): - logger.info("Monkey exec found for os: {0} and machine: {1}".format(host_os, machine)) + if host_os == download.get("type"): + logger.info(f"Monkey exec found for os: {host_os}") return download - logger.warning( - "No monkey executables could be found for the host os or machine or both: host_os: {" - "0}, machine: {1}".format(host_os, machine) - ) + logger.warning(f"No monkey executables could be found for the host os: {host_os}") return None @@ -80,7 +42,7 @@ class MonkeyDownload(flask_restful.Resource): host_json = json.loads(request.data) host_os = host_json.get("os") if host_os: - result = get_monkey_executable(host_os.get("type"), host_os.get("machine")) + result = get_monkey_executable(host_os.get("type")) if result: # change resulting from new base path diff --git a/monkey/monkey_island/cc/services/run_local_monkey.py b/monkey/monkey_island/cc/services/run_local_monkey.py index ce6c98c61..4cdd89479 100644 --- a/monkey/monkey_island/cc/services/run_local_monkey.py +++ b/monkey/monkey_island/cc/services/run_local_monkey.py @@ -25,7 +25,7 @@ class LocalMonkeyRunService: @staticmethod def run_local_monkey(): # get the monkey executable suitable to run on the server - result = get_monkey_executable(platform.system().lower(), platform.machine().lower()) + result = get_monkey_executable(platform.system().lower()) if not result: return False, "OS Type not found"