QEMU binary lookup order
liteWhen searching for the QEMU binary, the launcher checks locations in this specific order:
- The path specified in the
QEMU_BINenvironment variable. - The system
PATH. - The
qemu/bin/directory.
repository·lite·Indexed 43 days ago
https://github.com/worldobservationlog/wrapperA lightweight HTTP wrapper for Apple Music decryption providing a single-port API for M3U8, keys, lyrics, licenses, and web playback. It supports native execution, Docker containerization, and a recommended QEMU guest environment via the wrapper-lite-qemu launcher.
When searching for the QEMU binary, the launcher checks locations in this specific order:
QEMU_BIN environment variable.PATH.qemu/bin/ directory.The lite binary identifies itself to Apple's servers using a device-info string formatted as:
ClientIdentifier/VersionIdentifier/PlatformIdentifier/ProductVersion/DeviceModel/BuildVersion/LocaleIdentifier/LanguageIdentifier/AndroidID
The AndroidID is handled automatically:
--login: It is the FNV-1a 64-bit hash of the account username and is saved to <base-dir>/ANDROID_ID. This ensures a stable identity for the account.ANDROID_ID is reused. If no ID exists, a default is used.You can override the entire string using the --device-info <string> argument.
You can run the host launchers directly. This typically requires a two-step process: first logging in to cache tokens, then starting the HTTP service.
Use --login with credentials. If using --code-from-file, the 2FA code should be placed in data/2fa.txt (or the path specified by --base-dir).
./wrapper-lite-rootless --login user:pass --code-from-file --base-dir /dataOnce logged in, start the service by specifying the host and port.
./wrapper-lite-rootless --base-dir /data --host 0.0.0.0 --port 12340# Login, cache tokens, then exit
./wrapper-lite-rootless --login user:pass --code-from-file --base-dir /data
# Start the HTTP service
./wrapper-lite-rootless --base-dir /data --host 0.0.0.0 --port 12340To use wrapper-lite-qemu, you must first build the QEMU assets (vmlinuz, initramfs, etc.) and then compile the launcher binary.
busybox-static to be downloaded via apt-get.wrapper-lite-qemu.cpp source using a C++11 compatible compiler.# Build QEMU assets
apt-get download busybox-static
./qemu/build.sh
# Build launcher
c++ -std=c++11 -O2 -o wrapper-lite-qemu wrapper-lite-qemu.cppThe wrapper-lite-qemu launcher is the recommended method. It boots a self-contained QEMU guest and forwards the HTTP API to the host, eliminating the need for a rooted device or native chroot.
c++ -std=c++11 -O2 -o wrapper-lite-qemu wrapper-lite-qemu.cppFirst, run the login command to forward the --login flag to the guest. Then, run the launcher without arguments to start the service.
./wrapper-lite-qemu --login user:pass --code-from-file
./wrapper-lite-qemuThe launcher looks for the QEMU binary in this order:
--qemu-bin <path> or the QEMU_BIN environment variable.PATH.qemu/bin/ directory.# one-time: build the launcher
c++ -std=c++11 -O2 -o wrapper-lite-qemu wrapper-lite-qemu.cpp
# login first
./wrapper-lite-qemu --login user:pass --code-from-file
# then serve
./wrapper-lite-qemuExecute the wrapper-lite-qemu binary to start the guest environment.
Argument Forwarding: All arguments passed to the launcher are forwarded line-by-line to the wrapper-lite instance running inside the QEMU guest, with the exception of the --accel flag.
# View help
./wrapper-lite-qemu --help
# Login with credentials and specify a base directory
./wrapper-lite-qemu --login user:pass --base-dir /data
# Run with default settings
./wrapper-lite-qemuTo build the project from source, use CMake. The build produces three main binaries: rootfs/system/bin/lite (the Android-layer binary), wrapper-lite (privileged host launcher), and wrapper-lite-rootless (rootless host launcher using user namespaces).
Builds with SSL verification enabled by default.
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)Builds with SSL verification disabled by default.
cmake .. -DCMAKE_BUILD_TYPE=DebugYou can containerize the wrapper using the provided Dockerfile.
docker build -t wrapper-lite:local .
docker run --privileged -p 12340:12340 \
-v ./rootfs/data:/app/rootfs/data \
-e USERNAME=... -e PASSWORD=... \
wrapper-lite:localThe launcher automatically attempts to use the best available acceleration based on your host OS:
You can force a specific acceleration mode using the --accel flag.
Note for Windows WHPX users: When using WHPX, the system uses -accel whpx,kernel-irqchip=off and -cpu qemu64-v1 internally.
./wrapper-lite-qemu --accel kvm ...
./wrapper-lite-qemu --accel hvf ...
./wrapper-lite-qemu --accel whpx ...
./wrapper-lite-qemu --accel tcg ...The app service is defined in compose.yaml and can be configured using the following settings:
NDK_VERSION: Specifies the Android NDK version used during the build process. Defaults to 23 in the provided configuration.USERNAME: The username for the application (passed from the host environment).PASSWORD: The password for the application (passed from the host environment)../rootfs/data is mounted to /app/rootfs/data inside the container to persist data.12340 on both the host and the container (12340:12340).seccomp:unconfined to allow broader system call access, which may be required for the underlying emulation or native execution.services:
app:
build:
context: .
dockerfile: Dockerfile
args:
NDK_VERSION: 23
volumes:
- ./rootfs/data:/app/rootfs/data
ports:
- "12340:12340"
environment:
USERNAME: ${USERNAME}
PASSWORD: ${PASSWORD}
security_opt:
- seccomp:unconfinedUse the following environment variables to customize the guest environment and host connectivity.
| Variable | Default | Description |
|----------|---------|-------------|
| `HOST_PORT` | `12340` | host port |
| `GUEST_PORT` | `12340` | guest port |
| `MEMORY` | `512` | guest memory in MB |
| `SMP` | `2` | guest CPU count |
| `LITE_QEMU_ACCEL` | auto | force acceleration |
| `QEMU_BIN` | auto | QEMU binary path |The wrapper-lite-qemu launcher accepts the following arguments to control the guest and host networking. Environment variables can be used as fallbacks.
| Argument | Default | Description |
|---|---|---|
--host <addr> | 127.0.0.1 | host address the forwarded port binds to (0.0.0.0 to expose) |
--host-port <port> | 12340 | host port |
--guest-port <port> | 12340 | guest port |
--guest-host <addr> | 0.0.0.0 | address the guest lite listens on |
--memory <MB> | 512 | guest memory in MB |
--smp <N> | 2 | guest CPU count |
--accel <accel> | auto | force acceleration (kvm, hvf, whpx, tcg) |
--qemu-bin <path> | auto | QEMU binary path |
Environment Variables:
LITE_QEMU_HOST / HOST_PORT / GUEST_PORT / LITE_GUEST_HOST / MEMORY / SMP / LITE_QEMU_ACCEL / QEMU_BIN