Repository navigation
Conversation
01101sam
pushed a commit
to 01101sam/asc
that referenced
this pull request
Nov 12, 2026
Adds `droidasc batch`, which inflates each DEX once and decompiles every selected class (--prefix or --from-file) into a package tree, with --resume and --limit. Fixes on top of upstream MG1937#57: - sanitize class names before using them as paths; a hostile descriptor such as L../../x; could previously write outside --out-dir - give classes that differ only by case distinct output files (~N suffix); on macOS/Windows they overwrote each other and --resume then skipped them - decompile a class listed twice in --from-file only once - reject a negative --limit instead of silently slicing from the end (cherry picked from commit b4effb9) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ra8caPaYoi8jheXnkE5dPe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
getclassis fine for one class. For a whole package you end up looping itfrom the shell, and each run opens the APK again and re-inflates the DEX
entries until it finds the class. On a 64-DEX APK that repeated inflate is most
of the work. Decompiling the class is a small part of it.
batchinflates every DEX once, indexes the classes they define, thendecompiles from those buffers. One process, no worker pool, no IPC, no cache on
disk.
Benchmark
Real APK: 358 MB, 64 DEX, 34,655 classes under
com.kubi.getclassin a loopdroidasc batch --prefix com.kubi -o out/Same 100 classes, each approach timed end to end including interpreter startup:
getclassbatch --from-file classes.txtThe batch output was byte-identical to
getclassfor all 100 classes, innerclasses included. A test checks this by diffing the two outputs.
Throughput is about 72 classes/s wall clock. The decompiler is GIL-bound, so
threads would not help. The win comes from reading the APK once.
Usage
--prefixtakescom.poc,com/pocorLcom/poc, same aslistclass.--from-filetakes one class per line, dotted or Dalvik, and ignores linesstarting with
#. It reads whatlistclass -owrites.-ois required, andfiles mirror the package tree:
Lcom/poc/Main$a;becomesout/com/poc/Main$a.java.--resumeskips classes whose file already exists.--limitcaps the run.A class listed but missing from the APK prints a warning and is skipped. The
run fails only when nothing matches, or when every selected class fails to
decompile. One bad class doesn't stop the rest.
Tests
tests/test_batch.pyhas 10 cases: name parsing, prefix selection, outputparity with
getclass, empty prefix, missing class, empty list, resume,summary, limit.
tests/run_tests.pypicks it up, and the unit suite stays green(75 tests).
Files
droidasc/asc_client/batch.py(new): inflate-once index and decompile helpersdroidasc/cli.py:batchsubcommandtests/test_batch.py(new)README.md: command list andbatchsection