forked from p15670423/monkey
Island: Subscribe to Ping and TCP scan events with ScanEventHandlers
This commit is contained in:
parent
2686a7a4ee
commit
8002080c8b
|
@ -1,3 +1,4 @@
|
|||
from .handle_ping_scan_event import handle_ping_scan_event
|
||||
from .save_event_to_event_repository import save_event_to_event_repository
|
||||
from .save_stolen_credentials_to_repository import save_stolen_credentials_to_repository
|
||||
from .scan_event_handler import ScanEventHandler
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from common import DIContainer
|
||||
from common.agent_events import CredentialsStolenEvent, PingScanEvent
|
||||
from common.agent_events import CredentialsStolenEvent, PingScanEvent, TCPScanEvent
|
||||
from common.event_queue import IAgentEventQueue
|
||||
from monkey_island.cc.agent_event_handlers import (
|
||||
handle_ping_scan_event,
|
||||
ScanEventHandler,
|
||||
save_event_to_event_repository,
|
||||
save_stolen_credentials_to_repository,
|
||||
)
|
||||
|
@ -17,7 +17,7 @@ from monkey_island.cc.repository import (
|
|||
|
||||
def setup_agent_event_handlers(container: DIContainer):
|
||||
_subscribe_and_store_to_event_repository(container)
|
||||
_subscribe_ping_scan_event(container)
|
||||
_subscribe_scan_events(container)
|
||||
|
||||
|
||||
def _subscribe_and_store_to_event_repository(container: DIContainer):
|
||||
|
@ -32,12 +32,13 @@ def _subscribe_and_store_to_event_repository(container: DIContainer):
|
|||
agent_event_queue.subscribe_type(CredentialsStolenEvent, save_stolen_credentials_subscriber)
|
||||
|
||||
|
||||
def _subscribe_ping_scan_event(container: DIContainer):
|
||||
def _subscribe_scan_events(container: DIContainer):
|
||||
agent_event_queue = container.resolve(IAgentEventQueue)
|
||||
agent_repository = container.resolve(IAgentRepository)
|
||||
machine_repository = container.resolve(IMachineRepository)
|
||||
node_repository = container.resolve(INodeRepository)
|
||||
|
||||
handler = handle_ping_scan_event(agent_repository, machine_repository, node_repository)
|
||||
scan_event_handler = ScanEventHandler(agent_repository, machine_repository, node_repository)
|
||||
|
||||
agent_event_queue.subscribe_type(PingScanEvent, handler)
|
||||
agent_event_queue.subscribe_type(PingScanEvent, scan_event_handler.handle_ping_scan_event)
|
||||
agent_event_queue.subscribe_type(TCPScanEvent, scan_event_handler.handle_tcp_scan_event)
|
||||
|
|
Loading…
Reference in New Issue