Lanchon / haystack

Signature Spoofing Patcher for Android
GNU General Public License v3.0
234 stars 45 forks source link

Doesn't work with CopperheadOS #1

Closed robotanarchy closed 8 years ago

robotanarchy commented 8 years ago

Thanks for making this piece of software!

I'd like to use it with CopperheadOS, which does not support making modifications to their signed images unless you repackage it and sign it with your own key (source: 2. answer). (In other words: the adb method will not work.)

Here's what I do instead of pull-files (for reproducing):

# download and extract system.img
wget "https://builds.copperhead.co/builds/bullhead-factory-2016.11.10.09.53.38.tar.xz"
tar -xvf bullhead-factory-2016.11.10.09.53.38.tar.xz
mkdir bullhead-nbd91p
cd bullhead-nbd91p
unzip ../bullhead-nbd91p/image-bullhead-nbd91p.zip
simg2img system.img system.raw.img

# mount it
sudo mkdir /mnt/copperheados
sudo mount -t ext4 -o loop system.raw.img /mnt/copperheados

# copy over all files
PATCHME=(
        framework/framework.jar
        framework/core-libart.jar
        framework/core-oj.jar
        framework/ext.jar
        framework/services.jar
        priv-app/Settings/Settings.apk
)
mkdir patchdir-bullhead-nbd91p
for file in "${PATCHME[@]}"; do
        cp -v /mnt/copperheados/$file patchdir-bullhead-nbd91p
done

patch-fileset fails now:

~ ./patch-fileset patches/sigspoof-hook-7.0/ 24 /home/builder/Downloads/CopperheadOS/patchdir-bullhead-nbd91p --dry-run
>>> apply patch: services.jar
>>> dexpatcher --api-level 24 --verbose --dry-run --multi-dex /home/builder/Downloads/CopperheadOS/patchdir-bullhead-nbd91p/services.jar patches/sigspoof-hook-7.0/services.jar.dex
info: read '/home/builder/Downloads/CopperheadOS/patchdir-bullhead-nbd91p/services.jar'
info: read 'patches/sigspoof-hook-7.0/services.jar.dex'
error: type 'com.android.server.pm.PackageManagerService': (PackageManagerService.java:0): target not found
1 error(s), 0 warning(s)

~ ./patch-fileset patches/sigspoof-core/ 24 /mnt/image-bullhead-nbd91p-system/framework/ --dry-run
>>> apply patch: services.jar
>>> dexpatcher --api-level 24 --verbose --dry-run --multi-dex /mnt/image-bullhead-nbd91p-system/framework/services.jar patches/sigspoof-core/services.jar.dex
info: read '/mnt/image-bullhead-nbd91p-system/framework/services.jar'
info: read 'patches/sigspoof-core/services.jar.dex'
error: type 'com.android.server.pm.GeneratePackageInfoHook': (GeneratePackageInfoHook.java:0): target not found
1 error(s), 0 warning(s)

~ ./patch-fileset patches/sigspoof-ui-global-7.0/ 24 /home/builder/Downloads/CopperheadOS/patchdir-bullhead-nbd91p/ --dry-run
>>> apply patch: Settings.apk
>>> dexpatcher --api-level 24 --verbose --dry-run --multi-dex /home/builder/Downloads/CopperheadOS/patchdir-bullhead-nbd91p/Settings.apk patches/sigspoof-ui-global-7.0/Settings.apk.dex
info: read '/home/builder/Downloads/CopperheadOS/patchdir-bullhead-nbd91p/Settings.apk'
info: read 'patches/sigspoof-ui-global-7.0/Settings.apk.dex'
error: type 'com.android.settings.DevelopmentSettings': (DevelopmentSettings.java:0): target not found
1 error(s), 0 warning(s)

What does this mean? Is there a fix or workaround? Thanks a lot!

robotanarchy commented 8 years ago

Okay, I can answer this by myself now. CopperheadOS is odexed (which means, they ship the architecture-specific compiled binaries *.odex instead of the architecture-independent *.dex files, only the latter can be modified with tools such as haystack as of now). The odexed files can be found in framework/oat/arm64 for example.

Lanchon commented 7 years ago

hi!

thanks for the interest. i'm very sorry, i completely missed this issue, just saw it now.

so yes, you need a deodex rom, that's been on the requirements all along, lol

but what you can do is deodex your rom using smali or some GUI font-ends to that effect.

robotanarchy commented 7 years ago

Thanks for the answer. As of now I'm using CopperheadOS without the signature spoofing patch and I won't follow this further. Anyway, if someone else is reading this and is interested in CopperheadOS (or generally odexed ROMs) + signature spoofing, then try to contribute here: https://github.com/mikeperry-tor/mission-improbable/issues/16