sensepost / objection

📱 objection - runtime mobile exploration
GNU General Public License v3.0
7.58k stars 856 forks source link

Use aapt from Android studio is not found in PATH #244

Open trufae opened 5 years ago

trufae commented 5 years ago

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

n0-c4ch3 commented 5 years ago

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

or

whats the default pick up of objection for aapt?

leonjza commented 5 years ago

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

trufae commented 5 years ago

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 notifications@github.com 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.

leonjza commented 5 years ago

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

n0-c4ch3 commented 5 years ago

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

leonjza commented 5 years ago

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

n0-c4ch3 commented 5 years ago

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 commented 5 years ago

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

leonjza commented 5 years ago

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.