forked from p15670423/monkey
PBA created after we check if it's going to run
This commit is contained in:
parent
c9a313b90f
commit
b5b2fd7c0e
|
@ -58,8 +58,15 @@ class UsersPBA(PBA):
|
||||||
UsersPBA.download_pba_file(get_monkey_dir_path(), self.filename)
|
UsersPBA.download_pba_file(get_monkey_dir_path(), self.filename)
|
||||||
return super(UsersPBA, self)._execute_default()
|
return super(UsersPBA, self)._execute_default()
|
||||||
|
|
||||||
def should_run(self, class_name):
|
@staticmethod
|
||||||
return self.command
|
def should_run(class_name):
|
||||||
|
if not is_windows_os():
|
||||||
|
if WormConfiguration.PBA_linux_filename or WormConfiguration.custom_PBA_linux_cmd:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if WormConfiguration.PBA_windows_filename or WormConfiguration.custom_PBA_windows_cmd:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def download_pba_file(dst_dir, filename):
|
def download_pba_file(dst_dir, filename):
|
||||||
|
|
|
@ -30,7 +30,8 @@ class PBA(object):
|
||||||
"""
|
"""
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def should_run(self, class_name):
|
@staticmethod
|
||||||
|
def should_run(class_name):
|
||||||
"""
|
"""
|
||||||
Decides if post breach action is enabled in config
|
Decides if post breach action is enabled in config
|
||||||
:return: True if it needs to be ran, false otherwise
|
:return: True if it needs to be ran, false otherwise
|
||||||
|
|
|
@ -45,7 +45,7 @@ class PostBreach(object):
|
||||||
if ((m[1].__module__ == module.__name__) and issubclass(m[1], PBA))]
|
if ((m[1].__module__ == module.__name__) and issubclass(m[1], PBA))]
|
||||||
# Get post breach action object from class
|
# Get post breach action object from class
|
||||||
for pba_class in pba_classes:
|
for pba_class in pba_classes:
|
||||||
pba = pba_class()
|
if pba_class.should_run(pba_class.__name__):
|
||||||
if pba.should_run(pba_class.__name__):
|
pba = pba_class()
|
||||||
pba_list.append(pba)
|
pba_list.append(pba)
|
||||||
return pba_list
|
return pba_list
|
||||||
|
|
Loading…
Reference in New Issue