Esempio n. 1
0
 def install(self, url):
     local_dir = os.path.join(
         get_plugin_dir(),
         os.path.basename(url).rsplit(".", maxsplit=1)[0])
     subprocess.call(["git", "clone", url, local_dir])
     subprocess.call([
         "pip", "install", "-r",
         os.path.join(local_dir, "requirements.txt")
     ])
Esempio n. 2
0
def main():
    # Load plugins
    plugin_dir = get_plugin_dir()
    sys.path.insert(0, plugin_dir)
    for plugin in sorted(os.listdir(plugin_dir)):
        plugin_path = os.path.join(plugin_dir, plugin, "__init__.py")
        print("Loading", plugin_path, "as", plugin)
        loaded = importlib.import_module(plugin)
        loaded.load(COMMANDS)
    sys.path.remove(plugin_dir)

    # Load CLI
    fire.Fire(CTFCLI)
Esempio n. 3
0
 def list(self):
     for plugin in sorted(os.listdir(get_plugin_dir())):
         print(plugin)
Esempio n. 4
0
 def dir(self):
     print(get_plugin_dir())
Esempio n. 5
0
 def uninstall(self, plugin_name):
     plugin_dir = os.path.join(get_plugin_dir(), plugin_name)
     shutil.rmtree(plugin_dir)