From 8c575b9d358415f2c3c80da8904503b9dcdb585a Mon Sep 17 00:00:00 2001 From: shreyamalviya Date: Wed, 19 May 2021 17:00:58 +0530 Subject: [PATCH] Import Windows specific modules only on Windows --- .../cc/environment/data_dir_generator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/environment/data_dir_generator.py b/monkey/monkey_island/cc/environment/data_dir_generator.py index 5883cf25b..9d235e307 100644 --- a/monkey/monkey_island/cc/environment/data_dir_generator.py +++ b/monkey/monkey_island/cc/environment/data_dir_generator.py @@ -1,15 +1,16 @@ import os import sys -import ntsecuritycon -import win32api -import win32con -import win32security - from monkey_island.cc.server_utils.consts import DEFAULT_DATA_DIR is_windows_os = sys.platform.startswith("win") +if is_windows_os: + import ntsecuritycon + import win32api + import win32con + import win32security + def create_data_dir(data_dir: str) -> None: if not os.path.isdir(data_dir):