Skip to content

Commit

Permalink
chg: [correlation] description: get message content + don't show etag…
Browse files Browse the repository at this point in the history
…, cookie_name and hhash by default
  • Loading branch information
Terrtia committed Mar 11, 2024
1 parent 7acac4d commit 8000985
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
8 changes: 8 additions & 0 deletions bin/lib/ail_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@

AIL_OBJECTS_WITH_SUBTYPES = {'chat', 'chat-subchannel', 'cryptocurrency', 'pgp', 'username', 'user-account'}

# TODO by object TYPE ????
AIL_OBJECTS_CORRELATIONS_DEFAULT = sorted({'chat', 'chat-subchannel', 'chat-thread', 'cve', 'cryptocurrency', 'decoded',
'domain', 'favicon', 'file-name',
'item', 'image', 'message', 'pgp', 'screenshot', 'title', 'user-account', 'username'})

def get_ail_uuid():
ail_uuid = r_serv_db.get('ail:uuid')
if not ail_uuid:
Expand Down Expand Up @@ -69,6 +74,9 @@ def get_object_all_subtypes(obj_type): # TODO Dynamic subtype
return r_object.smembers(f'all_chat:subtypes')
return []

def get_default_correlation_objects():
return AIL_OBJECTS_CORRELATIONS_DEFAULT

def get_obj_queued():
return ['item', 'image']

Expand Down
5 changes: 4 additions & 1 deletion bin/lib/objects/Images.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ def get_file_content(self):
return file_content

def get_content(self, r_type='str'):
return self.get_file_content()
if r_type == 'str':
return None
else:
return self.get_file_content()

def get_misp_object(self):
obj_attrs = []
Expand Down
9 changes: 6 additions & 3 deletions bin/lib/objects/ail_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


from lib.ConfigLoader import ConfigLoader
from lib.ail_core import get_all_objects, get_object_all_subtypes, get_objects_with_subtypes
from lib.ail_core import get_all_objects, get_object_all_subtypes, get_objects_with_subtypes, get_default_correlation_objects
from lib import correlations_engine
from lib import relationships_engine
from lib import btc_ail
Expand Down Expand Up @@ -53,13 +53,16 @@ def is_object_subtype(obj_type):
def is_valid_object_subtype(obj_type, subtype):
return subtype in get_object_all_subtypes(obj_type)

def sanitize_objs_types(objs):
def sanitize_objs_types(objs, default=False):
l_types = []
for obj in objs:
if is_valid_object_type(obj):
l_types.append(obj)
if not l_types:
l_types = get_all_objects()
if default:
l_types = get_default_correlation_objects()
else:
l_types = get_all_objects()
return l_types

#### OBJECT ####
Expand Down
7 changes: 5 additions & 2 deletions var/www/blueprints/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def show_correlation():

related_btc = bool(request.args.get('related_btc', False))

filter_types = ail_objects.sanitize_objs_types(request.args.get('filter', '').split(','))
filter_types = ail_objects.sanitize_objs_types(request.args.get('filter', '').split(','), default=True)

# check if obj_id exist
if not ail_objects.exists_obj(obj_type, subtype, obj_id):
Expand Down Expand Up @@ -206,7 +206,10 @@ def get_description():
return Response(json.dumps({"status": "error", "reason": "404 Not Found"}, indent=2, sort_keys=True), mimetype='application/json'), 404
# object exist
else:
res = ail_objects.get_object_meta(obj_type, subtype, obj_id, options={'icon', 'tags', 'tags_safe'},
options = {'icon', 'tags', 'tags_safe'}
if obj_type == 'message':
options.add('content')
res = ail_objects.get_object_meta(obj_type, subtype, obj_id, options=options,
flask_context=True)
if 'tags' in res:
res['tags'] = list(res['tags'])
Expand Down
4 changes: 3 additions & 1 deletion var/www/templates/correlation/show_correlation.html
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,9 @@ <h4><i class="fas fa-tags"></i> Tags All Objects</h4>
}
desc = desc + "</div></dd>"
} else if (key!="tags" && key!="id" && key!="img" && key!="icon" && key!="link" && key!="type") {
desc = desc + "<dt class=\"col-sm-3 px-0\">" + sanitize_text(key) + "</dt><dd class=\"col-sm-9 px-0\">" + sanitize_text(data[key]) + "</dd>"
if (data[key]) {
desc = desc + "<dt class=\"col-sm-3 px-0\">" + sanitize_text(key) + "</dt><dd class=\"col-sm-9 px-0\">" + sanitize_text(data[key]) + "</dd>"
}
}
});
desc = desc + "</dl>"
Expand Down

0 comments on commit 8000985

Please sign in to comment.