forked from p15670423/monkey
Island: Use ScanEvent for typehint in ScanEventHandler
`event` gets passed to `_get_source_machine()`, which expects `ScanEvent`, not `AbstractAgentEvent`
This commit is contained in:
parent
4c026241ea
commit
0965b97d45
|
@ -4,7 +4,7 @@ from typing import Union
|
||||||
|
|
||||||
from typing_extensions import TypeAlias
|
from typing_extensions import TypeAlias
|
||||||
|
|
||||||
from common.agent_events import AbstractAgentEvent, PingScanEvent, TCPScanEvent
|
from common.agent_events import PingScanEvent, TCPScanEvent
|
||||||
from common.types import PortStatus, SocketAddress
|
from common.types import PortStatus, SocketAddress
|
||||||
from monkey_island.cc.models import CommunicationType, Machine, Node
|
from monkey_island.cc.models import CommunicationType, Machine, Node
|
||||||
from monkey_island.cc.repository import (
|
from monkey_island.cc.repository import (
|
||||||
|
@ -75,7 +75,7 @@ class ScanEventHandler:
|
||||||
self._machine_repository.upsert_machine(machine)
|
self._machine_repository.upsert_machine(machine)
|
||||||
return machine
|
return machine
|
||||||
|
|
||||||
def _get_source_node(self, event: AbstractAgentEvent) -> Node:
|
def _get_source_node(self, event: ScanEvent) -> Node:
|
||||||
machine = self._get_source_machine(event)
|
machine = self._get_source_machine(event)
|
||||||
return self._node_repository.get_node_by_machine_id(machine.id)
|
return self._node_repository.get_node_by_machine_id(machine.id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue