Skip to content

Commit a437cd6

Browse files
committed
fix: [file-name] fix tracker file-name filtering + template
1 parent b82d08b commit a437cd6

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

bin/lib/ail_core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def get_obj_queued():
115115
def get_objects_tracked():
116116
return AIL_OBJS_TRACKED # TODO add new test to check if == sorted() return True
117117

118+
def is_tracked_object(obj_type):
119+
return obj_type in AIL_OBJS_TRACKED
120+
118121
def get_objects_retro_hunted():
119122
return AIL_OBJS_RETRO_HUNTED
120123

bin/lib/item_basic.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,8 @@ def _get_dir_source_name(directory, source_name=None, l_sources_name=set(), filt
225225
# empty directory
226226
if not l_dir:
227227
if source_name:
228-
return l_sources_name.add(source_name)
229-
else:
230-
return l_sources_name
228+
l_sources_name.add(source_name)
229+
return l_sources_name
231230
else:
232231
for src_name in l_dir:
233232
if len(src_name) == 4 and source_name:

bin/modules/Global.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# Import Project packages
3838
##################################
3939
from modules.abstract_module import AbstractModule
40-
from lib.ail_core import get_objects_tracked
40+
from lib.ail_core import is_tracked_object
4141
from lib.ConfigLoader import ConfigLoader
4242
from lib.data_retention_engine import update_obj_date
4343
from lib.objects.Items import Item
@@ -140,12 +140,14 @@ def compute(self, message, r_result=False): # TODO move OBJ ID sanitization to i
140140
self.add_message_to_queue(obj=self.obj, queue='Titles', message=message)
141141
elif self.obj.type == 'file-name':
142142
pass
143+
elif self.obj.type == 'pdf':
144+
return None
143145
else:
144146
self.logger.critical(f"Empty obj: {self.obj} {message} not processed")
145147
return None
146148

147149
# Trackers
148-
if self.obj.type in get_objects_tracked():
150+
if is_tracked_object(self.obj.type):
149151
self.add_message_to_queue(obj=self.obj, queue='Trackers')
150152

151153
def check_filename(self, filename, new_file_content):

var/www/templates/hunter/tracker_add.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ <h6>Filter PGP by subtype:</h6>
144144
<input class="custom-control-input" type="checkbox" name="message_obj" id="message_obj" {% if not dict_tracker['filters'] or 'message' in dict_tracker['filters'] %}checked=""{% endif %}>
145145
<label class="custom-control-label" for="message_obj"><i class="fas fa-comment-dots"></i>&nbsp;Message <i class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="right" title="Messages from Chats"></i></label>
146146
</div>
147+
<div class="custom-control custom-switch mt-1">
148+
<input class="custom-control-input" type="checkbox" name="file-name_obj" id="file-name_obj" {% if not dict_tracker['filters'] or 'file-name' in dict_tracker['filters'] %}checked=""{% endif %}>
149+
<label class="custom-control-label" for="file-name_obj"><i class="far fa-file"></i>&nbsp;File Name <i class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="right" title="File name of Files from chats/messages"></i></label>
150+
</div>
147151
<div class="custom-control custom-switch mt-1">
148152
<input class="custom-control-input" type="checkbox" name="qrcode_obj" id="qrcode_obj" {% if not dict_tracker['filters'] or 'qrcode' in dict_tracker['filters'] %}checked=""{% endif %}>
149153
<label class="custom-control-label" for="qrcode_obj"><i class="fas fa-qrcode"></i>&nbsp;Qrcode <i class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="right" title="Qcodes Extracted from Images and Screenshots"></i></label>

var/www/templates/hunter/tracker_show.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ <h5>Filter Objects:</h5>
273273
<input class="custom-control-input" type="checkbox" name="item_obj" id="item_obj" {% if 'item' in filter_obj_types or filter_obj_types|length == 0 %}checked=""{% endif %}>
274274
<label class="custom-control-label" for="item_obj"><i class="fas fa-file"></i>&nbsp;Item <i class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="right" title="Text that has been processed by AIL. It can include various types of extracted information"></i></label>
275275
</div>
276+
<div class="custom-control custom-switch mt-1">
277+
<input class="custom-control-input" type="checkbox" name="file-name_obj" id="file-name_obj" {% if 'file-name' in filter_obj_types or filter_obj_types|length == 0 %}checked=""{% endif %}>
278+
<label class="custom-control-label" for="file-name_obj"><i class="far fa-file"></i>&nbsp;File Name <i class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="right" title="File Name of file from chats/messages"></i></label>
279+
</div>
276280
<div class="custom-control custom-switch mt-1">
277281
<input class="custom-control-input" type="checkbox" name="pgp_obj" id="pgp_obj" {% if 'pgp' in filter_obj_types or filter_obj_types|length == 0 %}checked=""{% endif %}>
278282
<label class="custom-control-label" for="pgp_obj"><i class="fas fa-key"></i>&nbsp;PGP <i class="fas fa-info-circle text-info" data-toggle="tooltip" data-placement="right" title="PGP key/block metadata"></i></label>

0 commit comments

Comments
 (0)