import json import requests ''' URLhaus sample python3 code for submitting malware URLs the bulk API See https://urlhaus.abuse.ch/api/ - token (required) - anonymous (optional, default: 0) - url (required) - threat (required, supported values: malware_download) - tags (optional) ''' url = 'https://urlhaus.abuse.ch/api/' api_key = ef546a613f2686e636a5 jsonData = { 'token' : api_key, 'anonymous' : '0', 'submission' : [ { 'url' : 'http://evildomain1.tld/bad', 'threat' : 'malware_download', 'tags': [ 'Retefe', 'exe' ] }, { 'url' : 'http://itgetsworse.tld/file.exe', 'threat' : 'malware_download', 'tags': [ 'Ransomware' ] }, { 'threat' : 'malware_download', 'url' : 'http://swiss-cheese-is-the-best-cheese.tld/file.exe', } ] } headers = { "Content-Type" : "application/json" } r = requests.post(url, json=jsonData, timeout=15, headers=headers) print(r.content)