misp-warninglists/tools/generate-vpn.py

27 lines
944 B
Python
Raw Normal View History

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
2021-06-12 12:13:23 +02:00
from generator import process_stream, get_version, write_to_file, consolidate_networks
2020-07-21 13:42:50 +02:00
def process(url, dst):
warninglist = {
2022-03-31 13:47:25 +02:00
'name': 'Specialized list of {} addresses belonging to common VPN providers and datacenters'.format(dst),
2020-07-21 13:42:50 +02:00
'version': get_version(),
2022-03-31 13:47:25 +02:00
'description': 'Specialized list of {} addresses belonging to common VPN providers and datacenters'.format(dst),
2021-06-12 12:13:23 +02:00
'list': consolidate_networks(process_stream(url)),
2020-07-21 13:42:50 +02:00
'type': 'cidr',
'matching_attributes': ["ip-src", "ip-dst", "domain|ip"]
}
2020-07-21 13:42:50 +02:00
write_to_file(warninglist, dst)
2020-07-21 13:42:50 +02:00
if __name__ == '__main__':
2022-03-31 13:47:25 +02:00
vpn_base_url_v4 = 'https://raw.githubusercontent.com/X4BNet/lists_vpn/main/ipv4.txt'
vpns = ['https://raw.githubusercontent.com/X4BNet/lists_vpn/main/ipv4.txt']
2022-03-31 13:47:25 +02:00
for url in vpns:
uri = url.split('/')[-1]
2022-03-31 13:47:25 +02:00
uri.split('.')[0]
2020-07-21 13:42:50 +02:00
process(url, uri)