objection icon indicating copy to clipboard operation
objection copied to clipboard

Use aapt from Android studio is not found in PATH

Open trufae opened this issue 6 years ago • 9 comments

Default installation of Android Studio (on Mac) is this:

$ pwd
~/Library/Android/sdk/build-tools/28.0.3
$ file aapt
aapt: Mach-O 64-bit executable x86_64

It will be good if objection can just pick the bin from there, that will make initial setups easier for most users

trufae avatar Jun 21 '19 14:06 trufae

Btw, how do we change the destination for objection to locate the aapt directory?

or

whats the default pick up of objection for aapt?

n0-c4ch3 avatar Jul 03 '19 08:07 n0-c4ch3

It checks $PATH for aapt, so just modify $PATH to include it's location.

leonjza avatar Jul 03 '19 09:07 leonjza

Yep that works, but i was suggesting to make objection find those tools in default installation places, feel free to close the issue if you prefer to keep it like this

On 3 Jul 2019, at 11:42, Leon Jacobs [email protected] wrote:

It checks $PATH for aapt, so just modify $PATH to include it's location.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sensepost/objection/issues/244?email_source=notifications&email_token=ABRCGG3N4KSX3KHZTHOWMLTP5RYA3A5CNFSM4H2SLHD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZD4ZPA#issuecomment-508021948, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRCGG6NLA2HZYWHF2PL4U3P5RYA3ANCNFSM4H2SLHDQ.

trufae avatar Jul 03 '19 10:07 trufae

Will keep this open. Makes sense to try some sane defaults, but $PATH modifications will always be the last resort.

leonjza avatar Jul 03 '19 10:07 leonjza

Can you walk me through how to find $PATH and how to modify to include the directory? Cheers

n0-c4ch3 avatar Jul 03 '19 10:07 n0-c4ch3

There are plenty of resources available online for this. But in short, you would do something like export PATH=$PATH:/path/to/aapt.

leonjza avatar Jul 03 '19 12:07 leonjza

Many thanks! But it seems to have an error patching the APK, tried with --skip-resources then it went smooth. But when I open the app, it doesn't seem to hook with the objection.

n0-c4ch3 avatar Jul 04 '19 06:07 n0-c4ch3

Error without --skip-resources was:

> No architecture specified. Determining it using adb...
>Detected target device architecture as: arm64-v8a
>Using latest Github gadget version: 12.6.10
>Patcher will be using Gadget version: 12.6.10
>Unpacking app-ph-debug.apk
>An error may have occurred while extracting the APK.
>S: WARNING: Could not write to (/Users/adrianemagdaraog/Library/apktool/framework), using /var/folders/hd/pcgdyv2j3mj18brxj2ymhcwc0000gp/T/ instead...
>S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable

>App already has android.permission.INTERNET
>Target class not specified, searching for launchable activity instead...
>Smali not found in smali directory. This might be a multidex APK. Searching...
>Found smali at: /var/folders/hd/pcgdyv2j3mj18brxj2ymhcwc0000gp/T/tmpcy19pe25.apktemp/smali_classes22/com/s>quareup/leakcanary/internal/DisplayLeakActivity.smali
>Reading smali from: /var/folders/hd/pcgdyv2j3mj18brxj2ymhcwc0000gp/T/tmpcy19pe25.apktemp/smali_classes22/com/s>quareup/leakcanary/internal/DisplayLeakActivity.smali
>Injecting into an existing constructor
>Injecting loadLibrary call at line: 49
>Attempting to fix the constructors .locals count
>Current locals value is 1, updating to 2:
>Writing patched smali back to: /var/folders/hd/pcgdyv2j3mj18brxj2ymhcwc0000gp/T/tmpcy19pe25.apktemp/smali_classes22/com/s>quareup/leakcanary/internal/DisplayLeakActivity.smali
>Copying Frida gadget to libs path...
>Patching paused. The next step is to rebuild the APK. If you require any manual fixes, the current temp directory is:
 /var/folders/hd/pcgdyv2j3mj18brxj2ymhcwc0000gp/T/tmpcy19pe25.apktemp

apktool = 2.4.0

n0-c4ch3 avatar Jul 04 '19 07:07 n0-c4ch3

Unfortunately I can't see the problem in that output. Ultimately, you will need to manually debug why apktool fails. Also, please don't add more comments to this feature request. It is unrelated.

leonjza avatar Jul 04 '19 07:07 leonjza