mirror of https://github.com/MISP/misp-modules
fix: [website.query] download
parent
230eaf8437
commit
208e1c9b0b
|
@ -179,8 +179,10 @@ def download(sid):
|
||||||
if sess:
|
if sess:
|
||||||
loc = json.loads(sess.result)
|
loc = json.loads(sess.result)
|
||||||
module = request.args.get("module")
|
module = request.args.get("module")
|
||||||
if module in loc:
|
query = request.args.get("query")
|
||||||
return jsonify(loc[module]), 200, {'Content-Disposition': f'attachment; filename={sess.query_enter.replace(".", "_")}-{module}.json'}
|
if query in loc:
|
||||||
|
if module in loc[query]:
|
||||||
|
return jsonify(loc[query][module]), 200, {'Content-Disposition': f'attachment; filename={query}-{module}.json'}
|
||||||
return {"message": "Module not in result", "toast_class": "danger-subtle"}, 400
|
return {"message": "Module not in result", "toast_class": "danger-subtle"}, 400
|
||||||
else:
|
else:
|
||||||
for s in SessionModel.sessions:
|
for s in SessionModel.sessions:
|
||||||
|
@ -188,7 +190,7 @@ def download(sid):
|
||||||
module = request.args.get("module")
|
module = request.args.get("module")
|
||||||
if module in s.result:
|
if module in s.result:
|
||||||
return jsonify(s.result[module]), 200, {'Content-Disposition': f'attachment; filename={s.query}-{module}.json'}
|
return jsonify(s.result[module]), 200, {'Content-Disposition': f'attachment; filename={s.query}-{module}.json'}
|
||||||
return {"message": "Module not in result", "toast_class": "danger-subtle"}, 400
|
return {"message": "Module not in result ", "toast_class": "danger-subtle"}, 400
|
||||||
return {"message": "Session not found", 'toast_class': "danger-subtle"}, 404
|
return {"message": "Session not found", 'toast_class': "danger-subtle"}, 404
|
||||||
return {"message": "Need to pass a module", "toast_class": "warning-subtle"}, 400
|
return {"message": "Need to pass a module", "toast_class": "warning-subtle"}, 400
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
<!-- json part -->
|
<!-- json part -->
|
||||||
<template v-if="tab_list == 'json'">
|
<template v-if="tab_list == 'json'">
|
||||||
<div class="btn-group" role="group" style="padding: 5px; margin-left: 5px; margin-top: 5px;">
|
<div class="btn-group" role="group" style="padding: 5px; margin-left: 5px; margin-top: 5px;">
|
||||||
<a class="btn btn-primary" :href="`/download/${sid}?module=${key}`" title="Download the json" >Download</a>
|
<a class="btn btn-primary" :href="`/download/${sid}?query=${key_query}&module=${key}`" title="Download the json" >Download</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="accordion-body" v-html="generateCoreFormatUI(result)[0].outerHTML"></div>
|
<div class="accordion-body" v-html="generateCoreFormatUI(result)[0].outerHTML"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue