obfusk / reproducible-apk-tools Goto Github PK
View Code? Open in Web Editor NEWreproducible-apk-tools - scripts to make android apks reproducible
License: GNU General Public License v3.0
reproducible-apk-tools - scripts to make android apks reproducible
License: GNU General Public License v3.0
zipalign
The binary AndroidManifest.xml file can have ordering differences beetwen compiled APK to tested APK (From github or Google Play)
2 Examples:
AndroidManifest.zip
The file in zip archive as Github wont allow uploading it otherwise.
Result only in order differences (AndroidManifest.xml was decoded using command androguard axml AndroidManifest.xml
) as the same value exists before </application>
tag in upstream and in other place in built apk.
<meta-data android:name="com.android.vending.derived.apk.id" android:value="1"/>
Running a sed command that will add this tag to AndroidManifest during compilation, such as:
sed -i '/^\s*<\/application>\s*/i <meta-data android:name="com.android.vending.derived.apk.id" android:value="1"\/>' android/app/src/main/AndroidManifest.xml; \
sometimes works as intended, and sometimes it result in the value being added in different order (exists not before the </application>
tag)
The suggestion is for this repo to add a command to sort this file, so it can be used during RB process.
Above issues were found during my contributions to WalletScrutiny project https://walletscrutiny.com/
Currently when calling dump-* functions (eg. dump_axml
) or zipinfo
from python code just prints the output.
It would be nice if there were corresponding functions which would return the output as string.
Currently I have to workaround this problem using redirect_stdout
. But that only works if print
was used. It does not work for subprocess.run
calls.
diff-zip-meta.py
list-compresslevel.py
fix-compresslevel.py
fix-newlines.py
sort-baseline.py
defS
, defF
, defX
-r--a--
, -rw-a--
, -rwxa--
).com
/.exe
/.btm
/.cmd
/.bat
(fat)ntf
d
for directories (fat) [NB: --extended
treats filenames ending w/ /
as dirs]atime
, ctime
T
/B
for encrypted filesNN.N%
rounding differences (?!)For some reason, the original zipinfo
marks files named META-INF/services/io.jsonwebtoken.CompressionCodec
as executable.
I have no idea why, since there are no metadata differences that would explain this.
So I'm assuming it's an odd bug in the original, not in the Python version in this repo.
I've seen this with several different APK files, and it's always the same filename, never any other file.
@@ -95,7 +95,7 @@
-rw---- 2.4 fat 5 b- 5 stor 81-Jan-01 01:01 META-INF/kotlinx_coroutines_core.version
-rw---- 2.4 fat 39 b- 39 stor 81-Jan-01 01:01 META-INF/services/com.fasterxml.jackson.core.JsonFactory
-rw---- 2.4 fat 44 b- 44 stor 81-Jan-01 01:01 META-INF/services/com.fasterxml.jackson.core.ObjectCodec
--rwx--- 2.4 fat 110 b- 60 defN 81-Jan-01 01:01 META-INF/services/io.jsonwebtoken.CompressionCodec
+-rw---- 2.4 fat 110 b- 60 defN 81-Jan-01 01:01 META-INF/services/io.jsonwebtoken.CompressionCodec
-rw---- 2.4 fat 46 b- 42 defN 81-Jan-01 01:01 META-INF/services/io.jsonwebtoken.io.Deserializer
-rw---- 2.4 fat 44 b- 40 defN 81-Jan-01 01:01 META-INF/services/io.jsonwebtoken.io.Serializer
-rw---- 2.4 fat 112 b- 57 defN 81-Jan-01 01:01 META-INF/services/java.security.Provider
The zipalign needs to be call manully with something like $$SDK$$/build-tools/30.0.3/zipalign
. When the build-tools is updated the path also changes. I thought it would be convenient to find sdk from environment or option and use the zipalign from the build-tools with the highest version.
Making a gradle plugin is probably too much effort, but it would be nice to have a snippet of code one can customise and add to build.gradle
to integrate these tools (and maybe zipalign
as well) into the build process if that's easily doable.
Implementation of support for the missing baseline.prof
file format versions below should not be too hard but is currently blocked by a lack of samples (i.e. we have none) to test against.
Style
/Span
anim/
/ (file)
/ type=PNG
stuffLibraryChunk
BinResCfg
zipinfo.py
currently produces (almost) identical output to Info-ZIP's zipinfo
for various ZIP & JAR files found on a Debian system and APKs from F-Droid.
To support more varieties of ZIP formats and extensions -- if they are sufficiently common that it makes sense to -- requires having "real world" samples to test against.
create_system
0 (unix), 3 (fat), and 11 (ntfs)compress_type
stored, deflated, bzip2, and lzma (via Python's zipfile
)UT
and UX
extra fields (in CD)A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.