Merge pull request #151 from JakubOnderka/tlds-update

Update TLDs list
pull/153/head
Alexandre Dulaunoy 2020-07-08 07:23:18 +02:00 committed by GitHub
commit 1acdef286a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 287 additions and 40 deletions

File diff suppressed because it is too large Load Diff

27
tools/generate-tlds.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import json
import datetime
url = 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt'
r = requests.get(url)
tlds = []
for tld in r.text.splitlines():
if tld.startswith('#'):
continue
tlds.append(tld)
warninglist = {
'name': 'TLDs as known by IANA',
'version': int(datetime.date.today().strftime('%Y%m%d')),
'description': 'Event contains one or more TLDs as attribute with an IDS flag set',
'list': sorted(set(tlds)),
'matching_attributes': ["hostname", "domain", "domain|ip"],
'type': 'string',
}
with open('../lists/tlds/list.json', 'w') as data_file:
json.dump(warninglist, data_file, indent=2, sort_keys=True)
data_file.write("\n")