Small CR fixes

This commit is contained in:
VakarisZ 2019-10-17 19:33:30 +03:00
parent e36bb9721d
commit 047191070c
6 changed files with 13 additions and 14 deletions

View File

@ -151,10 +151,10 @@ class SingleIpRange(NetworkRange):
return self._ip_address return self._ip_address
@staticmethod @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 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) :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" # 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 casting user's input as IP
try: try:
ip = ipaddress.ip_address(string).exploded ip = ipaddress.ip_address(string_).exploded
except ValueError: except ValueError:
# Exception means that it's a domain name # Exception means that it's a domain name
try: try:
ip = socket.gethostbyname(string) ip = socket.gethostbyname(string_)
domain_name = string domain_name = string_
except socket.error: except socket.error:
LOG.error("Your specified host: {} is not found as a domain name and" LOG.error("Your specified host: {} is not found as a domain name and"
" it's not an IP address".format(string)) " it's not an IP address".format(string_))
return None, string return None, string_
# If a string was entered instead of IP we presume that it was domain name and translate it # If a string_ was entered instead of IP we presume that it was domain name and translate it
return ip, domain_name return ip, domain_name

View File

@ -217,6 +217,7 @@ class SambaCryExploiter(HostExploiter):
pattern = re.compile(r'\d*\.\d*\.\d*') pattern = re.compile(r'\d*\.\d*\.\d*')
smb_server_name = self.host.services[SMB_SERVICE].get('name') smb_server_name = self.host.services[SMB_SERVICE].get('name')
if not smb_server_name: if not smb_server_name:
LOG.info("Host: %s refused SMB connection" % self.host.ip_addr)
return False return False
samba_version = "unknown" samba_version = "unknown"
pattern_result = pattern.search(smb_server_name) pattern_result = pattern.search(smb_server_name)

View File

@ -1,6 +1,7 @@
import os import os
import logging import logging
import sys import sys
sys.coinit_flags = 0 # needed for proper destruction of the wmi python module
import infection_monkey.config import infection_monkey.config
from infection_monkey.system_info.mimikatz_collector import MimikatzCollector 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 infection_monkey.system_info.wmi_consts import WMI_CLASSES
from common.utils.wmi_utils import WMIUtils 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 = logging.getLogger(__name__)
LOG.info('started windows info collector') LOG.info('started windows info collector')

View File

@ -48,7 +48,7 @@ class Monkey(Document):
@staticmethod @staticmethod
def __ring_key__(): def __ring_key__():
""" """
Cash key representation Cache key representation
https://ring-cache.readthedocs.io/en/stable/quickstart.html#method-classmethod-staticmethod-property https://ring-cache.readthedocs.io/en/stable/quickstart.html#method-classmethod-staticmethod-property
:return: :return:
""" """

View File

@ -1,4 +1,4 @@
WARNING_SIGN = " \\u26A0" WARNING_SIGN = " \u26A0"
SCHEMA = { SCHEMA = {
"title": "Monkey", "title": "Monkey",

View File

@ -155,7 +155,7 @@ class EdgeService:
else: else:
to_label = NodeService.get_node_label(NodeService.get_node_by_id(to_id)) 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) return "%s %s %s" % (from_label, RIGHT_ARROW, to_label)