|
# This script is the Onyx Boox download tool |
|
|
|
# Define your |
|
DEVICE_NAME="Nova2" |
|
|
|
# Install required package |
|
sudo apt update && export DEBIAN_FRONTEND=noninteractive \ |
|
&& sudo apt -y install --no-install-recommends python3 python3-pip git brotli jq aapt |
|
|
|
pip3 install pycryptodome |
|
|
|
# Clone the repo |
|
# 1. decryptBooxUpdateUpx |
|
git clone https://github.com/Hagb/decryptBooxUpdateUpx.git |
|
# 2. sdat2img |
|
git clone https://github.com/xpirt/sdat2img.git |
|
|
|
# Download the latest image |
|
urlParam='where={"buildNumber":0,"buildType":"user","deviceMAC":"","lang":"en_US","model":"'${DEVICE_NAME}'","submodel":"","fingerprint":""}' |
|
content=$(curl -G "http://data.onyx-international.cn/api/firmware/update" --data-urlencode ${urlParam}) |
|
fingerprint=$( jq -r '.fingerprint' <<< "${content}" ) |
|
url=$( jq -r '.downloadUrlList[0]' <<< "${content}" ) |
|
printf "\nFingerprint: ${fingerprint}\n" |
|
printf "URL: ${url}\n\n" |
|
wget ${url} |
|
printf "Done Downloading\n" |
|
|
|
# Convert UPX into ZIP |
|
printf "Start decrypting the image\n" |
|
filename=$(basename ${url}) |
|
python3 decryptBooxUpdateUpx/DeBooxUpx.py ${DEVICE_NAME} ${filename} |
|
printf "Image decryption completed\n" |
|
rm ${filename} |
|
|
|
# Extract the ZIP file |
|
unzip update.zip system.transfer.list system.new.dat.br |
|
rm update.zip |
|
|
|
# Extract system.img |
|
brotli --decompress system.new.dat.br |
|
rm system.new.dat.br |
|
python3 sdat2img/sdat2img.py system.transfer.list system.new.dat |
|
rm system.transfer.list system.new.dat |
|
|
|
# Mount system.img |
|
sudo umount output |
|
mkdir -p output |
|
sudo mount -t ext4 -o ro,loop system.img output |
|
|
|
printf "The system partition is now mounted in output directory" |
|
printf "After finish, please run the following command:\n" |
|
printf " sudo umount output" |