From fa2d2fdec272c65be91f7009626e2df54e6e823e Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 14 Dec 2021 20:19:29 +0530 Subject: [PATCH] Agent: Add load_plugin function to IPuppet --- monkey/infection_monkey/i_puppet.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/monkey/infection_monkey/i_puppet.py b/monkey/infection_monkey/i_puppet.py index 285e32bca..6cd119ad3 100644 --- a/monkey/infection_monkey/i_puppet.py +++ b/monkey/infection_monkey/i_puppet.py @@ -4,12 +4,18 @@ from collections import namedtuple from enum import Enum from typing import Dict +from infection_monkey.puppet.plugin_type import PluginType + class PortStatus(Enum): OPEN = 1 CLOSED = 2 +class UnknownPluginError(Exception): + pass + + ExploiterResultData = namedtuple("ExploiterResultData", ["result", "info", "attempts"]) PingScanData = namedtuple("PingScanData", ["response_received", "os"]) PortScanData = namedtuple("PortScanData", ["port", "status", "banner", "service"]) @@ -18,6 +24,14 @@ PostBreachData = namedtuple("PostBreachData", ["command", "result"]) class IPuppet(metaclass=abc.ABCMeta): + @abc.abstractmethod + def load_plugin(self, plugin: object, plugin_type: PluginType) -> None: + """ + Loads a plugin into the puppet. + :param object plugin: The plugin object to load + :param PluginType plugin_type: The type of plugin being loaded + """ + @abc.abstractmethod def run_sys_info_collector(self, name: str) -> Dict: """