forked from p15670423/monkey
Agent: Fix VictimHost mypy issues
This commit is contained in:
parent
9c0ea39b6d
commit
63fcea39ed
|
@ -10,7 +10,7 @@ class VictimHost(object):
|
|||
self.os: Dict[str, Any] = {}
|
||||
self.services: Dict[str, Any] = {}
|
||||
self.icmp = False
|
||||
self.default_server = None
|
||||
self.default_server = ""
|
||||
|
||||
def as_dict(self):
|
||||
return self.__dict__
|
||||
|
|
|
@ -13,7 +13,7 @@ def mock_get_interface_to_target(monkeypatch):
|
|||
|
||||
def test_factory_no_tunnel():
|
||||
factory = VictimHostFactory(island_ip="192.168.56.1", island_port="5000", on_island=False)
|
||||
network_address = NetworkAddress("192.168.56.2", None)
|
||||
network_address = NetworkAddress("192.168.56.2", "")
|
||||
|
||||
victim = factory.build_victim_host(network_address)
|
||||
|
||||
|
@ -49,4 +49,4 @@ def test_factory_no_default_server():
|
|||
|
||||
victim = factory.build_victim_host(network_address)
|
||||
|
||||
assert victim.default_server is None
|
||||
assert not victim.default_server
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import json
|
||||
from typing import Iterable
|
||||
|
||||
import pytest
|
||||
|
||||
from infection_monkey.exploit.sshexec import SSHExploiter
|
||||
from infection_monkey.i_puppet.i_puppet import ExploiterResultData
|
||||
from infection_monkey.model.host import VictimHost
|
||||
from infection_monkey.telemetry.exploit_telem import ExploitTelem
|
||||
from monkey.infection_monkey.i_puppet.i_puppet import ExploiterResultData
|
||||
|
||||
DOMAIN_NAME = "domain-name"
|
||||
IP = "0.0.0.0"
|
||||
|
@ -16,7 +17,7 @@ HOST_AS_DICT = {
|
|||
"os": {},
|
||||
"services": {},
|
||||
"icmp": False,
|
||||
"default_server": None,
|
||||
"default_server": "",
|
||||
}
|
||||
EXPLOITER_NAME = "SSHExploiter"
|
||||
EXPLOITER_INFO = {
|
||||
|
@ -27,7 +28,7 @@ EXPLOITER_INFO = {
|
|||
"vulnerable_ports": [],
|
||||
"executed_cmds": [],
|
||||
}
|
||||
EXPLOITER_ATTEMPTS = []
|
||||
EXPLOITER_ATTEMPTS: Iterable = []
|
||||
RESULT = False
|
||||
OS_LINUX = "linux"
|
||||
ERROR_MSG = "failed because yolo"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
from typing import Any, Dict
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -14,9 +15,9 @@ HOST_AS_DICT = {
|
|||
"os": {},
|
||||
"services": {},
|
||||
"icmp": False,
|
||||
"default_server": None,
|
||||
"default_server": "",
|
||||
}
|
||||
HOST_SERVICES = {}
|
||||
HOST_SERVICES: Dict[str, Any] = {}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -18,7 +18,7 @@ SCAN_DATA_MOCK = [
|
|||
},
|
||||
},
|
||||
"monkey_exe": None,
|
||||
"default_server": None,
|
||||
"default_server": "",
|
||||
},
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue