2020-07-06 16:17:54 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2020-07-21 00:31:06 +02:00
|
|
|
from generator import download, get_version, write_to_file
|
|
|
|
|
|
|
|
|
|
|
|
def process(url, dst):
|
|
|
|
warninglist = {
|
|
|
|
'name': 'TLDs as known by IANA',
|
|
|
|
'version': get_version(),
|
|
|
|
'description': 'Event contains one or more TLDs as attribute with an IDS flag set',
|
2020-07-21 13:42:50 +02:00
|
|
|
'list': [],
|
2020-07-21 00:31:06 +02:00
|
|
|
'matching_attributes': ["hostname", "domain", "domain|ip"],
|
|
|
|
'type': 'string'
|
|
|
|
}
|
|
|
|
|
2020-07-21 13:42:50 +02:00
|
|
|
r = download(url)
|
|
|
|
for tld in r.text.splitlines():
|
|
|
|
if tld.startswith('#'):
|
|
|
|
continue
|
|
|
|
warninglist['list'].append(tld)
|
|
|
|
|
2020-07-21 00:31:06 +02:00
|
|
|
write_to_file(warninglist, dst)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
tlds_url = 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt'
|
|
|
|
tlds_dst = 'tlds'
|
|
|
|
|
|
|
|
process(tlds_url, tlds_dst)
|