guardicore / monkey

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

Isolated plugin research #2512

Closed mssalvatore closed 1 year ago

mssalvatore commented 1 year ago

Spike

Objective

Infection Monkey needs to support plugins that have conflicting dependencies. Determine if there's an existing plugin framework or other solution that makes this possible, or develop a plan and prototype for achieving this.

Scope

cakekoa commented 1 year ago

A number of plugin frameworks exist, but none that address conflicting dependencies from plugins



We could probably use any framework as long as the plugins handle loading of the dependencies themselves, e.g., by “vendoring” dependencies



Other option: Use setup tools to install the plugin and complain about dependency problems 

 



Either way, the dependencies are pushed to the plugins, but the first option would allow otherwise conflicting dependencies to exist in different plugins

cakekoa commented 1 year ago

A project called python-localimport provides a context manager that allows importing from a directory

PEP582 proposes the use of a __pypackages__ directory which is automatically activated for .py files, but would only work for the script that is executed. The pythonloc and piploc executables support this PEP

A comment on a QGIS issue outlines one approach to venturing dependencies

cakekoa commented 1 year ago

Due to the way that python's importer imports modules, it appears that the following three methods are viable solutions:

A little bit about importing:

cakekoa commented 1 year ago

We have a promising prototype in progress, but it needs the following improvements: