Skip to content

Commit

Permalink
extractor: support oppo .bin
Browse files Browse the repository at this point in the history
Signed-off-by: ShivamKumarJha <[email protected]>
  • Loading branch information
ShivamKumarJha authored and erfanoabdi committed Jan 21, 2020
1 parent 966a17f commit 5993801
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion extractor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Sony ftf
# ZTE update.zip
# KDDI .bin
# bin images
# pac

usage() {
echo "Usage: $0 <Path to firmware> [Output Dir]"
Expand Down Expand Up @@ -66,7 +68,7 @@ if [[ $MAGIC == "OPPOENCRYPT!" ]] || [[ "$romzipext" == "ozip" ]]; then
exit
fi

if [[ ! $(7z l -ba $romzip | grep ".*system.ext4.tar.*\|.*.tar\|.*chunk\|system\/build.prop\|system.new.dat\|system_new.img\|system.img\|payload.bin\|.*.zip\|.*.rar\|.*rawprogram*\|system.sin\|system-p\|super\|UPDATE.APP\|.*.pac" | grep -v ".*chunk.*\.so$") ]]; then
if [[ ! $(7z l -ba $romzip | grep ".*system.ext4.tar.*\|.*.tar\|.*chunk\|system\/build.prop\|system.new.dat\|system_new.img\|system.img\|system.bin\|payload.bin\|.*.zip\|.*.rar\|.*rawprogram*\|system.sin\|system-p\|super\|UPDATE.APP\|.*.pac" | grep -v ".*chunk.*\.so$") ]]; then
echo "BRUH: This type of firmwares not supported"
cd "$LOCALDIR"
rm -rf "$tmpdir" "$outdir"
Expand Down Expand Up @@ -156,6 +158,16 @@ elif [[ $(7z l -ba $romzip | grep ".*.pac") ]]; then
for file in $pac_list; do
$pacextractor $file
done
elif [[ $(7z l -ba $romzip | grep "system.bin") ]]; then
echo "bin images detected"
for partition in $PARTITIONS; do
7z e -y $romzip $partition.bin 2>/dev/null >> $tmpdir/zip.log
done
bin_list=`find "$tmpdir" -type f -name "*.bin" -printf '%P\n' | sort`
for file in $bin_list; do
NEW_NAME=$(echo $file | sed "s|.bin|.img|g")
mv "$tmpdir/$file" "$outdir/$NEW_NAME"
done
elif [[ $(7z l -ba $romzip | grep "system-p") ]]; then
echo "P suffix images detected"
for partition in $PARTITIONS; do
Expand Down

0 comments on commit 5993801

Please sign in to comment.