Modules for expansion services, import and export in MISP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
661 B

import json
import dns.resolver
mispattributes = ['hostname', 'domain']
def handler(q=False):
if q is False:
return False
request = json.loads(q)
if request.get('hostname'):
toquery = request['hostname']
elif request.get('domain'):
toquery = request['domain']
return False
r = dns.resolver.Resolver()
r.nameservers = ['']
answer = r.query(toquery, 'A')
except dns.resolver.NXDOMAIN:
return False
except dns.exception.Timeout:
return False
r = {}
r["ip-dst"] = str(answer[0])
return r
def introspection():
return mispattributes