Repository navigation
Lift a bare DEX - #56
Conversation
Soot's dexpler reads a bare classes.dex through the same src_prec_apk path an apk uses, but Lifter rejected the input before ever reaching it with "format needs to be in ['jar', 'apk']". An apk declares its target API level in AndroidManifest.xml. A bare dex carries no manifest, so Soot falls back to a platform that is usually not installed and aborts with "target android.jar does not exist". The dex format therefore requires android_api_version; apk accepts it as an optional override of the manifest.
|
In order to merge this, I want the android tests to actually run and pass in CI |
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/pysoot_56 |
The android tests looked only at ~/Android/Sdk, which no runner has, so they have always skipped -- the file carries a TODO about adding an SDK to CI. GitHub's hosted images already ship one and point ANDROID_HOME at it, so honouring the environment makes them run without any workflow change. Where no SDK exists the tests still skip, as before.
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Agreed. They now run without a workflow change. The tests were looking only at That un-skips Locally, with |
The sparse-checkout lists four jars, so android1.apk was never fetched. The android tests skipped for want of an SDK, so the missing fixture never surfaced; now that they run, both of them need it -- test_android1 directly and test_android1_dex for the classes.dex it extracts.
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Three things were in the way, and the last one is the interesting one. The tests looked only at With the file present, Both tests now name the newest installed platform explicitly, which is what the Locally, with |
android1.apk declares API 15, which no current SDK ships, so Soot could not find its android.jar and failed to build the scene -- the runners have android-23 and later. Both tests now pass the newest installed level explicitly, which is what the new android_api_version option is for.
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Green, and the android tests are running rather than skipping. The counts show it directly — before these changes each job reported
The remaining skip is unrelated to Android. |
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Lifteracceptsjarandapk, so a bare.dexcannot be lifted at all —ParameterError: format needs to be in ['jar', 'apk']. Soot handles one already:src_prec_apkand dexpler read a bare dex unchanged. The only thing missing is the API level, which an APK reads fromAndroidManifest.xmland a dex has no manifest to carry.dextherefore joins the accepted formats on theapkpath, with a newandroid_api_versionthat is required fordexand an optional override forapk.It is required rather than derived on purpose: the version in a dex header is the format version, not the API level the code targets, so guessing resolves against the wrong class library and yields subtly wrong names instead of an error. Say the word if you would rather it defaulted to the highest platform present in the SDK.
The test extracts
classes.dexout of the existingandroid1.apkfixture, so it needs no new one. Consumed by angr/cle'sDexbackend.session: pr-review