mirror of
https://github.com/ail-project/ail-framework.git
synced 2025-01-31 06:26:14 +00:00
chg: [show item] show file-name and message content
This commit is contained in:
parent
18dbd0002f
commit
6248dd7bbe
3 changed files with 48 additions and 6 deletions
|
@ -149,6 +149,16 @@ class Item(AbstractObject):
|
|||
r_object.sadd(f'child:item::{self.id}', child_id)
|
||||
r_object.hset(f'meta:item::{child_id}', 'parent', self.id)
|
||||
|
||||
def get_file_name(self):
|
||||
filename = self.get_correlation('file-name').get('file-name')
|
||||
if filename:
|
||||
return filename.pop()[1:]
|
||||
|
||||
def get_message(self):
|
||||
filename = self.get_correlation('message').get('message')
|
||||
if filename:
|
||||
return filename.pop()[1:]
|
||||
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
|
||||
|
@ -271,6 +281,8 @@ class Item(AbstractObject):
|
|||
meta['crawler'] = self.get_meta_crawler(tags=tags)
|
||||
if 'duplicates' in options:
|
||||
meta['duplicates'] = self.get_duplicates()
|
||||
if 'file_name' in options:
|
||||
meta['file_name'] = self.get_file_name()
|
||||
if 'lines' in options:
|
||||
content = meta.get('content')
|
||||
meta['lines'] = self.get_meta_lines(content=content)
|
||||
|
|
|
@ -20,6 +20,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
|||
# Import Project packages
|
||||
##################################
|
||||
from lib import ConfigLoader
|
||||
from lib import chats_viewer
|
||||
from lib import item_basic
|
||||
from lib.objects.Items import Item
|
||||
from lib.objects.Screenshots import Screenshot
|
||||
|
@ -68,7 +69,15 @@ def showItem(): # # TODO: support post
|
|||
abort(404)
|
||||
|
||||
item = Item(item_id)
|
||||
meta = item.get_meta(options={'content', 'crawler', 'duplicates', 'investigations', 'lines', 'size'})
|
||||
meta = item.get_meta(options={'content', 'crawler', 'duplicates', 'file_name', 'investigations', 'lines', 'size'})
|
||||
if meta['file_name']:
|
||||
message = chats_viewer.api_get_message(item.get_message())
|
||||
if message[1] == 200:
|
||||
message = message[0]
|
||||
else:
|
||||
message = None
|
||||
else:
|
||||
message = None
|
||||
|
||||
meta['name'] = meta['id'].replace('/', ' / ')
|
||||
meta['father'] = item_basic.get_item_parent(item_id)
|
||||
|
@ -95,7 +104,7 @@ def showItem(): # # TODO: support post
|
|||
return render_template("show_item.html", bootstrap_label=bootstrap_label,
|
||||
modal_add_tags=Tag.get_modal_add_tags(meta['id'], object_type='item'),
|
||||
is_hive_connected=False,
|
||||
meta=meta,
|
||||
meta=meta, message=message,
|
||||
extracted=extracted, extracted_matches=extracted_matches)
|
||||
|
||||
# kvrocks data
|
||||
|
|
|
@ -499,9 +499,14 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-info btn-sm" type="button" data-toggle="collapse" data-target="#collapseextracted{{ loop.index }}">
|
||||
<i class="fa-solid fa-caret-up"></i>
|
||||
</button>
|
||||
<div class="collapse show" id="collapseextracted{{ loop.index }}">
|
||||
{% for row in extracted_matches[match]['matches'] %}
|
||||
<a href="#{{ row[0] }}:{{row[1] }}">{{ row[2] }}</a><br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -515,7 +520,23 @@
|
|||
{% endif %}
|
||||
|
||||
|
||||
<!-- nav-pills nav-justified nav-tabs-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Message and Filename -->
|
||||
{% if meta['file_name'] %}
|
||||
<div class="position-relative">
|
||||
<div class="chat-messages p-2">
|
||||
{% with message=message %}
|
||||
{% include 'chats_explorer/block_message.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body pt-0 py-1 px-2">
|
||||
|
|
Loading…
Add table
Reference in a new issue