Skip to content

Instantly share code, notes, and snippets.

@winstonma
Last active May 28, 2024 05:20
Show Gist options
  • Save winstonma/41305920ec95aa1ec2c7b4227ab7e9f0 to your computer and use it in GitHub Desktop.
Save winstonma/41305920ec95aa1ec2c7b4227ab7e9f0 to your computer and use it in GitHub Desktop.
Onyx Boox Image Extractor
# 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"

Onyx Boox Image extractor

This extractor runs on debian linux and allows you to read the image content without owning an Onyx Boox device

Running the script

Please use a Debian based linux device to run the script. Please follow the steps below:

  • Open the the table of supported device on the browser, and find the MODEL column of your desired device
  • Open download.sh, and replace DEVICE_NAME with your name of your desired device
  • Run download.sh

Check the version of the APK file

Run aapt d badging {apk file} | grep versionCode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment