From def5d9802f375b1ba9da443d8a889c175e2bdd3f Mon Sep 17 00:00:00 2001 From: Martin Herkt Date: Fri, 27 Oct 2017 02:21:33 +0200 Subject: [PATCH] Add querybl command to query uploads by addresses in blacklist --- fhost.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fhost.py b/fhost.py index 5e35104..31a3703 100755 --- a/fhost.py +++ b/fhost.py @@ -438,5 +438,16 @@ def queryaddr(a): for f in res: query(su.enbase(f.id, 1)) +@manager.command +def querybl(): + if os.path.isfile(app.config["FHOST_UPLOAD_BLACKLIST"]): + with open(app.config["FHOST_UPLOAD_BLACKLIST"], "r") as bl: + for l in bl.readlines(): + if not l.startswith("#"): + if not ":" in l: + queryaddr("::ffff:" + l.rstrip()) + else: + queryaddr(l.strip()) + if __name__ == "__main__": manager.run()