From: Jason Ish Date: Thu, 30 Nov 2017 18:51:51 +0000 (-0600) Subject: add --now to skip the timebased check. X-Git-Tag: 1.0.0a1~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18536a3025dbc2d50ede4f52efb89f194ef81485;p=thirdparty%2Fsuricata-update.git add --now to skip the timebased check. --- diff --git a/suricata/update/main.py b/suricata/update/main.py index 102c392..9df9757 100644 --- a/suricata/update/main.py +++ b/suricata/update/main.py @@ -70,10 +70,10 @@ DEFAULT_SURICATA_VERSION = "4.0.0" # single file concatenating all input rule files together. DEFAULT_OUTPUT_RULE_FILENAME = "suricata.rules" -class InvalidConfigurationError(Exception): +class ApplicationError(Exception): pass -class ApplicationError(Exception): +class InvalidConfigurationError(ApplicationError): pass class AllRuleMatcher(object): @@ -328,7 +328,8 @@ class Fetch: def fetch(self, url): tmp_filename = self.get_tmp_filename(url) if not self.args.force and os.path.exists(tmp_filename): - if time.time() - os.stat(tmp_filename).st_mtime < (60 * 15): + if not self.args.now and \ + time.time() - os.stat(tmp_filename).st_mtime < (60 * 15): logger.info( "Last download less than 15 minutes ago. Not downloading %s.", url) @@ -1100,6 +1101,11 @@ def _main(): update_parser.add_argument("-h", "--help", action="store_true") + # Hidden argument, --now to bypass the timebased bypass of + # updating a ruleset. + update_parser.add_argument( + "--now", default=False, action="store_true", help=argparse.SUPPRESS) + # The Python 2.7 argparse module does prefix matching which can be # undesirable. Reserve some names here that would match existing # options to prevent prefix matching.