forked from p15670423/monkey
Agent: Remove PBA's dependency on Plugin
This commit is contained in:
parent
db03ac3dd9
commit
196f814860
|
@ -1,31 +1,20 @@
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import infection_monkey.post_breach.actions
|
|
||||||
from common.utils.attack_utils import ScanStatus
|
from common.utils.attack_utils import ScanStatus
|
||||||
from infection_monkey.config import WormConfiguration
|
|
||||||
from infection_monkey.telemetry.attack.t1064_telem import T1064Telem
|
from infection_monkey.telemetry.attack.t1064_telem import T1064Telem
|
||||||
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
|
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
|
||||||
from infection_monkey.utils.environment import is_windows_os
|
from infection_monkey.utils.environment import is_windows_os
|
||||||
from infection_monkey.utils.plugins.plugin import Plugin
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PBA(Plugin):
|
class PBA:
|
||||||
"""
|
"""
|
||||||
Post breach action object. Can be extended to support more than command execution on target
|
Post breach action object. Can be extended to support more than command execution on target
|
||||||
machine.
|
machine.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def base_package_name():
|
|
||||||
return infection_monkey.post_breach.actions.__package__
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def base_package_file():
|
|
||||||
return infection_monkey.post_breach.actions.__file__
|
|
||||||
|
|
||||||
def __init__(self, name="unknown", linux_cmd="", windows_cmd=""):
|
def __init__(self, name="unknown", linux_cmd="", windows_cmd=""):
|
||||||
"""
|
"""
|
||||||
:param name: Name of post breach action.
|
:param name: Name of post breach action.
|
||||||
|
@ -35,14 +24,6 @@ class PBA(Plugin):
|
||||||
self.command = PBA.choose_command(linux_cmd, windows_cmd)
|
self.command = PBA.choose_command(linux_cmd, windows_cmd)
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def should_run(class_name):
|
|
||||||
"""
|
|
||||||
Decides if post breach action is enabled in config
|
|
||||||
:return: True if it needs to be ran, false otherwise
|
|
||||||
"""
|
|
||||||
return class_name in WormConfiguration.post_breach_actions
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
Runs post breach action command
|
Runs post breach action command
|
||||||
|
|
Loading…
Reference in New Issue