MaskeZen / resigner

batch script (7z and some kind of jdk) that unpack apk|jar|zip|zip compatible file, removes existing signature and checksums from the manifest, repack it using a compatible zip format, sign it and align it. this is v1 signature that uses jarsigner not apksigner, so it is very compatible with java-classes as well as modified-apk files and plain zip as well.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There are two way of working,
recursivly, and per-file.

run ./multi.sh yourpath,
to recursive look for zip, jar, apk files inside yourpath.

or run ./resign.sh yourfile,
to just do it for one file.


multi.sh uses find and parallel,
to run multiple executions of resign.sh in parallel,
by default one for each CPU core available.

each file will be backed-up to _original_ prefix and its name.

Note that for security reasons I do not provide a script to delete _original* files. but you can do it manually with:
##find "yourpath" -type f ( -name "_original_*" ) -delete.


you will need 7zip, jdk, and gnu parallel,
for some reason zipalign is not shipped with open-java so you need to install it as well.
sudo apt-get -y install p7zip openjdk-8-jdk parallel zipalign.
you also need to make sure java is well defined,
here is an example of /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-openjdk-amd64/bin"

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"

JRE_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre"

JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8 -Duser.language=en"

make sure to add the path to your jdk's bin/-folder at the end of PATH,
you can use locate jarsigner to find out where it is install,
for example in my case I've added :/usr/lib/jvm/java-8-openjdk-amd64/bin at the end of PATH,
define JAVA_HOME with just the jdk folder (without the bin/), JRE_HOME (optional) with the jre folder it is usually a sub-folder of the jdk folder, and JAVA_TOOL_OPTIONS (optional) for extra arguments passed for each java program (useful).

to edit your /etc/environment use your favorite text-editor in with superuser permissions for example sudo gedit /etc/environment (sudo apt-get -y install gedit).


known issues: for some reason the -prune -name "_original_*" switch used in find does not work, so if you've ran the process again, the _original_* files will be discovered and worked on as well, it means you can end up with a lot of files (_original__original_*), but you can still find . -type f ( -name "_original_*" ) -delete somewhere in your path to remove all of those...

edit: I've re-edited the 'find' command, and it seems to work now, instead of -prune which seems to just apply for folders and their content, using ! inside a new "matching group" seems to do it.

About

batch script (7z and some kind of jdk) that unpack apk|jar|zip|zip compatible file, removes existing signature and checksums from the manifest, repack it using a compatible zip format, sign it and align it. this is v1 signature that uses jarsigner not apksigner, so it is very compatible with java-classes as well as modified-apk files and plain zip as well.

License:The Unlicense


Languages

Language:Shell 100.0%