From 8f7c8db6db00e817a9e809ab8232371fd9967ef0 Mon Sep 17 00:00:00 2001 From: evilcel3ri Date: Fri, 24 Mar 2023 13:16:09 +0100 Subject: [PATCH 1/2] Removing sha for dexo_func + adding |safe to dexofuzzy_hash --- bazaar/core/utils.py | 3 ++- bazaar/front/forms.py | 2 +- bazaar/templates/front/report/m_androcfg.html | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bazaar/core/utils.py b/bazaar/core/utils.py index 4348a0b..594a86a 100644 --- a/bazaar/core/utils.py +++ b/bazaar/core/utils.py @@ -240,7 +240,8 @@ def get_matching_items_by_ssdeep(ssdeep_value, threshold_grade, index, sha256): return sha256_list_to_return -def get_matching_items_by_ssdeep_func(ssdeep_value, threshold_grade, index, sha256): +def get_matching_items_by_ssdeep_func(ssdeep_value, threshold_grade, index): + ssdeep_value = ssdeep_value.replace(" ", "+").replace("%2F", "/") chunksize, chunk, double_chunk = ssdeep_value.split(':') chunksize = int(chunksize) es = Elasticsearch(settings.ELASTICSEARCH_HOSTS) diff --git a/bazaar/front/forms.py b/bazaar/front/forms.py index 60f8e6b..b976d03 100644 --- a/bazaar/front/forms.py +++ b/bazaar/front/forms.py @@ -48,7 +48,7 @@ def do_search(self, sha=''): if algorithm == 'ssdeep': results = get_matching_items_by_ssdeep(hash, 25, settings.ELASTICSEARCH_SSDEEP_APK_INDEX, sha) if algorithm == 'func_hash': - results = get_matching_items_by_ssdeep_func(hash, 25, settings.ELASTICSEARCH_APK_INDEX, sha) + results = get_matching_items_by_ssdeep_func(hash, 25, settings.ELASTICSEARCH_APK_INDEX) except Exception as e: print(e) diff --git a/bazaar/templates/front/report/m_androcfg.html b/bazaar/templates/front/report/m_androcfg.html index b48c406..079c9e4 100644 --- a/bazaar/templates/front/report/m_androcfg.html +++ b/bazaar/templates/front/report/m_androcfg.html @@ -15,7 +15,7 @@

{{ r.rule.title }}

  • {{f.call_by}} - +
  • {% endfor %} From 7858f202d11677ee6c29e3aceea12600a0ba14e1 Mon Sep 17 00:00:00 2001 From: evilcel3ri Date: Mon, 27 Mar 2023 16:42:22 +0200 Subject: [PATCH 2/2] final fix --- bazaar/core/utils.py | 2 -- bazaar/templates/front/report/m_androcfg.html | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bazaar/core/utils.py b/bazaar/core/utils.py index 594a86a..0c1dbf0 100644 --- a/bazaar/core/utils.py +++ b/bazaar/core/utils.py @@ -22,7 +22,6 @@ from scipy.spatial.distance import pdist import pandas as pd - def get_sha256_of_file_path(file_path): sha256_hash = hashlib.sha256() with open(file_path, "rb") as f: @@ -241,7 +240,6 @@ def get_matching_items_by_ssdeep(ssdeep_value, threshold_grade, index, sha256): def get_matching_items_by_ssdeep_func(ssdeep_value, threshold_grade, index): - ssdeep_value = ssdeep_value.replace(" ", "+").replace("%2F", "/") chunksize, chunk, double_chunk = ssdeep_value.split(':') chunksize = int(chunksize) es = Elasticsearch(settings.ELASTICSEARCH_HOSTS) diff --git a/bazaar/templates/front/report/m_androcfg.html b/bazaar/templates/front/report/m_androcfg.html index 079c9e4..1248df3 100644 --- a/bazaar/templates/front/report/m_androcfg.html +++ b/bazaar/templates/front/report/m_androcfg.html @@ -14,9 +14,9 @@

    {{ r.rule.title }}

    {% for f in r.findings %}
  • {{f.call_by}} - - + href="{% url "front:get_andgrocfg_code" sha256 f.evidence_file %}">{{f.call_by}} + +
  • {% endfor %}