From bff95fa4701d53bd904e07afbfb0120c238b8a26 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 8 May 2019 17:08:48 +0300 Subject: [PATCH] Comments fixed --- .../post_breach/actions/__init__.py | 4 ++++ monkey/infection_monkey/post_breach/pba.py | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/post_breach/actions/__init__.py b/monkey/infection_monkey/post_breach/actions/__init__.py index 9bcbe4a2a..17007f1e6 100644 --- a/monkey/infection_monkey/post_breach/actions/__init__.py +++ b/monkey/infection_monkey/post_breach/actions/__init__.py @@ -3,5 +3,9 @@ import glob def get_pba_files(): + """ + Gets all files under current directory(/actions) + :return: list of all files without .py ending + """ files = glob.glob(join(dirname(__file__), "*.py")) return [basename(f)[:-3] for f in files if isfile(f) and not f.endswith('__init__.py')] diff --git a/monkey/infection_monkey/post_breach/pba.py b/monkey/infection_monkey/post_breach/pba.py index 230d8e74f..fa1f57c98 100644 --- a/monkey/infection_monkey/post_breach/pba.py +++ b/monkey/infection_monkey/post_breach/pba.py @@ -34,6 +34,15 @@ class PBA(object): @staticmethod def default_get_pba(name, pba_class, linux_cmd="", windows_cmd=""): + """ + Default get_pba() method implementation + :param name: PBA name + :param pba_class: class instance. Class's name is matched to config to determine + if corresponding field was enabled in post breach array or not. + :param linux_cmd: commands for linux + :param windows_cmd: commands for windows + :return: post breach action + """ if pba_class.__name__ in WormConfiguration.post_breach_actions: command = PBA.choose_command(linux_cmd, windows_cmd) if command: @@ -55,7 +64,6 @@ class PBA(object): def _execute_default(self): """ Default post breach command execution routine - :param command: What command to execute :return: Tuple of command's output string and boolean, indicating if it succeeded """ try: @@ -66,4 +74,10 @@ class PBA(object): @staticmethod def choose_command(linux_cmd, windows_cmd): + """ + Helper method that chooses between linux and windows commands. + :param linux_cmd: + :param windows_cmd: + :return: Command for current os + """ return windows_cmd if is_windows_os() else linux_cmd