From 536dae5db2f4030683d30b7cc62b20b2e6b91813 Mon Sep 17 00:00:00 2001 From: ater49 Date: Fri, 1 Mar 2019 19:02:59 +0100 Subject: [PATCH] Adding updater for crl warninglist --- tools/generate-crl-ip-list.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 tools/generate-crl-ip-list.py diff --git a/tools/generate-crl-ip-list.py b/tools/generate-crl-ip-list.py new file mode 100755 index 0000000..4c9c062 --- /dev/null +++ b/tools/generate-crl-ip-list.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +import json +import os +import requests +import datetime + +base_url="https://raw.githubusercontent.com/threatstop/crl-ocsp-whitelist/master/" +uri_list=['crl-hostnames.txt','crl-ipv4.txt','crl-ipv6.txt','ocsp-hostnames.txt','ocsp-ipv4.txt','ocsp-ipv6.txt'] +dict=dict() +dict['list']=list() +def source_read_and_add(input_file): + output_list=list() + for item in input_file: + item=item.rstrip() + output_list.append(item) + return output_list + + +for uri in uri_list: + url = base_url + uri + r=requests.get(url) + dict['list'] += source_read_and_add(r.text) + +dict['type'] = "string" +dict['matching_attributes']=["hostname","domain","ip-dst","ip-src","url", "domain|ip"] +dict['name']="CRL Warninglist" +dict['version']= int(datetime.date.today().strftime('%Y%m%d')) +dict['description']="CRL Warninglist from threatstop (https://github.com/threatstop/crl-ocsp-whitelist/)" +dict['list']=list(set(dict['list'])) + +with open('../lists/crl-ip-hostname/list.json', 'w') as dict_output: + dict_output.write(json.dumps(dict))