Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #30
Browse files Browse the repository at this point in the history
Allow disabling of installed plugins via config
  • Loading branch information
0snap authored May 27, 2020
2 parents af31180 + bb47bdf commit 83d2c9e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions threatbus/threatbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@


class ThreatBus:
def __init__(self, backbones, apps, config):
self.backbones, self.apps = backbones, apps
def __init__(self, backbones, apps, logger, config):
self.backbones = backbones
self.apps = apps
self.config = config
self.logger = logger.setup(config["logging"], "threatbus")
self.logger = logger
self.inq = Queue()

def request_snapshot(self, topic, dst_q, time_delta):
Expand Down Expand Up @@ -106,7 +107,15 @@ def main():
validate_config(config)
except Exception as e:
raise ValueError("Invalid config: {}".format(str(e)))
bus = ThreatBus(backbones.hook, apps.hook, config)

tb_logger = logger.setup(config["logging"], "threatbus")
configured_apps = set(config["plugins"]["apps"].keys())
installed_apps = set(dict(apps.list_name_plugin()).keys())
for unwanted_app in installed_apps - configured_apps:
tb_logger.info(f"Disabling installed, but unconfigured app '{unwanted_app}'")
apps.unregister(name=unwanted_app)

bus = ThreatBus(backbones.hook, apps.hook, tb_logger, config)
bus.run()


Expand Down

0 comments on commit 83d2c9e

Please sign in to comment.