-
Notifications
You must be signed in to change notification settings - Fork 6
/
unpackimg.sh
executable file
·52 lines (44 loc) · 1.14 KB
/
unpackimg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/bash
# 2021 @Lateautumn mail:[email protected]
export PATH=bin:${PATH}
test1(){
if [ $? -ne 0 ]; then
echo "failed"
exit 1
fi
}
decompresszip(){
mkdir out tmp
unzip *.zip -d tmp
if [ -e *.bin ]; then
payload-dumper-go tmp/payload.bin -o tmp
test1
rm tmp/payload.bin
fi
rm *.zip
}
decompressimg(){
for i in system vendor product system_ext odm
do
if [ -e *.br ];then
echo -e "\033[32m 解压${i}.new.dat.br \033[0m"
brotli -d tmp/${i}.new.dat.br -o tmp/${i}.new.dat
test1 && rm tmp/${i}.new.dat.br
echo -e "\033[33m 解压${i}.new.dat \033[0m"
sdat2img.py tmp/${i}.transfer.list tmp/${i}.new.dat tmp/${i}.img
test1 && rm tmp/${i}.transfer.list tmp/${i}.new.dat
fi
filetype=`file tmp/system.img | grep -o "data"`
if [ ${filetype} == data ];then
echo -e "\033[33m 解压${i}.img \033[0m"
erofsunpack tmp/${i}.img tmp
test1 && rm tmp/${i}.img
else
echo -e "\033[33m 解压${i}.img \033[0m"
imgextractor.py tmp/${i}.img tmp/${!}
test1 && rm tmp/${i}.img
fi
done
}
decompresszip
decompressimg