misp-warninglists/tools/generate-university-domain-...

28 lines
896 B
Python
Raw Normal View History

#!/usr/bin/env python3
import requests
import datetime
import json
json_output=dict()
json_output['type']="hostname"
json_output['name']="University domains"
json_output['matching_attributes']=['hostname','domain','url','domain|ip']
json_output['version']= int(datetime.date.today().strftime('%Y%m%d'))
json_output['description']="List of University domains from https://raw.githubusercontent.com/Hipo/university-domains-list/master/world_universities_and_domains.json"
json_output['list']=list()
url="https://raw.githubusercontent.com/Hipo/university-domains-list/master/world_universities_and_domains.json"
university_list_file=requests.get(url)
university_list_json=university_list_file.json()
for university in university_list_json:
for domain in university.get('domains'):
2019-03-01 22:29:19 +01:00
if domain not in json_output['list']:
json_output['list'].append(domain)
2019-03-01 22:29:19 +01:00
print(json.dumps(json_output))