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)"
|
_EXPLOITED_SERVICE = "PowerShell Remoting (WinRM)"
|
||||||
|
|
||||||
def __init__(self, host: VictimHost):
|
def __init__(self, host: VictimHost):
|
||||||
# If pypsrp will inherit root logger, it will log extensive and potentially sensitive info
|
PowershellExploiter._set_sensitive_packages_log_level_to_error()
|
||||||
logging.getLogger("pypsrp").setLevel(logging.ERROR)
|
|
||||||
logging.getLogger(spnego.__name__).setLevel(logging.ERROR)
|
|
||||||
logging.getLogger(connectionpool.__name__).setLevel(logging.ERROR)
|
|
||||||
|
|
||||||
super().__init__(host)
|
super().__init__(host)
|
||||||
self.client = None
|
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):
|
def _exploit_host(self):
|
||||||
try:
|
try:
|
||||||
self.client = self.exploit_without_credentials()
|
self.client = self.exploit_without_credentials()
|
||||||
|
|
Loading…
Reference in New Issue