Skip to content

Add DexTrace core-library backend (continuation of PR #855) - #958

Merged
haeter525 merged 9 commits into
ev-flow:masterfrom
haeter525:dextrace_core
Aug 4, 2026
Merged

haeter525 merged 9 commits into
ev-flow:masterfrom
haeter525:dextrace_core

Conversation

@haeter525

@haeter525 haeter525 commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Description

Adds DexTraceImp as a new concrete implementation of BaseApkinfo, allowing Quark to use DexTrace as an alternative APK analysis backend. Activate it with --core-library dextrace:

quark -a <apk_file> --core-library dextrace -s

Key Changes

  • quark/core/dextraceapkinfo.py: Add DexTraceImp, implementing the same BaseApkinfo interface as AndroguardImp.

  • quark/core/quark.py:

    • Wire core_library="dextrace" to DexTraceImp.
    • Fix false positive in find_api_usage subclass BFS: check class_name in current_class_set instead of discarding Ljava/lang/Object; and testing non-empty.
  • tests/core/test_dextraceapkinfo.py: Add integration tests covering:

    • Class name normalisation (Ahmyth APK).
    • Bogus ZIP compression and permissions (3d52b APK).
    • Manifest fast-fail (synthetic APK via tmp_path).

Motivation and Context

DexTrace is a Python APK analysis library that parses DEX bytecode independently of the androguard package. Adding it as a backend gives Quark an alternative that does not depend on androguard. The implementation handles the anti-analysis patterns and class naming conventions seen in real-world malware samples.

How Has This Been Tested?

  • pytest tests/ passes with no regressions.
  • Full run on 497 APKs from the Quark malware family analysis report:
    • Accuracy: DexTrace's result is more accurate than Androguard's.
    • Performance: mean 27.5 s vs 5.7 s (4.8x faster), total wall time 57 min vs 11 min (5.2x faster).

sidra-asa and others added 9 commits August 1, 2026 07:51
Replaces the silent get_apk_permissions() call with a direct parse_manifest()
call that raises ValueError when the manifest is missing or has invalid AXML
bytes. trickmo and tanglebot APKs now fail fast (< 1 s) instead of running
three full DEX passes (134 s on trickmo).

parse_manifest() requires DexTrace fix: propagate {"error": ...} from
ManifestParser instead of silently mapping it to empty fields.

Adds two unit tests for the two ValueError paths:
- invalid AXML bytes in AndroidManifest.xml
- AndroidManifest.xml entry absent from the ZIP
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@e59fd72). Learn more about missing BASE report.
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
quark/core/quark.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #958   +/-   ##
=========================================
  Coverage          ?   80.29%           
=========================================
  Files             ?       82           
  Lines             ?     7192           
  Branches          ?        0           
=========================================
  Hits              ?     5775           
  Misses            ?     1417           
  Partials          ?        0           
Flag Coverage Δ
unittests 80.29% <50.00%> (?)

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@haeter525 haeter525 changed the title fix(dextrace): fix DexTrace backend correctness and performance Add DexTrace core-library backend (continuation of PR #855) Aug 1, 2026

@pulorsok pulorsok 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.

LGTM.

@haeter525
haeter525 merged commit f654efd into ev-flow:master Aug 4, 2026
18 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants