From: Jason Ish Date: Thu, 29 Feb 2024 15:40:13 +0000 (-0600) Subject: fetch: handle bare file urls not ending in .rules X-Git-Tag: 1.3.1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=712c2d4c64ba77271eb8ae4146c41bb9777c5ac2;p=thirdparty%2Fsuricata-update.git fetch: handle bare file urls not ending in .rules If a URL is a bare file, and does not end in .rules, Suricata-Update will ignore it. Such URLs might look like: - https:///1011 Ticket: #3664 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e72395..71f7d7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ https://redmine.openinfosecfoundation.org/issues/6777 - If no Suricata is found, Suricata-Update will assume version 6.0.0 instead of 4.0.0. +- Handle URLs of bare files that don't end in .rules: + https://redmine.openinfosecfoundation.org/issues/3664 ## 1.3.0 - 2023-07-07 diff --git a/suricata/update/main.py b/suricata/update/main.py index 9c29b1c..9d2e36d 100644 --- a/suricata/update/main.py +++ b/suricata/update/main.py @@ -235,6 +235,8 @@ class Fetch: # The file is not an archive, treat it as an individual file. basename = os.path.basename(filename).split("-", 1)[1] + if not basename.endswith(".rules"): + basename = "{}.rules".format(basename) files = {} files[basename] = open(filename, "rb").read() return files