Skip to content

Instantly share code, notes, and snippets.

@winstonma
Last active January 6, 2024 16:38
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • 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