Skip to content

Commit

Permalink
Fixing tags in unpacker.py, related to fkie-cad#820
Browse files Browse the repository at this point in the history
  • Loading branch information
Oren Isacson committed Sep 21, 2022
1 parent 9fc393c commit f8588ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/unpacker/unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,16 @@ def _store_unpacking_error_skip_info(file_object: FileObject):
file_object.processed_analysis['unpacker'] = {
'plugin_used': 'None', 'number_of_unpacked_files': 0, 'plugin_version': '0.0', 'analysis_date': time(),
'info': 'Unpacking stopped because extractor raised a exception (possible timeout)',
'tags': {'extractor error': {'value': 'possible extractor timeout', 'color': TagColor.ORANGE, 'propagate': False}},
}
tag_dict = {'unpacker': {'extractor error': {'value': 'possible extractor timeout', 'color': TagColor.ORANGE, 'propagate': False}}}
file_object.analysis_tags.update(tag_dict)

@staticmethod
def _store_unpacking_depth_skip_info(file_object: FileObject):
file_object.processed_analysis['unpacker'] = {
'plugin_used': 'None', 'number_of_unpacked_files': 0, 'plugin_version': '0.0', 'analysis_date': time(),
'info': 'Unpacking stopped because maximum unpacking depth was reached',
'tags': {'depth reached': {'value': 'unpacking depth reached', 'color': TagColor.ORANGE, 'propagate': False}},
}
tag_dict = {'unpacker': {'depth reached': {'value': 'unpacking depth reached', 'color': TagColor.ORANGE, 'propagate': False}}}
file_object.analysis_tags.update(tag_dict)

def cleanup(self, tmp_dir):
try:
Expand Down
4 changes: 2 additions & 2 deletions src/web_interface/templates/analysis_plugins/unpacker.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
{% endif %}

{% for unpacker_meta_field in firmware.processed_analysis[selected_analysis].keys() %}
{% if unpacker_meta_field not in ['plugin_used', 'number_of_unpacked_files', 'output', 'analysis_date', 'plugin_version', 'summary'] %}
{% if unpacker_meta_field not in ['tags', 'plugin_used', 'number_of_unpacked_files', 'output', 'analysis_date', 'plugin_version', 'summary'] %}
<tr>
<td>{{ unpacker_meta_field | replace_underscore }}</td>
<td><pre><code style="word-break: break-all; white-space: pre-wrap;">{{ firmware.processed_analysis[selected_analysis][unpacker_meta_field] | nice_generic | safe }}</code></pre></td>
</tr>
{% endif %}
{% endfor %}

{% endblock %}
{% endblock %}

0 comments on commit f8588ec

Please sign in to comment.