Agent: Create a concrete puppet class

This commit is contained in:
Shreya Malviya 2021-12-14 20:31:19 +05:30 committed by Mike Salvatore
parent 0e368fbfe9
commit ffb2da02a3
2 changed files with 58 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import abc
import threading
from collections import namedtuple
from enum import Enum
from typing import Dict
from typing import Dict, Tuple
from infection_monkey.puppet.plugin_type import PluginType
@ -105,7 +105,9 @@ class IPuppet(metaclass=abc.ABCMeta):
"""
@abc.abstractmethod
def run_payload(self, name: str, options: Dict, interrupt: threading.Event) -> None:
def run_payload(
self, name: str, options: Dict, interrupt: threading.Event
) -> Tuple[None, bool, str]:
"""
Runs a payload
:param str name: The name of the payload to run

View File

@ -0,0 +1,54 @@
import logging
import threading
from typing import Dict, Tuple
from infection_monkey.i_puppet import (
ExploiterResultData,
FingerprintData,
IPuppet,
PingScanData,
PortScanData,
PostBreachData,
)
from infection_monkey.puppet.plugin_type import PluginType
logger = logging.getLogger()
class Puppet(IPuppet):
def load_plugin(self, plugin: object, plugin_type: PluginType) -> None:
pass
def run_sys_info_collector(self, name: str) -> Dict:
pass
def run_pba(self, name: str, options: Dict) -> PostBreachData:
pass
def ping(self, host: str, timeout: float = 1) -> PingScanData:
pass
def scan_tcp_port(self, host: str, port: int, timeout: float = 3) -> PortScanData:
pass
def fingerprint(
self,
name: str,
host: str,
ping_scan_data: PingScanData,
port_scan_data: Dict[int, PortScanData],
) -> FingerprintData:
pass
def exploit_host(
self, name: str, host: str, options: Dict, interrupt: threading.Event
) -> ExploiterResultData:
pass
def run_payload(
self, name: str, options: Dict, interrupt: threading.Event
) -> Tuple[None, bool, str]:
pass
def cleanup(self) -> None:
pass