forked from p15670423/monkey
Small CR fixes
This commit is contained in:
parent
e36bb9721d
commit
047191070c
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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:
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
WARNING_SIGN = " \\u26A0"
|
||||
WARNING_SIGN = " \u26A0"
|
||||
|
||||
SCHEMA = {
|
||||
"title": "Monkey",
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue