mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
chg: [tags] search ocrs and images by tags + fix ocr, filter invalid image
This commit is contained in:
parent
2b23d993df
commit
31b519cc17
4 changed files with 57 additions and 2 deletions
|
@ -101,7 +101,12 @@ class OcrExtractor(AbstractModule):
|
|||
languages = get_model_languages(image)
|
||||
languages = Ocrs.sanityze_ocr_languages(languages, ocr_languages=self.ocr_languages)
|
||||
print(image.id, languages)
|
||||
try:
|
||||
texts = Ocrs.extract_text(path, languages)
|
||||
except ValueError as e:
|
||||
self.logger.warning(e)
|
||||
self.obj.add_tag('infoleak:confirmed="false-positive"')
|
||||
texts = None
|
||||
if texts:
|
||||
print('create')
|
||||
ocr = Ocrs.create(image.id, texts)
|
||||
|
|
|
@ -293,6 +293,24 @@ def tags_search_messages():
|
|||
dict_tagged['date'] = Date.sanitise_date_range('', '', separator='-')
|
||||
return render_template("tags/search_obj_by_tags.html", bootstrap_label=bootstrap_label, dict_tagged=dict_tagged)
|
||||
|
||||
@tags_ui.route('/tag/search/image')
|
||||
@login_required
|
||||
@login_read_only
|
||||
def tags_search_images():
|
||||
object_type = 'image'
|
||||
dict_tagged = {"object_type": object_type, "object_name": object_type.title() + "s"}
|
||||
dict_tagged['date'] = Date.sanitise_date_range('', '', separator='-')
|
||||
return render_template("tags/search_obj_by_tags.html", bootstrap_label=bootstrap_label, dict_tagged=dict_tagged)
|
||||
|
||||
@tags_ui.route('/tag/search/ocr')
|
||||
@login_required
|
||||
@login_read_only
|
||||
def tags_search_ocrs():
|
||||
object_type = 'ocr'
|
||||
dict_tagged = {"object_type": object_type, "object_name": object_type.title() + "s"}
|
||||
dict_tagged['date'] = Date.sanitise_date_range('', '', separator='-')
|
||||
return render_template("tags/search_obj_by_tags.html", bootstrap_label=bootstrap_label, dict_tagged=dict_tagged)
|
||||
|
||||
@tags_ui.route('/tag/search/domain')
|
||||
@login_required
|
||||
@login_read_only
|
||||
|
|
|
@ -22,6 +22,18 @@
|
|||
Search Messages by Tags
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('tags_ui.tags_search_images') }}" id="nav_tags_search_image">
|
||||
<i class="fas fa-image"></i>
|
||||
Search Images by Tags
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('tags_ui.tags_search_ocrs') }}" id="nav_tags_search_message">
|
||||
<i class="fas fa-expand"></i>
|
||||
Search Ocrs by Tags
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('tags_ui.tags_search_domains') }}" id="nav_tags_search_domain">
|
||||
<i class="fab fa-html5"></i>
|
||||
|
|
|
@ -126,6 +126,26 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{%elif dict_tagged["object_type"]=="screenshot"%}
|
||||
|
||||
{%elif dict_tagged["object_type"]=="image" or dict_tagged["object_type"]=="ocr"%}
|
||||
{% for dict_obj in dict_tagged["tagged_obj"] %}
|
||||
<tr>
|
||||
<td class="pb-0">
|
||||
<a target="_blank" href="{{ url_for('correlation.show_correlation') }}?type={{dict_tagged['object_type']}}&id={{dict_obj['id']}}" class="text-secondary">
|
||||
<div style="line-height:0.9;">{{ dict_obj['id'] }}</div>
|
||||
</a>
|
||||
<div class="mb-2">
|
||||
{% for tag in dict_obj['tags'] %}
|
||||
<a href="{{ url_for('tags_ui.get_obj_by_tags') }}?object_type={{dict_tagged['object_type']}}<ags={{ tag }}">
|
||||
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{%elif dict_tagged["object_type"]=="message"%}
|
||||
{% for dict_obj in dict_tagged["tagged_obj"] %}
|
||||
<tr>
|
||||
|
|
Loading…
Reference in a new issue