Skip to content

Commit 817c426

Browse files
committed
chg: [trackers] match objs, add view pdf btn if correlation filename == 1 pdf
1 parent 2fc4fdd commit 817c426

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

bin/lib/objects/FilesNames.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ def get_misp_object(self):
6060
obj_attr.add_tag(tag)
6161
return obj
6262

63+
def get_pdf(self):
64+
pdfs = self.get_correlation('pdf').get('pdf', set())
65+
if len(pdfs) == 1:
66+
return pdfs.pop()[1:]
67+
6368
def get_meta(self, options=set()):
6469
meta = self._get_meta(options=options)
6570
meta['id'] = self.id
6671
meta['tags'] = self.get_tags(r_list=True)
72+
if 'pdf' in options:
73+
meta['pdf'] = self.get_pdf()
6774
if 'tags_safe' in options:
6875
meta['tags_safe'] = self.is_tags_safe(meta['tags'])
6976
return meta

var/www/blueprints/hunters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def show_tracker():
216216
if date_from:
217217
date_from, date_to = Date.sanitise_daterange(date_from, date_to)
218218
objs = tracker.get_objs_by_daterange(date_from, date_to, filter_obj_types)
219-
meta['objs'] = ail_objects.get_objects_meta(objs, options={'last_full_date'}, flask_context=True)
219+
meta['objs'] = ail_objects.get_objects_meta(objs, options={'last_full_date', 'pdf'}, flask_context=True)
220220
else:
221221
date_from = ''
222222
date_to = ''

var/www/templates/hunter/tracker_show.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ <h5>Matches by year:</h5>
362362
<a href="{{ object['link'] }}">
363363
{{ object['id']}}
364364
</a>
365+
{% if 'pdf' in object %}
366+
<a target="_blank" href="{{ url_for('objects_pdf.pdf_view', id=object['pdf']) }}">
367+
<button class="btn btn-sm btn-outline-dark"><i class="far fa-file-pdf fa-border bg-white" style="color: Red;--fa-border-color: inherit;"></i></button>
368+
</a>
369+
{% endif %}
365370
{% if object['tags'] %}
366371
<div>
367372
{% for tag in object['tags'] %}

0 commit comments

Comments
 (0)