chg: Modified output format

pull/150/head
chrisr3d 2018-01-16 19:46:52 +01:00
parent dcab9aa150
commit d045cf7d5f
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 10 additions and 15 deletions

View File

@ -87,26 +87,21 @@ def handler(q=False):
else:
misperrors['error'] = "Unsupported attributes type"
return misperrors
results = {}
results['query'] = ip
results['date'] = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat()
results['listed'] = []
results['info'] = []
results['not_listed'] = []
listed = []
info = []
for rbl in rbls:
ipRev = '.'.join(ip.split('.')[::-1])
query = '{}.{}'.format(ipRev, rbl)
try:
resolver.query(query,'A')
try:
txt = resolver.query(query, 'TXT')
txt = resolver.query(query,'TXT')
listed.append(query)
info.append(str(txt[0]))
except:
results['listed'].append(query)
results['listed'].append(query)
results['info'].append(str(txt[0]))
except:
results['not_listed'].append(query)
r = {'results': [{'types': mispattributes.get('output'), 'values': json.dumps(results)}]}
continue
result = {}
for l, i in zip(listed, info):
result[l] = i
r = {'results': [{'types': mispattributes.get('output'), 'values': json.dumps(result)}]}
return r
def introspection():