Skip to content

protocol_interface

protocol_interface ¤

Classes:

Name Description
IProtocolManager

IProtocolManager is a class that manages protocol configurations for a given service type.

panther.plugins.protocols.protocol_interface.IProtocolManager ¤

IProtocolManager(service_type: str)

Bases: IPlugin

IProtocolManager is a class that manages protocol configurations for a given service type.

Attributes:

Name Type Description
service_config_to_test_path str

The path to the service configuration file.

service_config_to_test dict

The loaded configuration data.

Methods:

Name Description
validate_config
load_config

Loads the YAML configuration file and returns its contents as a dictionary.

Methods:

Name Description
load_config

Loads the YAML configuration file.

validate_config

Validates the configuration file.

Source code in panther/plugins/protocols/protocol_interface.py
26
27
28
29
30
31
32
33
34
def __init__(
    self,
    service_type: str,
):
    # TODO enforce
    super().__init__()
    self.service_config_to_test_path = f"panther/plugins/protocols/{service_type}/"
    self.service_config_to_test = self.load_config()
    self.validate_config()

load_config ¤

load_config() -> dict

Loads the YAML configuration file.

Source code in panther/plugins/protocols/protocol_interface.py
42
43
44
45
46
47
48
49
50
51
52
def load_config(self) -> dict:
    """
    Loads the YAML configuration file.
    """
    config_file = Path(self.service_config_to_test_path)
    if not config_file.exists():
        self.logger.error(
            f"Configuration file '{self.service_config_to_test_path}' does not exist."
        )
    with open(self.service_config_to_test_path) as f:
        return yaml.safe_load(f)

validate_config ¤

validate_config()

Validates the configuration file.

Source code in panther/plugins/protocols/protocol_interface.py
36
37
38
39
40
def validate_config(self):
    """
    Validates the configuration file.
    """
    pass