diff --git a/monkey/infection_monkey/network/elasticfinger.py b/monkey/infection_monkey/network/elasticfinger.py index 228d4cdbe..41eabd18a 100644 --- a/monkey/infection_monkey/network/elasticfinger.py +++ b/monkey/infection_monkey/network/elasticfinger.py @@ -8,8 +8,6 @@ from requests.exceptions import Timeout, ConnectionError import infection_monkey.config import infection_monkey.network.HostFinger from common.data.network_consts import ES_SERVICE -from infection_monkey.model.host import VictimHost -import infection_monkey.network ES_PORT = 9200 ES_HTTP_TIMEOUT = 5 @@ -32,7 +30,6 @@ class ElasticFinger(infection_monkey.network.HostFinger.HostFinger): :param host: :return: Success/failure, data is saved in the host struct """ - assert isinstance(host, VictimHost) try: url = 'http://%s:%s/' % (host.ip_addr, ES_PORT) with closing(requests.get(url, timeout=ES_HTTP_TIMEOUT)) as req: diff --git a/monkey/infection_monkey/network/httpfinger.py b/monkey/infection_monkey/network/httpfinger.py index 0b1cd273e..ca5742c07 100644 --- a/monkey/infection_monkey/network/httpfinger.py +++ b/monkey/infection_monkey/network/httpfinger.py @@ -1,7 +1,5 @@ import infection_monkey.config -import infection_monkey.network import infection_monkey.network.HostFinger -from infection_monkey.model.host import VictimHost import logging LOG = logging.getLogger(__name__) @@ -22,7 +20,6 @@ class HTTPFinger(infection_monkey.network.HostFinger.HostFinger): pass def get_host_fingerprint(self, host): - assert isinstance(host, VictimHost) from requests import head from requests.exceptions import Timeout, ConnectionError from contextlib import closing diff --git a/monkey/infection_monkey/network/mssql_fingerprint.py b/monkey/infection_monkey/network/mssql_fingerprint.py index 4e7d35f26..87d08541d 100644 --- a/monkey/infection_monkey/network/mssql_fingerprint.py +++ b/monkey/infection_monkey/network/mssql_fingerprint.py @@ -3,8 +3,6 @@ import logging import socket import infection_monkey.network.HostFinger -from infection_monkey.model.host import VictimHost -import infection_monkey.network import infection_monkey.config __author__ = 'Maor Rayzin' @@ -32,7 +30,6 @@ class MSSQLFinger(infection_monkey.network.HostFinger.HostFinger): Discovered server information written to the Host info struct. True if success, False otherwise. """ - assert isinstance(host, VictimHost) # Create a UDP socket and sets a timeout sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) diff --git a/monkey/infection_monkey/network/mysqlfinger.py b/monkey/infection_monkey/network/mysqlfinger.py index 50af642b2..eef675507 100644 --- a/monkey/infection_monkey/network/mysqlfinger.py +++ b/monkey/infection_monkey/network/mysqlfinger.py @@ -3,8 +3,6 @@ import socket import infection_monkey.config import infection_monkey.network.HostFinger -from infection_monkey.model.host import VictimHost -import infection_monkey.network from infection_monkey.network.tools import struct_unpack_tracker, struct_unpack_tracker_string MYSQL_PORT = 3306 @@ -29,7 +27,6 @@ class MySQLFinger(infection_monkey.network.HostFinger.HostFinger): :param host: :return: Success/failure, data is saved in the host struct """ - assert isinstance(host, VictimHost) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(self.SOCKET_TIMEOUT) diff --git a/monkey/infection_monkey/network/ping_scanner.py b/monkey/infection_monkey/network/ping_scanner.py index 8838d17d0..899cc64b6 100644 --- a/monkey/infection_monkey/network/ping_scanner.py +++ b/monkey/infection_monkey/network/ping_scanner.py @@ -7,8 +7,6 @@ import sys import infection_monkey.config import infection_monkey.network.HostFinger import infection_monkey.network.HostScanner -from infection_monkey.model.host import VictimHost -import infection_monkey.network __author__ = 'itamar' @@ -31,7 +29,6 @@ class PingScanner(infection_monkey.network.HostScanner.HostScanner, infection_mo self._ttl_regex = re.compile(TTL_REGEX_STR, re.IGNORECASE) def is_host_alive(self, host): - assert isinstance(host, VictimHost) timeout = self._config.ping_scan_timeout if not "win32" == sys.platform: @@ -45,7 +42,6 @@ class PingScanner(infection_monkey.network.HostScanner.HostScanner, infection_mo stderr=self._devnull) def get_host_fingerprint(self, host): - assert isinstance(host, VictimHost) timeout = self._config.ping_scan_timeout if not "win32" == sys.platform: diff --git a/monkey/infection_monkey/network/smbfinger.py b/monkey/infection_monkey/network/smbfinger.py index 2e81db4b1..529c1e91a 100644 --- a/monkey/infection_monkey/network/smbfinger.py +++ b/monkey/infection_monkey/network/smbfinger.py @@ -3,9 +3,7 @@ import struct import logging from odict import odict -import infection_monkey.network import infection_monkey.network.HostFinger -from infection_monkey.model.host import VictimHost SMB_PORT = 445 SMB_SERVICE = 'tcp-445' @@ -109,7 +107,6 @@ class SMBFinger(infection_monkey.network.HostFinger.HostFinger): self._config = WormConfiguration def get_host_fingerprint(self, host): - assert isinstance(host, VictimHost) try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) diff --git a/monkey/infection_monkey/network/sshfinger.py b/monkey/infection_monkey/network/sshfinger.py index bc1484de3..cd1cd4aaf 100644 --- a/monkey/infection_monkey/network/sshfinger.py +++ b/monkey/infection_monkey/network/sshfinger.py @@ -2,8 +2,6 @@ import re import infection_monkey.config import infection_monkey.network.HostFinger -from infection_monkey.model.host import VictimHost -import infection_monkey.network from infection_monkey.network.tools import check_tcp_port SSH_PORT = 22 @@ -35,7 +33,6 @@ class SSHFinger(infection_monkey.network.HostFinger.HostFinger): break def get_host_fingerprint(self, host): - assert isinstance(host, VictimHost) for name, data in list(host.services.items()): banner = data.get('banner', '') diff --git a/monkey/infection_monkey/network/tcp_scanner.py b/monkey/infection_monkey/network/tcp_scanner.py index d50100c2b..019417eb0 100644 --- a/monkey/infection_monkey/network/tcp_scanner.py +++ b/monkey/infection_monkey/network/tcp_scanner.py @@ -2,7 +2,6 @@ from itertools import zip_longest from random import shuffle import infection_monkey.config -import infection_monkey.network import infection_monkey.network.HostFinger import infection_monkey.network.HostScanner from infection_monkey.network.tools import check_tcp_ports, tcp_port_to_service