From cb79708fdae3b69718bd02dd7903d3305a89b2e6 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 2 Aug 2022 18:09:50 +0530 Subject: [PATCH] Island: Add get_file_contents() to file utils --- monkey/monkey_island/cc/server_utils/file_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/monkey/monkey_island/cc/server_utils/file_utils.py b/monkey/monkey_island/cc/server_utils/file_utils.py index 73f13e05e..10e8d5760 100644 --- a/monkey/monkey_island/cc/server_utils/file_utils.py +++ b/monkey/monkey_island/cc/server_utils/file_utils.py @@ -21,6 +21,12 @@ if is_windows_os(): import monkey_island.cc.server_utils.windows_permissions as windows_permissions +def get_file_contents(file_path: Path) -> str: + with open(file_path, "rt") as f: + file_contents = f.read() + return file_contents + + def create_secure_directory(path: Path): if not path.is_dir(): if is_windows_os():