mirror of https://github.com/MISP/misp-modules
chg: Modified output format
parent
dcab9aa150
commit
d045cf7d5f
|
@ -87,26 +87,21 @@ def handler(q=False):
|
||||||
else:
|
else:
|
||||||
misperrors['error'] = "Unsupported attributes type"
|
misperrors['error'] = "Unsupported attributes type"
|
||||||
return misperrors
|
return misperrors
|
||||||
results = {}
|
listed = []
|
||||||
results['query'] = ip
|
info = []
|
||||||
results['date'] = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat()
|
|
||||||
results['listed'] = []
|
|
||||||
results['info'] = []
|
|
||||||
results['not_listed'] = []
|
|
||||||
for rbl in rbls:
|
for rbl in rbls:
|
||||||
ipRev = '.'.join(ip.split('.')[::-1])
|
ipRev = '.'.join(ip.split('.')[::-1])
|
||||||
query = '{}.{}'.format(ipRev, rbl)
|
query = '{}.{}'.format(ipRev, rbl)
|
||||||
try:
|
|
||||||
resolver.query(query,'A')
|
|
||||||
try:
|
try:
|
||||||
txt = resolver.query(query,'TXT')
|
txt = resolver.query(query,'TXT')
|
||||||
|
listed.append(query)
|
||||||
|
info.append(str(txt[0]))
|
||||||
except:
|
except:
|
||||||
results['listed'].append(query)
|
continue
|
||||||
results['listed'].append(query)
|
result = {}
|
||||||
results['info'].append(str(txt[0]))
|
for l, i in zip(listed, info):
|
||||||
except:
|
result[l] = i
|
||||||
results['not_listed'].append(query)
|
r = {'results': [{'types': mispattributes.get('output'), 'values': json.dumps(result)}]}
|
||||||
r = {'results': [{'types': mispattributes.get('output'), 'values': json.dumps(results)}]}
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def introspection():
|
def introspection():
|
||||||
|
|
Loading…
Reference in New Issue