From: Michael Tremer Date: Wed, 6 Aug 2025 14:12:14 +0000 (+0100) Subject: suricata-reporter: Read a configuration file X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=990ba3634f1509c4fa31e53dea96346bb3ba9af4;p=ipfire-2.x.git suricata-reporter: Read a configuration file Signed-off-by: Michael Tremer --- diff --git a/config/suricata/suricata-reporter b/config/suricata/suricata-reporter index d5d8201b6..0aed5e3de 100644 --- a/config/suricata/suricata-reporter +++ b/config/suricata/suricata-reporter @@ -21,6 +21,7 @@ import argparse import asyncio +import configparser import datetime import email.message import email.utils @@ -54,7 +55,11 @@ class Reporter(object): """ This is the main class that handles all the things... """ - def __init__(self): + def __init__(self, config): + # Parse the configuration file + self.config = configparser.ConfigParser() + self.config.read(config) + # Fetch CPU count cpu_count = multiprocessing.cpu_count() @@ -374,6 +379,8 @@ async def main(): # Command Line Arguments parser.add_argument("--verbose", "-v", action="count", help="Be more verbose") + parser.add_argument("--config", "-c", + help="Configuration File", default="/etc/suricata/reporter.conf") # Parse command line arguments args = parser.parse_args() @@ -390,7 +397,7 @@ async def main(): setup_logging(loglevel=loglevel) # Create the repoert - reporter = Reporter() + reporter = Reporter(args.config) # Run! await reporter.run()