forked from p15670423/monkey
agent: Add separate function to set log levels for sensitive packages in powershell exploiter
This commit is contained in:
parent
dc4a5fbb85
commit
04125e5e14
|
@ -31,14 +31,18 @@ class PowershellExploiter(HostExploiter):
|
|||
_EXPLOITED_SERVICE = "PowerShell Remoting (WinRM)"
|
||||
|
||||
def __init__(self, host: VictimHost):
|
||||
# If pypsrp will inherit root logger, it will log extensive and potentially sensitive info
|
||||
logging.getLogger("pypsrp").setLevel(logging.ERROR)
|
||||
logging.getLogger(spnego.__name__).setLevel(logging.ERROR)
|
||||
logging.getLogger(connectionpool.__name__).setLevel(logging.ERROR)
|
||||
PowershellExploiter._set_sensitive_packages_log_level_to_error()
|
||||
|
||||
super().__init__(host)
|
||||
self.client = None
|
||||
|
||||
@staticmethod
|
||||
def _set_sensitive_packages_log_level_to_error():
|
||||
# If root logger is inherited, extensive and potentially sensitive info could be logged
|
||||
sensitive_packages = [pypsrp, spnego, connectionpool]
|
||||
for package in sensitive_packages:
|
||||
logging.getLogger(package.__name__).setLevel(logging.ERROR)
|
||||
|
||||
def _exploit_host(self):
|
||||
try:
|
||||
self.client = self.exploit_without_credentials()
|
||||
|
|
Loading…
Reference in New Issue