diff --git a/monkey/common/network/network_range.py b/monkey/common/network/network_range.py index 60178a3dc..21a1fa83b 100644 --- a/monkey/common/network/network_range.py +++ b/monkey/common/network/network_range.py @@ -151,10 +151,10 @@ class SingleIpRange(NetworkRange): return self._ip_address @staticmethod - def string_to_host(string): + def string_to_host(string_): """ Converts the string that user entered in "Scan IP/subnet list" to a tuple of domain name and ip - :param string: String that was entered in "Scan IP/subnet list" + :param string_: String that was entered in "Scan IP/subnet list" :return: A tuple in format (IP, domain_name). Eg. (192.168.55.1, www.google.com) """ # The most common use case is to enter ip/range into "Scan IP/subnet list" @@ -162,16 +162,16 @@ class SingleIpRange(NetworkRange): # Try casting user's input as IP try: - ip = ipaddress.ip_address(string).exploded + ip = ipaddress.ip_address(string_).exploded except ValueError: # Exception means that it's a domain name try: - ip = socket.gethostbyname(string) - domain_name = string + ip = socket.gethostbyname(string_) + domain_name = string_ except socket.error: LOG.error("Your specified host: {} is not found as a domain name and" - " it's not an IP address".format(string)) - return None, string - # If a string was entered instead of IP we presume that it was domain name and translate it + " it's not an IP address".format(string_)) + return None, string_ + # If a string_ was entered instead of IP we presume that it was domain name and translate it return ip, domain_name diff --git a/monkey/infection_monkey/exploit/sambacry.py b/monkey/infection_monkey/exploit/sambacry.py index 16366c586..e48a21616 100644 --- a/monkey/infection_monkey/exploit/sambacry.py +++ b/monkey/infection_monkey/exploit/sambacry.py @@ -217,6 +217,7 @@ class SambaCryExploiter(HostExploiter): pattern = re.compile(r'\d*\.\d*\.\d*') smb_server_name = self.host.services[SMB_SERVICE].get('name') if not smb_server_name: + LOG.info("Host: %s refused SMB connection" % self.host.ip_addr) return False samba_version = "unknown" pattern_result = pattern.search(smb_server_name) diff --git a/monkey/infection_monkey/system_info/windows_info_collector.py b/monkey/infection_monkey/system_info/windows_info_collector.py index 9d6f6a1f2..08ca6ff29 100644 --- a/monkey/infection_monkey/system_info/windows_info_collector.py +++ b/monkey/infection_monkey/system_info/windows_info_collector.py @@ -1,6 +1,7 @@ import os import logging import sys +sys.coinit_flags = 0 # needed for proper destruction of the wmi python module import infection_monkey.config from infection_monkey.system_info.mimikatz_collector import MimikatzCollector @@ -8,9 +9,6 @@ from infection_monkey.system_info import InfoCollector from infection_monkey.system_info.wmi_consts import WMI_CLASSES from common.utils.wmi_utils import WMIUtils - -sys.coinit_flags = 0 # needed for proper destruction of the wmi python module - LOG = logging.getLogger(__name__) LOG.info('started windows info collector') diff --git a/monkey/monkey_island/cc/models/monkey.py b/monkey/monkey_island/cc/models/monkey.py index fe0745496..324903809 100644 --- a/monkey/monkey_island/cc/models/monkey.py +++ b/monkey/monkey_island/cc/models/monkey.py @@ -48,7 +48,7 @@ class Monkey(Document): @staticmethod def __ring_key__(): """ - Cash key representation + Cache key representation https://ring-cache.readthedocs.io/en/stable/quickstart.html#method-classmethod-staticmethod-property :return: """ diff --git a/monkey/monkey_island/cc/services/config_schema.py b/monkey/monkey_island/cc/services/config_schema.py index 3318783b0..32ee13b12 100644 --- a/monkey/monkey_island/cc/services/config_schema.py +++ b/monkey/monkey_island/cc/services/config_schema.py @@ -1,4 +1,4 @@ -WARNING_SIGN = " \\u26A0" +WARNING_SIGN = " \u26A0" SCHEMA = { "title": "Monkey", diff --git a/monkey/monkey_island/cc/services/edge.py b/monkey/monkey_island/cc/services/edge.py index a2023d4d2..ae3d2a2de 100644 --- a/monkey/monkey_island/cc/services/edge.py +++ b/monkey/monkey_island/cc/services/edge.py @@ -155,7 +155,7 @@ class EdgeService: else: to_label = NodeService.get_node_label(NodeService.get_node_by_id(to_id)) - RIGHT_ARROW = "\\u2192" + RIGHT_ARROW = "\u2192" return "%s %s %s" % (from_label, RIGHT_ARROW, to_label)