forked from p34709852/monkey
Agent: Remove dependency on SMBFingerprinter from SMBExploiter
This commit is contained in:
parent
df24d4ab6a
commit
eddb9d527f
|
@ -7,8 +7,6 @@ from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||||
from infection_monkey.exploit.tools.helpers import get_agent_dest_path
|
from infection_monkey.exploit.tools.helpers import get_agent_dest_path
|
||||||
from infection_monkey.exploit.tools.smb_tools import SmbTools
|
from infection_monkey.exploit.tools.smb_tools import SmbTools
|
||||||
from infection_monkey.model import DROPPER_CMDLINE_DETACHED_WINDOWS, MONKEY_CMDLINE_DETACHED_WINDOWS
|
from infection_monkey.model import DROPPER_CMDLINE_DETACHED_WINDOWS, MONKEY_CMDLINE_DETACHED_WINDOWS
|
||||||
from infection_monkey.network.tools import check_tcp_port
|
|
||||||
from infection_monkey.network_scanning.smbfinger import SMBFinger
|
|
||||||
from infection_monkey.telemetry.attack.t1035_telem import T1035Telem
|
from infection_monkey.telemetry.attack.t1035_telem import T1035Telem
|
||||||
from infection_monkey.utils.brute_force import generate_brute_force_combinations
|
from infection_monkey.utils.brute_force import generate_brute_force_combinations
|
||||||
from infection_monkey.utils.commands import build_monkey_commandline
|
from infection_monkey.utils.commands import build_monkey_commandline
|
||||||
|
@ -29,22 +27,6 @@ class SMBExploiter(HostExploiter):
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
super(SMBExploiter, self).__init__(host)
|
super(SMBExploiter, self).__init__(host)
|
||||||
|
|
||||||
def is_os_supported(self):
|
|
||||||
if super(SMBExploiter, self).is_os_supported():
|
|
||||||
return True
|
|
||||||
|
|
||||||
if not self.host.os.get("type"):
|
|
||||||
is_smb_open, _ = check_tcp_port(self.host.ip_addr, 445)
|
|
||||||
if is_smb_open:
|
|
||||||
smb_finger = SMBFinger()
|
|
||||||
smb_finger.get_host_fingerprint(self.host)
|
|
||||||
else:
|
|
||||||
is_nb_open, _ = check_tcp_port(self.host.ip_addr, 139)
|
|
||||||
if is_nb_open:
|
|
||||||
self.host.os["type"] = "windows"
|
|
||||||
return self.host.os.get("type") in self._TARGET_OS_TYPE
|
|
||||||
return False
|
|
||||||
|
|
||||||
def _exploit_host(self):
|
def _exploit_host(self):
|
||||||
agent_binary = self.agent_repository.get_agent_binary(self.host.os["type"])
|
agent_binary = self.agent_repository.get_agent_binary(self.host.os["type"])
|
||||||
dest_path = get_agent_dest_path(self.host, self.options)
|
dest_path = get_agent_dest_path(self.host, self.options)
|
||||||
|
|
Loading…
Reference in New Issue