Skip to content

Commit c50b8fe

Browse files
committed
Add bsdiff generation tools
1 parent c3eb71d commit c50b8fe

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,10 @@ ___
7070
- [gghhkm](https://github.com/gghhkm)
7171
- [Vendicated](https://github.com/Vendicated)
7272
- [Milind Goel](https://github.com/milindgoel15)
73+
74+
___
75+
76+
## BSDiff Tools
77+
78+
- 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
79+
- 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

apk2bsdiff.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import bsdiff4
2+
import shutil
3+
from pathlib import Path
4+
5+
for path in Path('./nonroot/Arch').rglob('*.apk'):
6+
bsdiff4.file_diff(str(path).replace('nonroot', 'root'), path, './patches/Arch/' + path.name.replace('.apk','.bsdiff'))
7+
8+
for path in Path('./nonroot/Language').rglob('*.apk'):
9+
bsdiff4.file_diff(str(path).replace('nonroot', 'root'), path, './patches/Language/' + path.name.replace('.apk','.bsdiff'))
10+
11+
for path in Path('./nonroot/Theme').rglob('*.apk'):
12+
bsdiff4.file_diff('base.apk', path, './patches/Theme/' + path.name.replace('.apk','.bsdiff'))
13+
14+
for path in Path('./root/Theme').rglob('*.apk'):
15+
bsdiff4.file_diff('base.apk', path, './patches/root/' + path.name.replace('.apk','.bsdiff'))
16+
17+
for path in Path('./patches').rglob('*.bsdiff'):
18+
shutil.copy(path, './patches/' + str(path).replace('/', '-')[8:])

base_apk_generator.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
echo 'Extracting apks...'
2+
mv stock.apk base.apk
3+
unzip base.apk resources.arsc
4+
unzip dpi.apk -d dpi
5+
echo 'combining resources...'
6+
cd dpi
7+
touch -a -m -t 198101010101.01 .
8+
touch -a -m -t 198101010101.01 ./res
9+
touch -a -m -t 198101010101.01 ./res/*
10+
zip -0X ../base.apk ./res/*
11+
zip -X ../base.apk ./res/*.xml
12+
cd ..
13+
cat ./dpi/resources.arsc >> ./resources.arsc
14+
touch -a -m -t 198101010101.01 resources.arsc
15+
zip -0X base.apk ./resources.arsc

0 commit comments

Comments
 (0)