From 4d9125d64e6e08dc4f3fd2c2571b4fe57201b302 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Mon, 21 Aug 2023 08:56:48 +0200 Subject: [PATCH] fix: [feed] tools updated to configure export path and certificate validation --- tools/misp-feed/feed-list.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/misp-feed/feed-list.py b/tools/misp-feed/feed-list.py index 78a132855..30db368ed 100644 --- a/tools/misp-feed/feed-list.py +++ b/tools/misp-feed/feed-list.py @@ -6,13 +6,15 @@ # This tool is part of the MISP core project and released under the GNU Affero # General Public License v3.0 # -# Copyright (C) 2017 Alexandre Dulaunoy +# Copyright (C) 2017-2023 Alexandre Dulaunoy # Copyright (C) 2023 Christophe Vandeplas import json import requests default_feed = '../../app/files/feed-metadata/defaults.json' +misp_website_path = '../../../misp-website-new/content/feeds.md' +verify_certificate = False with open(default_feed) as feed_file: feedlist = json.load(feed_file) @@ -25,7 +27,7 @@ for feed in feedlist: items.append(output) # try to download the feed headers = {"Range": "bytes=0-0"} - res = requests.get(feed['Feed']['url'], headers=headers) + res = requests.get(feed['Feed']['url'], headers=headers, verify=verify_certificate) if (res.status_code >= 200 and res.status_code < 300)\ or res.status_code == 403: continue @@ -38,7 +40,7 @@ items = sorted(items, key=lambda s: s.casefold()) print("Updating misp-website feed.md file.") start_header_seen = False inserted = False -with open('../../../misp-website/content/feeds.md', 'r') as f: +with open(misp_website_path, 'r') as f: data_new = [] for line in f: if start_header_seen and line.startswith('- ') and not inserted: # first item @@ -56,5 +58,5 @@ with open('../../../misp-website/content/feeds.md', 'r') as f: start_header_seen = True -with open('../../../misp-website/content/feeds.md', 'w') as f: +with open(misp_website_path, 'w') as f: f.write('\n'.join(data_new))