diff --git a/README.md b/README.md index 5b55c75..69fe16f 100644 --- a/README.md +++ b/README.md @@ -70,3 +70,10 @@ ___ - [gghhkm](https://github.com/gghhkm) - [Vendicated](https://github.com/Vendicated) - [Milind Goel](https://github.com/milindgoel15) + +___ + +## BSDiff Tools + +- To use these you must have a copy of a v1 vanced api "apks" folder of the version you want make diffs of and run the python script from there +- Before you run the script move the root/Theme stock and dpi apk to your working directory, delete the hash.json file and run the "generate_base_apk.sh" script to make a compatible base apk \ No newline at end of file diff --git a/apk2bsdiff.py b/apk2bsdiff.py new file mode 100644 index 0000000..ab75f32 --- /dev/null +++ b/apk2bsdiff.py @@ -0,0 +1,18 @@ +import bsdiff4 +import shutil +from pathlib import Path + +for path in Path('./nonroot/Arch').rglob('*.apk'): + bsdiff4.file_diff(str(path).replace('nonroot', 'root'), path, './patches/Arch/' + path.name.replace('.apk','.bsdiff')) + +for path in Path('./nonroot/Language').rglob('*.apk'): + bsdiff4.file_diff(str(path).replace('nonroot', 'root'), path, './patches/Language/' + path.name.replace('.apk','.bsdiff')) + +for path in Path('./nonroot/Theme').rglob('*.apk'): + bsdiff4.file_diff('base.apk', path, './patches/Theme/' + path.name.replace('.apk','.bsdiff')) + +for path in Path('./root/Theme').rglob('*.apk'): + bsdiff4.file_diff('base.apk', path, './patches/root/' + path.name.replace('.apk','.bsdiff')) + +for path in Path('./patches').rglob('*.bsdiff'): + shutil.copy(path, './patches/' + str(path).replace('/', '-')[8:]) diff --git a/base_apk_generator.sh b/base_apk_generator.sh new file mode 100644 index 0000000..80a0185 --- /dev/null +++ b/base_apk_generator.sh @@ -0,0 +1,15 @@ +echo 'Extracting apks...' +mv stock.apk base.apk +unzip base.apk resources.arsc +unzip dpi.apk -d dpi +echo 'combining resources...' +cd dpi +touch -a -m -t 198101010101.01 . +touch -a -m -t 198101010101.01 ./res +touch -a -m -t 198101010101.01 ./res/* +zip -0X ../base.apk ./res/* +zip -X ../base.apk ./res/*.xml +cd .. +cat ./dpi/resources.arsc >> ./resources.arsc +touch -a -m -t 198101010101.01 resources.arsc +zip -0X base.apk ./resources.arsc \ No newline at end of file