Skip to content

Add API filter into Radiocontrast#360

Merged
haeter525 merged 9 commits into
ev-flow:masterfrom
pulorsok:fourth_rule_generation
Jun 14, 2022
Merged

Add API filter into Radiocontrast#360
haeter525 merged 9 commits into
ev-flow:masterfrom
pulorsok:fourth_rule_generation

Conversation

@pulorsok

@pulorsok pulorsok commented Jun 14, 2022

Copy link
Copy Markdown
Member

close #359

This PR aims to add the parameter percentile_rank in rule_generate() as the percentile number of API filter rank.

For example, if you want to keep the 20% least usage count APIs, set the percentile_rank as 0.2

radiocontrast.generate_rule(percentile_rank=0.2)

Here is the simplest way for usage:

from quark.radiocontrast import RadioContrast

# The target APK.
APK_PATH = "~/apk-malware-sample/Ahmyth.apk"

# The method that you want to generate rules. 
TARGET_METHOD = "Lahmyth/mine/king/ahmyth/CameraManager;->startUp(I)V"

# The output directory for generated rules.
GENERATED_RULE_DIR = "~/generated_rules"

radiocontrast = RadioContrast(
 APK_PATH, 
 TARGET_METHOD, 
 GENERATED_RULE_DIR
)

# param: web_editor: the file path for generated rules web editor.
# param: percentile_rank: the percentile number of api filter rank. 
#        For example, percentile_rank=0.2 use 20% least usage count APIs to generate rules
radiocontrast.generate_rule(percentile_rank=0.2, web_editor="ahmyth.html")

@codecov-commenter

codecov-commenter commented Jun 14, 2022

Copy link
Copy Markdown

Codecov Report

Merging #360 (5c642af) into master (bc1deb3) will decrease coverage by 0.27%.
The diff coverage is 2.50%.

❗ Current head 5c642af differs from pull request most recent head f8b86df. Consider uploading reports for the commit f8b86df to get more accurate results

@@            Coverage Diff             @@
##           master     #360      +/-   ##
==========================================
- Coverage   74.49%   74.21%   -0.28%     
==========================================
  Files          52       52              
  Lines        3917     3933      +16     
==========================================
+ Hits         2918     2919       +1     
- Misses        999     1014      +15     
Flag Coverage Δ
unittests 74.21% <2.50%> (-0.28%) ⬇️

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

Impacted Files Coverage Δ
quark/radiocontrast.py 0.00% <0.00%> (ø)
quark/rulegeneration.py 0.00% <0.00%> (ø)
quark/utils/tools.py 58.13% <5.26%> (-41.87%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc1deb3...f8b86df. Read the comment docs.

Comment thread quark/utils/tools.py
Comment thread quark/radiocontrast.py
Comment thread docs/source/rule_generation.rst Outdated
Comment thread docs/source/rule_generation.rst Outdated
Comment thread docs/source/rule_generation.rst Outdated
Comment thread docs/source/rule_generation.rst Outdated
Comment thread quark/utils/tools.py Outdated
@pep8speaks

pep8speaks commented Jun 14, 2022

Copy link
Copy Markdown

Hello @pulorsok! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-06-14 07:04:05 UTC

@haeter525 haeter525 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add API filter into Radiocontrast

4 participants