2019-03-01 19:02:59 +01:00
|
|
|
#!/usr/bin/env python3
|
2020-07-21 00:31:06 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2019-03-01 19:02:59 +01:00
|
|
|
|
2020-07-27 10:44:30 +02:00
|
|
|
from generator import download_to_file, get_version, write_to_file, get_abspath_source_file
|
2020-07-21 00:31:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
def process(files, dst):
|
|
|
|
|
|
|
|
warninglist = {
|
|
|
|
'type': "string",
|
|
|
|
'matching_attributes': ["hostname", "domain", "ip-dst", "ip-src", "url", "domain|ip"],
|
|
|
|
'name': "CRL Warninglist",
|
|
|
|
'version': get_version(),
|
|
|
|
'description': "CRL Warninglist from threatstop (https://github.com/threatstop/crl-ocsp-whitelist/)",
|
|
|
|
'list': []
|
|
|
|
}
|
|
|
|
|
|
|
|
for file in files:
|
2020-07-27 10:44:30 +02:00
|
|
|
with open(get_abspath_source_file(file), 'r') as f:
|
2020-07-21 00:31:06 +02:00
|
|
|
ips = f.readlines()
|
|
|
|
for ip in ips:
|
|
|
|
warninglist['list'].append(ip.strip())
|
|
|
|
|
|
|
|
write_to_file(warninglist, dst)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
crl_ip_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']
|
|
|
|
crl_ip_dst = 'crl-ip-hostname'
|
|
|
|
|
|
|
|
to_process = list()
|
|
|
|
|
|
|
|
for uri in uri_list:
|
|
|
|
url = crl_ip_base_url + uri
|
2020-07-21 09:13:15 +02:00
|
|
|
file = 'ocsp_{}'.format(uri)
|
2020-07-21 00:31:06 +02:00
|
|
|
download_to_file(url, file)
|
|
|
|
to_process.append(file)
|
|
|
|
|
|
|
|
process(to_process, crl_ip_dst)
|