mirror of https://github.com/MISP/PyMISP
Fixed the JSON output format (\n breaks JSON loading afterwards)
parent
e86ffab5f4
commit
36cf46acd9
|
@ -19,8 +19,7 @@ def download_last(m, last, out=None):
|
|||
result = m.download_last(last)
|
||||
if out is None:
|
||||
if 'response' in result:
|
||||
for e in result['response']:
|
||||
print(json.dumps(e) + '\n')
|
||||
print(json.dumps(result['response']))
|
||||
else:
|
||||
print('No results for that time period')
|
||||
exit(0)
|
||||
|
|
|
@ -18,12 +18,10 @@ def search(m, quiet, url, controller, out=None, **kwargs):
|
|||
for e in result['response']:
|
||||
print('{}{}{}\n'.format(url, '/events/view/', e['Event']['id']))
|
||||
elif out is None:
|
||||
for e in result['response']:
|
||||
print(json.dumps(e) + '\n')
|
||||
print(json.dumps(result['response']))
|
||||
else:
|
||||
with open(out, 'w') as f:
|
||||
for e in result['response']:
|
||||
f.write(json.dumps(e) + '\n')
|
||||
f.write(json.dumps(result['response']))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -18,12 +18,10 @@ def searchall(m, search, quiet, url, out=None):
|
|||
for e in result['response']:
|
||||
print('{}{}{}\n'.format(url, '/events/view/', e['Event']['id']))
|
||||
elif out is None:
|
||||
for e in result['response']:
|
||||
print(json.dumps(e) + '\n')
|
||||
print(json.dumps(result['response']))
|
||||
else:
|
||||
with open(out, 'w') as f:
|
||||
for e in result['response']:
|
||||
f.write(json.dumps(e) + '\n')
|
||||
f.write(json.dumps(result['response']))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue