mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
chg: [Corrrelation UI] add 404 return
This commit is contained in:
parent
2cdec205c7
commit
ae9cd1d355
3 changed files with 36 additions and 13 deletions
|
@ -34,6 +34,20 @@ def get_all_correlation_objects():
|
||||||
'''
|
'''
|
||||||
return ['domain', 'paste']
|
return ['domain', 'paste']
|
||||||
|
|
||||||
|
def exist_object(object_type, correlation_id, type_id=None):
|
||||||
|
if object_type == 'domain':
|
||||||
|
return Domain.verify_if_domain_exist(correlation_id)
|
||||||
|
elif object_type == 'paste':
|
||||||
|
return Item.exist_item(correlation_id)
|
||||||
|
elif object_type == 'decoded':
|
||||||
|
return Decoded.exist_decoded(correlation_id)
|
||||||
|
elif object_type == 'pgp':
|
||||||
|
return Pgp.pgp._exist_corelation_field(type_id, correlation_id)
|
||||||
|
elif object_type == 'cryptocurrency':
|
||||||
|
return Cryptocurrency.cryptocurrency._exist_corelation_field(type_id, correlation_id)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def get_object_metadata(object_type, correlation_id, type_id=None):
|
def get_object_metadata(object_type, correlation_id, type_id=None):
|
||||||
if object_type == 'domain':
|
if object_type == 'domain':
|
||||||
return Domain.Domain(correlation_id).get_domain_metadata()
|
return Domain.Domain(correlation_id).get_domain_metadata()
|
||||||
|
|
|
@ -39,6 +39,9 @@ def nb_decoded_item_size(sha1_string):
|
||||||
else:
|
else:
|
||||||
return int(nb)
|
return int(nb)
|
||||||
|
|
||||||
|
def exist_decoded(sha1_string):
|
||||||
|
return r_serv_metadata.exists('metadata_hash:{}'.format(sha1_string))
|
||||||
|
|
||||||
def get_decoded_metadata(sha1_string, nb_seen=False, size=False):
|
def get_decoded_metadata(sha1_string, nb_seen=False, size=False):
|
||||||
metadata_dict = {}
|
metadata_dict = {}
|
||||||
metadata_dict['first_seen'] = r_serv_metadata.hget('metadata_hash:{}'.format(sha1_string), 'first_seen')
|
metadata_dict['first_seen'] = r_serv_metadata.hget('metadata_hash:{}'.format(sha1_string), 'first_seen')
|
||||||
|
|
|
@ -10,7 +10,7 @@ import sys
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from flask import Flask, render_template, jsonify, request, Blueprint, redirect, url_for, Response
|
from flask import Flask, render_template, jsonify, request, Blueprint, redirect, url_for, Response, abort
|
||||||
from flask_login import login_required, current_user, login_user, logout_user
|
from flask_login import login_required, current_user, login_user, logout_user
|
||||||
|
|
||||||
sys.path.append('modules')
|
sys.path.append('modules')
|
||||||
|
@ -171,18 +171,24 @@ def show_correlation():
|
||||||
correlation_names = sanitise_correlation_names(request.args.get('correlation_names'))
|
correlation_names = sanitise_correlation_names(request.args.get('correlation_names'))
|
||||||
correlation_objects = sanitise_correlation_objects(request.args.get('correlation_objects'))
|
correlation_objects = sanitise_correlation_objects(request.args.get('correlation_objects'))
|
||||||
|
|
||||||
dict_object = {"object_type": object_type, "correlation_id": correlation_id}
|
# check if correlation_id exist
|
||||||
dict_object["max_nodes"] = max_nodes
|
if not Correlate_object.exist_object(object_type, correlation_id, type_id=type_id):
|
||||||
dict_object["mode"] = mode
|
abort(404) # return 404
|
||||||
dict_object["correlation_names"] = correlation_names
|
# oject exist
|
||||||
dict_object["correlation_names_str"] = ",".join(correlation_names)
|
else:
|
||||||
dict_object["correlation_objects"] = correlation_objects
|
dict_object = {"object_type": object_type, "correlation_id": correlation_id}
|
||||||
dict_object["correlation_objects_str"] = ",".join(correlation_objects)
|
dict_object["max_nodes"] = max_nodes
|
||||||
dict_object["metadata"] = Correlate_object.get_object_metadata(object_type, correlation_id, type_id=type_id)
|
dict_object["mode"] = mode
|
||||||
if type_id:
|
dict_object["correlation_names"] = correlation_names
|
||||||
dict_object["metadata"]['type_id'] = type_id
|
dict_object["correlation_names_str"] = ",".join(correlation_names)
|
||||||
dict_object["metadata_card"] = get_card_metadata(object_type, correlation_id, type_id=type_id)
|
dict_object["correlation_objects"] = correlation_objects
|
||||||
return render_template("show_correlation.html", dict_object=dict_object, bootstrap_label=bootstrap_label)
|
dict_object["correlation_objects_str"] = ",".join(correlation_objects)
|
||||||
|
dict_object["metadata"] = Correlate_object.get_object_metadata(object_type, correlation_id, type_id=type_id)
|
||||||
|
if type_id:
|
||||||
|
dict_object["metadata"]['type_id'] = type_id
|
||||||
|
dict_object["metadata_card"] = get_card_metadata(object_type, correlation_id, type_id=type_id)
|
||||||
|
return render_template("show_correlation.html", dict_object=dict_object, bootstrap_label=bootstrap_label)
|
||||||
|
|
||||||
|
|
||||||
@correlation.route('/correlation/graph_node_json')
|
@correlation.route('/correlation/graph_node_json')
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue