forked from p34709852/monkey
Fixed bug: linux only PBA's throwing errors on Windows
This commit is contained in:
parent
55a46baced
commit
3af6fff5ca
|
@ -2,12 +2,10 @@ from common.data.post_breach_consts import POST_BREACH_SETUID_SETGID
|
|||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.post_breach.setuid_setgid.setuid_setgid import \
|
||||
get_commands_to_change_setuid_setgid
|
||||
from infection_monkey.utils.environment import is_windows_os
|
||||
|
||||
|
||||
class ChangeSetuidSetgid(PBA):
|
||||
def __init__(self):
|
||||
if not is_windows_os():
|
||||
linux_cmds = get_commands_to_change_setuid_setgid()
|
||||
super(ChangeSetuidSetgid, self).__init__(POST_BREACH_SETUID_SETGID,
|
||||
linux_cmd=' '.join(linux_cmds))
|
||||
linux_cmds = get_commands_to_change_setuid_setgid()
|
||||
super(ChangeSetuidSetgid, self).__init__(POST_BREACH_SETUID_SETGID,
|
||||
linux_cmd=' '.join(linux_cmds))
|
||||
|
|
|
@ -7,7 +7,6 @@ from infection_monkey.utils.environment import is_windows_os
|
|||
|
||||
class TrapCommand(PBA):
|
||||
def __init__(self):
|
||||
if not is_windows_os():
|
||||
linux_cmds = get_trap_commands()
|
||||
super(TrapCommand, self).__init__(POST_BREACH_TRAP_COMMAND,
|
||||
linux_cmd=linux_cmds)
|
||||
linux_cmds = get_trap_commands()
|
||||
super(TrapCommand, self).__init__(POST_BREACH_TRAP_COMMAND,
|
||||
linux_cmd=linux_cmds)
|
||||
|
|
|
@ -62,8 +62,10 @@ class PBA(Plugin):
|
|||
exec_funct = self._execute_default
|
||||
result = exec_funct()
|
||||
if self.scripts_were_used_successfully(result):
|
||||
T1064Telem(ScanStatus.USED, "Scripts were used to execute %s post breach action." % self.name).send()
|
||||
T1064Telem(ScanStatus.USED, f"Scripts were used to execute {self.name} post breach action.").send()
|
||||
PostBreachTelem(self, result).send()
|
||||
else:
|
||||
LOG.debug(f"No command available for PBA '{self.name}' on current OS, skipping.")
|
||||
|
||||
def is_script(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue