A lightweight Python CLI tool to unlock Xiaomi devices, replacing the legacy Java-based XiaomiToolV2.
- Minimalistic: Single-file Python script.
- Cross-Platform: Works on Linux, macOS, and Windows (requires python3).
- Transparency: Clear, readable code implementing the official unlocking protocol.
- Python 3.7+
fastbootinstalled and in your system PATH.- Python libraries:
pycryptodome,requests.
- Clone this repository.
- Run the installer:
chmod +x install.sh ./install.sh
-
Get Credentials:
- Log in to account.xiaomi.com.
- Extract
userIdandpassTokencookies from your browser developer tools.
-
Run the Tool:
./mi_unlock --userid <YOUR_USER_ID> --token <YOUR_PASS_TOKEN>
-
Follow Instructions:
- Put your device in Fastboot mode (Volume Down + Power).
- The tool will detect the device and attempt to unlock it.
For a detailed explanation of the unlock mechanism, see UNLOCK_MECHANISM.md.
Unlocking your bootloader may void your warranty. Use this tool at your own risk.