mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
fix: [MISP export] fix empty event
This commit is contained in:
parent
70802205f2
commit
9776ebb070
1 changed files with 6 additions and 3 deletions
|
@ -139,7 +139,7 @@ def objects_misp_export_post():
|
||||||
objects.append(obj)
|
objects.append(obj)
|
||||||
|
|
||||||
if invalid_obj:
|
if invalid_obj:
|
||||||
object_types = ail_objects.get_all_objects_with_subtypes_tuple()
|
object_types = ail_core.get_all_objects_with_subtypes_tuple()
|
||||||
return render_template("export_object.html", object_types=object_types,
|
return render_template("export_object.html", object_types=object_types,
|
||||||
to_export=objects, l_obj_invalid=invalid_obj)
|
to_export=objects, l_obj_invalid=invalid_obj)
|
||||||
|
|
||||||
|
@ -151,6 +151,9 @@ def objects_misp_export_post():
|
||||||
publish = request.form.get('misp_event_info', False)
|
publish = request.form.get('misp_event_info', False)
|
||||||
|
|
||||||
objs = ail_objects.get_objects(objects)
|
objs = ail_objects.get_objects(objects)
|
||||||
|
if not objs:
|
||||||
|
return create_json_response({'error': 'Empty Event, nothing to export'}, 400)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
event = misp_exporter_objects.create_event(objs, distribution=distribution, threat_level=threat_level,
|
event = misp_exporter_objects.create_event(objs, distribution=distribution, threat_level=threat_level,
|
||||||
analysis=analysis, info=info, export=export, publish=publish)
|
analysis=analysis, info=info, export=export, publish=publish)
|
||||||
|
@ -164,7 +167,7 @@ def objects_misp_export_post():
|
||||||
return send_file(io.BytesIO(event.encode()), as_attachment=True,
|
return send_file(io.BytesIO(event.encode()), as_attachment=True,
|
||||||
download_name=f'ail_export_{event_uuid}.json')
|
download_name=f'ail_export_{event_uuid}.json')
|
||||||
else:
|
else:
|
||||||
object_types = ail_objects.get_all_objects_with_subtypes_tuple()
|
object_types = ail_core.get_all_objects_with_subtypes_tuple()
|
||||||
return render_template("export_object.html", object_types=object_types,
|
return render_template("export_object.html", object_types=object_types,
|
||||||
misp_url=event['url'])
|
misp_url=event['url'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue