Change property names. Add type hints
This commit is contained in:
parent
0044eb393b
commit
029c3bb24d
|
@ -3,8 +3,9 @@ from abc import ABCMeta, abstractproperty, abstractmethod
|
|||
from infection_monkey.config import WormConfiguration
|
||||
|
||||
|
||||
class HostFinger(object, metaclass=ABCMeta):
|
||||
@abstractproperty
|
||||
class HostFinger(metaclass=ABCMeta):
|
||||
@property
|
||||
@abstractmethod
|
||||
def _SCANNED_SERVICE(self):
|
||||
pass
|
||||
|
||||
|
@ -18,9 +19,5 @@ class HostFinger(object, metaclass=ABCMeta):
|
|||
raise NotImplementedError()
|
||||
|
||||
@staticmethod
|
||||
def should_run(class_name):
|
||||
"""
|
||||
Decides if post breach action is enabled in config
|
||||
:return: True if it needs to be ran, false otherwise
|
||||
"""
|
||||
def should_run(class_name: str) -> bool:
|
||||
return class_name in WormConfiguration.finger_classes
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
|
||||
class HostScanner(object, metaclass=ABCMeta):
|
||||
class HostScanner(metaclass=ABCMeta):
|
||||
@property
|
||||
@abstractmethod
|
||||
def is_host_alive(self, host):
|
||||
raise NotImplementedError()
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import logging
|
||||
from typing import Sequence
|
||||
from infection_monkey.utils.load_plugins import get_instances
|
||||
from infection_monkey.network.HostFinger import HostFinger
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_fingerprint_instances():
|
||||
def get_fingerprint_instances() -> Sequence[HostFinger]:
|
||||
"""
|
||||
Returns the fingerprint objects according to configuration as a list
|
||||
:return: A list of HostFinger objects.
|
||||
|
|
Loading…
Reference in New Issue