From 36ad6fc4416b8df75902ce47eb559fd58e84ca54 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Mon, 2 Sep 2019 10:08:04 +0300 Subject: [PATCH] Revert "Added post breach processing dict and extracted consts to common" This reverts commit 98764f0291d43e2450f90f1ff82013e2b7304456. --- monkey/common/data/post_breach_consts.py | 2 -- .../infection_monkey/post_breach/actions/add_user.py | 5 ++--- .../post_breach/actions/users_custom_pba.py | 3 +-- .../cc/services/telemetry/processing/post_breach.py | 10 ---------- 4 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 monkey/common/data/post_breach_consts.py diff --git a/monkey/common/data/post_breach_consts.py b/monkey/common/data/post_breach_consts.py deleted file mode 100644 index 8262757ca..000000000 --- a/monkey/common/data/post_breach_consts.py +++ /dev/null @@ -1,2 +0,0 @@ -POST_BREACH_BACKDOOR_USER = "Backdoor user" -POST_BREACH_FILE_EXECUTION = "File execution" diff --git a/monkey/infection_monkey/post_breach/actions/add_user.py b/monkey/infection_monkey/post_breach/actions/add_user.py index ce05371a6..ff7ae3a50 100644 --- a/monkey/infection_monkey/post_breach/actions/add_user.py +++ b/monkey/infection_monkey/post_breach/actions/add_user.py @@ -1,9 +1,8 @@ import datetime - -from common.data.post_breach_consts import POST_BREACH_BACKDOOR_USER from infection_monkey.post_breach.pba import PBA from infection_monkey.config import WormConfiguration + __author__ = 'danielg' LINUX_COMMANDS = ['useradd', '-M', '--expiredate', @@ -17,6 +16,6 @@ WINDOWS_COMMANDS = ['net', 'user', WormConfiguration.user_to_add, class BackdoorUser(PBA): def __init__(self): - super(BackdoorUser, self).__init__(POST_BREACH_BACKDOOR_USER, + super(BackdoorUser, self).__init__("Backdoor user", linux_cmd=' '.join(LINUX_COMMANDS), windows_cmd=WINDOWS_COMMANDS) diff --git a/monkey/infection_monkey/post_breach/actions/users_custom_pba.py b/monkey/infection_monkey/post_breach/actions/users_custom_pba.py index 468a2b29b..a388813ab 100644 --- a/monkey/infection_monkey/post_breach/actions/users_custom_pba.py +++ b/monkey/infection_monkey/post_breach/actions/users_custom_pba.py @@ -1,7 +1,6 @@ import os import logging -from common.data.post_breach_consts import POST_BREACH_FILE_EXECUTION from infection_monkey.utils import is_windows_os from infection_monkey.post_breach.pba import PBA from infection_monkey.control import ControlClient @@ -28,7 +27,7 @@ class UsersPBA(PBA): Defines user's configured post breach action. """ def __init__(self): - super(UsersPBA, self).__init__(POST_BREACH_FILE_EXECUTION) + super(UsersPBA, self).__init__("File execution") self.filename = '' if not is_windows_os(): # Add linux commands to PBA's diff --git a/monkey/monkey_island/cc/services/telemetry/processing/post_breach.py b/monkey/monkey_island/cc/services/telemetry/processing/post_breach.py index 2515c2d30..b086d5ff4 100644 --- a/monkey/monkey_island/cc/services/telemetry/processing/post_breach.py +++ b/monkey/monkey_island/cc/services/telemetry/processing/post_breach.py @@ -1,17 +1,7 @@ from monkey_island.cc.database import mongo -from common.data.post_breach_consts import * - -POST_BREACH_TELEMETRY_PROCESSING_FUNCS = { - # `lambda *args, **kwargs: None` is a no-op. - POST_BREACH_BACKDOOR_USER: lambda *args, **kwargs: None, - POST_BREACH_FILE_EXECUTION: lambda *args, **kwargs: None, -} def process_post_breach_telemetry(telemetry_json): mongo.db.monkey.update( {'guid': telemetry_json['monkey_guid']}, {'$push': {'pba_results': telemetry_json['data']}}) - - if telemetry_json["name"] in POST_BREACH_TELEMETRY_PROCESSING_FUNCS: - POST_BREACH_TELEMETRY_PROCESSING_FUNCS[telemetry_json["name"]](telemetry_json)