]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
index: allow custom url for embedded index update
authorJason Ish <jason.ish@oisf.net>
Thu, 28 Oct 2021 15:10:11 +0000 (09:10 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 5 Jan 2022 20:25:21 +0000 (14:25 -0600)
suricata/update/data/update.py

index 1d05df4f3f7a96dfe01482db075b533a80abe854..e57c1469b096425b5f77b24b14d10174a6e96976 100644 (file)
@@ -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())