From: Jason Ish Date: Thu, 28 Oct 2021 15:10:11 +0000 (-0600) Subject: index: allow custom url for embedded index update X-Git-Tag: 1.3.0rc1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd3b36d6c9f2289105822901aa044f725ff36802;p=thirdparty%2Fsuricata-update.git index: allow custom url for embedded index update --- diff --git a/suricata/update/data/update.py b/suricata/update/data/update.py index 1d05df4..e57c146 100644 --- a/suricata/update/data/update.py +++ b/suricata/update/data/update.py @@ -15,6 +15,7 @@ # 02110-1301, USA. import os.path +import sys try: from urllib2 import urlopen @@ -23,11 +24,16 @@ except: import yaml +DEFAULT_URL = "https://raw.githubusercontent.com/oisf/suricata-intel-index/master/index.yaml" + def embed_index(): """Embed a copy of the index as a Python source file. We can't use a datafile yet as there is no easy way to do with distutils.""" + if len(sys.argv) > 1: + url = sys.argv[1] + else: + url = DEFAULT_URL dist_filename = os.path.join(os.path.dirname(__file__), "index.py") - url = "https://raw.githubusercontent.com/oisf/suricata-intel-index/master/index.yaml" response = urlopen(url) index = yaml.safe_load(response.read())