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.sadd(f'child:item::{self.id}', child_id)
|
||||||
r_object.hset(f'meta:item::{child_id}', 'parent', self.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)
|
meta['crawler'] = self.get_meta_crawler(tags=tags)
|
||||||
if 'duplicates' in options:
|
if 'duplicates' in options:
|
||||||
meta['duplicates'] = self.get_duplicates()
|
meta['duplicates'] = self.get_duplicates()
|
||||||
|
if 'file_name' in options:
|
||||||
|
meta['file_name'] = self.get_file_name()
|
||||||
if 'lines' in options:
|
if 'lines' in options:
|
||||||
content = meta.get('content')
|
content = meta.get('content')
|
||||||
meta['lines'] = self.get_meta_lines(content=content)
|
meta['lines'] = self.get_meta_lines(content=content)
|
||||||
|
|
|
@ -20,6 +20,7 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
from lib import ConfigLoader
|
from lib import ConfigLoader
|
||||||
|
from lib import chats_viewer
|
||||||
from lib import item_basic
|
from lib import item_basic
|
||||||
from lib.objects.Items import Item
|
from lib.objects.Items import Item
|
||||||
from lib.objects.Screenshots import Screenshot
|
from lib.objects.Screenshots import Screenshot
|
||||||
|
@ -68,7 +69,15 @@ def showItem(): # # TODO: support post
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
item = Item(item_id)
|
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['name'] = meta['id'].replace('/', ' / ')
|
||||||
meta['father'] = item_basic.get_item_parent(item_id)
|
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,
|
return render_template("show_item.html", bootstrap_label=bootstrap_label,
|
||||||
modal_add_tags=Tag.get_modal_add_tags(meta['id'], object_type='item'),
|
modal_add_tags=Tag.get_modal_add_tags(meta['id'], object_type='item'),
|
||||||
is_hive_connected=False,
|
is_hive_connected=False,
|
||||||
meta=meta,
|
meta=meta, message=message,
|
||||||
extracted=extracted, extracted_matches=extracted_matches)
|
extracted=extracted, extracted_matches=extracted_matches)
|
||||||
|
|
||||||
# kvrocks data
|
# kvrocks data
|
||||||
|
|
|
@ -499,9 +499,14 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% for row in extracted_matches[match]['matches'] %}
|
<button class="btn btn-info btn-sm" type="button" data-toggle="collapse" data-target="#collapseextracted{{ loop.index }}">
|
||||||
<a href="#{{ row[0] }}:{{row[1] }}">{{ row[2] }}</a><br>
|
<i class="fa-solid fa-caret-up"></i>
|
||||||
{% endfor %}
|
</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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -515,7 +520,23 @@
|
||||||
{% endif %}
|
{% 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">
|
||||||
<div class="card-body pt-0 py-1 px-2">
|
<div class="card-body pt-0 py-1 px-2">
|
||||||
|
|
Loading…
Add table
Reference in a new issue