guardicore / monkey

Infection Monkey - An open-source adversary emulation platform
https://www.guardicore.com/infectionmonkey/
GNU General Public License v3.0
6.64k stars 777 forks source link

Generalize PBA loader and use it for exploiters, fingerprint scanners and other modules #397

Closed VakarisZ closed 4 years ago

VakarisZ commented 5 years ago

Post breach actions are loaded dynamically, by getting all PBA files in the infection_monkey.post_breach.actions folder and extracting relevant classes. Post breach action loader can be generalized to load exploiters, fingerprint scanners and other modules.

Loader should be merged:

infection_monkey.post_breach.actions.__init__.py and infection_monkey.post_breach.post_breach_handler should be merged into one loader class.

Loader should be generalized:

Core method should take in:

  1. Class instance (only children of this class will be returned)
  2. File directory (where to look for files that needs to be imported)
  3. Config array reference

Core method should return:

  1. Filtered list of classes in a specified directory.

Loader's class needs to contain a default checker method that would compare class's name to the relevant config value to determine if class should be returned or not.

Loader should be applied to:

a. PBA b. Fingerprint scanners c. Exploiters

Pyinstaller hook should be updated to include all module directories.

danielguardicore commented 4 years ago

As part of #478 , wrote a loader for a. PBA b. Fingerprint scanners

danielguardicore commented 4 years ago

As part of #499 extended this loader for exploiters and with that, can close this issue.