Skip to content

Commit

Permalink
add nb0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Vachounet authored and erfanoabdi committed Jan 21, 2020
1 parent e14b3d3 commit fa107ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion extractor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# bin images
# pac
# sign images
# nb0

usage() {
echo "Usage: $0 <Path to firmware> [Output Dir]"
Expand Down Expand Up @@ -43,6 +44,7 @@ ozipdecrypt="$toolsdir/oppo_ozip_decrypt/ozipdecrypt.py"
lpunpack="$toolsdir/$HOST/bin/lpunpack"
splituapp="$toolsdir/splituapp"
pacextractor="$toolsdir/$HOST/bin/pacextractor"
nb0_extract="$toolsdir/$HOST/bin/nb0-extract"

romzip="$(realpath $1)"
romzipext=${romzip##*.}
Expand Down Expand Up @@ -72,7 +74,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\|system-sign.img\|system.bin\|payload.bin\|.*.zip\|.*.rar\|.*rawprogram*\|system.sin\|.*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-sign.img\|system.bin\|payload.bin\|.*.zip\|.*.rar\|.*rawprogram*\|system.sin\|.*system_.*\.sin\|system-p\|super\|UPDATE.APP\|.*.pac\|.*.nb0" | grep -v ".*chunk.*\.so$") ]]; then
echo "BRUH: This type of firmwares not supported"
cd "$LOCALDIR"
rm -rf "$tmpdir" "$outdir"
Expand Down Expand Up @@ -142,6 +144,17 @@ elif [[ $(7z l -ba $romzip | grep rawprogram) ]]; then
fi
fi
done
elif [[ $(7z l -ba $romzip | grep nb0) ]]; then
echo "nb0 detected"
to_extract=`7z l $romzip | grep ".*.nb0" | gawk '{ print $6 }'`
echo $to_extract
7z e -y $romzip $to_extract 2>/dev/null >> $tmpdir/zip.log
$nb0_extract $to_extract $tmpdir
for partition in $PARTITIONS; do
part=`ls -l | grep ".*$partition.img" | gawk '{ print $9 }'`
mv $part $partition.img
done
romzip=""
elif [[ $(7z l -ba $romzip | grep system | grep chunk | grep -v ".*\.so$") ]]; then
echo "chunk detected"
for partition in $PARTITIONS; do
Expand Down
Binary file added tools/Linux/bin/nb0-extract
Binary file not shown.

0 comments on commit fa107ae

Please sign in to comment.