Skip to content

Add method reference for get_json_report in document#526

Merged
zinwang merged 1 commit into
ev-flow:masterfrom
LiangPPP:master
Jul 5, 2023
Merged

Add method reference for get_json_report in document#526
zinwang merged 1 commit into
ev-flow:masterfrom
LiangPPP:master

Conversation

@LiangPPP

@LiangPPP LiangPPP commented Jul 4, 2023

Copy link
Copy Markdown
Contributor

get_json_report

The algorithm of get_json_report

The function get_json_report generates a report of the analysis performed on the APK file, in JSON format.

Here is the process of get_json_report .


    1. Create a Weight object with the total score and weight from the analysis result.

    2. Calculate the threat level with the Weight object and store the result in the variable warning.

    3. Loop through a list of threat levels and check if the variable warning contains any of the threat levels.
        - If Yes, sets the variable warning to the threat level.
 
    4. Return a report with various pieces of information:
        - The MD5 hash of the APK
        - The filename of the APK
        - The file size of the APK
        - The threat level of the APK
        - The total score of the analysis result
        - The JSON report of the analysis result

Here is the flowchart of get_json_report .

The code of get_json_report

    def get_json_report(self):
        """
        Get quark report including summary and detail with json format.

        :return: json report
        """

        w = Weight(
            self.quark_analysis.score_sum, self.quark_analysis.weight_sum
        )
        warning = w.calculate()

        # Filter out color code in threat level
        for level in ["Low Risk", "Moderate Risk", "High Risk"]:
            if level in warning:
                warning = level

        return {
            "md5": self.apkinfo.md5,
            "apk_filename": self.apkinfo.filename,
            "size_bytes": self.apkinfo.filesize,
            "threat_level": warning,
            "total_score": self.quark_analysis.score_sum,
            "crimes": self.quark_analysis.json_report,
        }

@codecov-commenter

codecov-commenter commented Jul 4, 2023

Copy link
Copy Markdown

Codecov Report

Patch and project coverage have no change.

Comparison is base (5b9514c) 79.19% compared to head (30b72dd) 79.19%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #526   +/-   ##
=======================================
  Coverage   79.19%   79.19%           
=======================================
  Files          63       63           
  Lines        4960     4960           
=======================================
  Hits         3928     3928           
  Misses       1032     1032           
Flag Coverage Δ
unittests 79.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zinwang zinwang self-assigned this Jul 4, 2023
@zinwang zinwang added documentation Improvements or additions to documentation pr-processing-state-05 labels Jul 4, 2023
@zinwang zinwang requested review from pulorsok and zinwang July 4, 2023 08:46
@zinwang

This comment was marked as resolved.

@zinwang zinwang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pulorsok

pulorsok commented Jul 5, 2023

Copy link
Copy Markdown
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pr-processing-state-05

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants