From 4361aa2325be7001fbbd5b394b07ee101ad35278 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 7 Feb 2022 10:23:28 -0500 Subject: [PATCH] Agent: Add IFingerprinter --- monkey/infection_monkey/i_puppet/__init__.py | 1 + .../i_puppet/i_fingerprinter.py | 27 +++++++++++++++++++ monkey/infection_monkey/i_puppet/i_puppet.py | 5 ++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 monkey/infection_monkey/i_puppet/i_fingerprinter.py diff --git a/monkey/infection_monkey/i_puppet/__init__.py b/monkey/infection_monkey/i_puppet/__init__.py index 0ba1096d1..c4e6b5b1c 100644 --- a/monkey/infection_monkey/i_puppet/__init__.py +++ b/monkey/infection_monkey/i_puppet/__init__.py @@ -9,3 +9,4 @@ from .i_puppet import ( PostBreachData, UnknownPluginError, ) +from .i_fingerprinter import IFingerprinter diff --git a/monkey/infection_monkey/i_puppet/i_fingerprinter.py b/monkey/infection_monkey/i_puppet/i_fingerprinter.py new file mode 100644 index 000000000..e6f177021 --- /dev/null +++ b/monkey/infection_monkey/i_puppet/i_fingerprinter.py @@ -0,0 +1,27 @@ +from abc import abstractmethod +from typing import Dict + +from . import FingerprintData, PingScanData, PortScanData + + +class IFingerprinter: + @abstractmethod + def get_host_fingerprint( + self, + host: str, + ping_scan_data: PingScanData, + port_scan_data: Dict[int, PortScanData], + options: Dict, + ) -> FingerprintData: + """ + Attempts to gather detailed information about a host and its services + :param str host: The domain name or IP address of a host + :param PingScanData ping_scan_data: Data retrieved from the target host via ICMP + :param Dict[int, PortScanData] port_scan_data: Data retrieved from the target host via a TCP + port scan + :param Dict options: A dictionary containing options that modify the behavior of the + fingerprinter + :return: Detailed information about the target host + :rtype: FingerprintData + """ + pass diff --git a/monkey/infection_monkey/i_puppet/i_puppet.py b/monkey/infection_monkey/i_puppet/i_puppet.py index 1908e5337..69c128e68 100644 --- a/monkey/infection_monkey/i_puppet/i_puppet.py +++ b/monkey/infection_monkey/i_puppet/i_puppet.py @@ -86,7 +86,8 @@ class IPuppet(metaclass=abc.ABCMeta): options: Dict, ) -> FingerprintData: """ - Runs a fingerprinter against a remote host + Runs a specific fingerprinter to attempt to gather detailed information about a host and its + services :param str name: The name of the fingerprinter to run :param str host: The domain name or IP address of a host :param PingScanData ping_scan_data: Data retrieved from the target host via ICMP @@ -94,7 +95,7 @@ class IPuppet(metaclass=abc.ABCMeta): port scan :param Dict options: A dictionary containing options that modify the behavior of the fingerprinter - :return: The data collected by running the fingerprinter on the specified host + :return: Detailed information about the target host :rtype: FingerprintData """