Xiaomi Bootloader Unlock Request Timing Optimizer
Herramienta automatizada para optimizar el timing de solicitudes de desbloqueo del bootloader
unlockBOOTLOADER es una herramienta de línea de comandos que automatiza y optimiza el proceso de solicitud de desbloqueo del bootloader en dispositivos Xiaomi.
Utiliza:
- ⏰ Sincronización NTP ultra-precisa con servidores atómicos
- 🚀 Optimizaciones de red avanzadas (TLS pre-warming, Keep-Alive)
- 🎯 Timing perfecto para maximizar probabilidades de éxito
| Característica | Descripción |
|---|---|
| 🎯 Sincronización NTP | Servidores atómicos: Google, Cloudflare, NIST, Windows |
| ⚡ Optimización Red | TLS pre-warming, HTTP/1.1 Keep-Alive, timeouts agresivos |
| 🔥 Ráfaga Automática | Múltiples peticiones en el momento exacto (00:00:00 Pekín) |
| 📊 Countdown Real-Time | Visualización HH:MM:SS hasta el momento crítico |
| 🎨 UI Profesional | Interfaz colorida con emojis y ASCII art |
| 📝 Logging Detallado | Timestamps con precisión de milisegundos |
| 🛡️ Error Handling | Recuperación automática de fallos de red |
| 📁 Rutas Automáticas | Funciona desde cualquier ubicación |
- Python 3.7 o superior
- pip (incluido con Python)
- Nevegador Firefox
- Navegador Google Chrome
- Conexión a Internet estable- Descarga
unlockBOOTLOADER.zipdesde Releases - Descomprime el archivo
En la carpeta que se creo cuando descomprimiste unlockBOOTLOADER.zip, crea estos dos archivos:
token.txt
timeshift.txt
El archivo token.txt lo abriras con el Bloc de Notas y lo vas a editar de la siguiente forma
1
2
3
4
Pondras esas filas de numeros
Y el archivo timeshift.txt tambien lo abriras y lo editaras de la siguiente manera
300
280
260
240
Hay DOS métodos para extraer los tokens necesarios:
- Abre Firefox e instala la extensión "Cookie Editor"
Le das en Add to Firefox
Luego le das en Añadir
Una vez añadido te saldra esta Barra Lateral de opciones
-
Ve a: https://c.mi.com/global/
-
Inicia sesión con tu cuenta Mi y espera a que cargue todo el contenido
-
Abre Cookie Editor (ícono en la barra lateral izquierda)
-
Busca la cookie:
new_bbs_serviceToken -
Copia el valor completo (será muy largo)
Click derecho sobre el valor, luego le das Ctrl + A para selecionar todo y luego Ctrl + C para copiar
-
Ahora vas a abrir el archivo token.txt y vas a pegar ese token en la linea 1 y 3, (elimina el numero de linea) te deberia quedar algo asi:
token_ejemplo_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
2
token_ejemplo_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
4
Le das Ctrl + G y guardas
- Ve a: https://c.mi.com/global/
- Inicia sesión con tu cuenta Mi, acepta todas las Cookies y espera a que cargue todo tu contenido
- Pega este código en la barra de direcciones (URL):
javascript :(function(){var token=document.cookie.match(/popRunToken=([^;]+)/);if(token){prompt("Copy the token:", token[1]);}else{alert("Token not found");}})()-
⚠️ IMPORTANTE: Elimina el espacio entrejavascripty: -
Presiona Enter
-
Dale Ctrl + C y copia el token del popup
-
Ahora ese token lo vas a pegar en el archivo token.txt en la linea 2 y 4 (elimina el numero de linea) y te quedaria algo asi:
token_ejemplo_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
token_ejemplo_googleNiTl2rmQWNdB7pABjG7Ac1twOzL%2F%2BD6nbR1D%2BUwg%2BTbJ%2B8H%2
token_ejemplo_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
token_ejemplo_googleNiTl2rmQWNdB7pABjG7Ac1twOzL%2F%2BD6nbR1D%2BUwg%2BTbJ%2B8H%2
El timeshift es CRÍTICO para el éxito. Si tienes múltiples cuentas/tokens (ej. 4 tokens), te recomendamos usar una estrategia de "ráfaga escalonada" para maximizar tus probabilidades.
Pon estos 4 valores en tu archivo timeshift.txt (un valor por línea en el mismo orden) ajustándolos según tu ubicación:
| Ubicación/Conexión | Latencia Típica | Valores Recomendados (timeshift.txt) | Notas |
|---|---|---|---|
| 🌎 América Latina (Wi-Fi) | 120-200ms | 340, 320, 300, 280 | Cubre variaciones de ping por Wi-Fi |
| 🌎 América Latina (Fibra) | 80-120ms | 300, 280, 260, 240 | Óptimo para conexiones muy rápidas |
| 🌍 Europa | 150-250ms | 360, 340, 320, 300 | Compensa la distancia física a Asia |
| 🌏 Asia | 20-80ms | 260, 240, 220, 200 | Valores bajos por proximidad a servidores |
| 🏢 Conexión Corporativa | Variable | 350, 330, 310, 290 | Compensa el retraso de Firewalls/VPNs |
🎯 El mejor truco para ajustar tu estrategia: Cuando ejecutes el script, observa atentamente esta línea en tu consola:
⏱️ Sincronizando con time.google.com... ✓ (latencia: 290.5ms)
Utiliza ese número como tu punto central. Si la consola muestra 290ms, deberías crear un bloque que lo rodee, por ejemplo: 310, 300, 290, 280.
🛠️ Corrección de Errores:
- Si el servidor te dice "cuota agotada" pero tu respuesta llegó antes de las 00:00:00 → Estás disparando muy temprano. Resta 20ms a todo tu bloque de valores.
- Si llegas a las 00:00:00 pero alguien te gana el puesto → Estás llegando tarde. Suma 20ms a todo tu bloque de valores.
La forma más rápida y sencilla de ejecutar el script es abriendo la consola de comandos (CMD) directamente desde la carpeta del proyecto.
-
Abre el Explorador de Archivos y ve a la carpeta donde descargaste y descomprimiste el proyecto (donde están los archivos
unlockBOOTLOADER.py,token.txtytimeshift.txt). -
Haz clic en la barra de direcciones en la parte superior (donde se ve la ruta de la carpeta, que quedará seleccionada en azul).
-
Borra toda esa ruta, escribe la palabra
cmdy presiona la tecla Enter. -
Se abrirá una ventana negra de la consola (Símbolo del sistema) ya ubicada exactamente en esa carpeta.
-
Para iniciar el programa, simplemente escribe el siguiente comando y presiona Enter:
python unlockBOOTLOADER.py
💡 TIP PRO: Ejecución Múltiple (Estrategia de 4 Tokens)
Ya que tienes 4 tokens configurados en tu archivo
token.txty 4 valores de latencia escalonados entimeshift.txt, puedes maximizar tus probabilidades de éxito ejecutándolos al mismo tiempo:
- Repite el Paso 3 para abrir 4 ventanas de CMD distintas.
- Escribe
python unlockBOOTLOADER.pyy presiona Enter en cada una de ellas.- Cuando el script te solicite el "Número de línea del token", ingresa
1en la primera ventana,2en la segunda,3en la tercera y4en la cuarta.De esta manera, tendrás 4 procesos corriendo en paralelo esperando la medianoche. El script disparará las 4 peticiones automáticas con los 4 tiempos de desfase diferentes que configuraste, cubriendo perfectamente todos los márgenes posibles de tu conexión y asegurando que alguna llegue en el milisegundo exacto.
- Ingresa el número de línea del token
- El script mostrará:
- ✅ Estado de la cuenta
- ⏰ Sincronización NTP
- 📊 Countdown hasta medianoche Pekín
- 🚀 Resultado de las peticiones
¿Este script desbloquea mi bootloader directamente?
No. Este script solo optimiza el timing de la solicitud de autorización a los servidores de Xiaomi. Después de recibir autorización, aún necesitas usar la Mi Unlock Tool oficial para desbloquear físicamente el bootloader.
¿Por qué necesito un timeshift?
Xiaomi resetea las cuotas diarias a las 00:00:00 hora de Pekín. Debido a la latencia de red (tu ubicación → servidores en Asia), tu petición tarda en llegar. El timeshift compensa ese retraso para que llegue exactamente a las 00:00:00.
¿Cuántos intentos tengo?
Generalmente uno por día por cuenta. Si fallas, espera 24 horas. Algunos usuarios reportan bloqueos de 168 horas (7 días) si se abusa.
¿Funciona en todos los dispositivos Xiaomi / Redmi / POCO?
Sí, pero debido a las nuevas políticas de seguridad de Xiaomi (HyperOS), debes cumplir requisitos muy estrictos y seguir un orden específico:
- Antigüedad de la cuenta: Tu Cuenta Mi debe haber sido creada hace más de 30 días y estar activa de forma continua.
- Región Global: Este script aplica para cuentas y dispositivos de la región Global. (La ROM China tiene un sistema diferente que requiere Nivel 5 en su foro).
- Orden correcto del proceso:
- Paso 1 (Autorización): Usas este script para conseguir el cupo en los servidores de Xiaomi a la medianoche.
- Paso 2 (Vinculación): Una vez el script te marque "🎉 ¡AUTORIZACIÓN CONCEDIDA!", vas a tu teléfono (Ajustes > Opciones de Desarrollador > Estado de Mi Unlock) y vinculas tu cuenta al dispositivo.
- Paso 3 (Desbloqueo): Usas la herramienta oficial Mi Unlock Tool en tu PC para realizar el desbloqueo físico del bootloader (es posible que la herramienta te pida esperar 72 horas o más después de vincular).
Si no tienes los 30 días en tu cuenta o intentas vincular el teléfono antes de conseguir la autorización con el script, los servidores de Xiaomi te rechazarán.
¿Es seguro usar este script?
El código es open-source y puedes revisarlo. No contiene malware. Sin embargo, usar herramientas no oficiales puede violar los ToS de Xiaomi. Usa bajo tu propio riesgo.
Mi token dice "caducado". ¿Qué hago?
Los tokens expiran. Simplemente obtén uno nuevo siguiendo la guía de extracción.
⚠️ IMPORTANTE - LEE ANTES DE USAR
✗ Este script NO desbloquea tu bootloader directamente
✗ Solo optimiza el timing de la solicitud de autorización
✓ Aún necesitas usar Mi Unlock Tool oficial después
✗ Puede violar los Términos de Servicio de Xiaomi
✗ NO garantiza éxito - solo maximiza probabilidades
✗ Xiaomi puede banear cuentas que detecte usando automatización
✗ Desbloquear el bootloader BORRA todos tus datos
✗ Puede invalidar tu garantía
✗ Uso completamente bajo tu PROPIO RIESGO
El autor (@kevxngg) NO se hace responsable de:
- Cuentas baneadas
- Datos perdidos
- Garantías invalidadas
- Problemas con dispositivos
| Problema | Solución |
|---|---|
| ❌ "Archivo token.txt no encontrado" | Crea token.txt en la misma carpeta que el script |
| ❌ "Token caducado" | Obtén un nuevo token (expiran cada pocas horas) |
| ❌ "No se pudo sincronizar NTP" | Verifica tu conexión a Internet / Firewall |
| ❌ Siempre llega tarde | Reduce el timeshift en 20ms |
| ❌ Siempre llega temprano | Aumenta el timeshift en 20ms |
| ❌ "Cuota global agotada" | Espera 24 horas e intenta de nuevo |
| ❌ Script no encuentra archivos en VSCode | Usa la versión v2.1 que tiene fix de rutas |
¡Las contribuciones son bienvenidas!
- Fork este repositorio
- Crea una Feature Branch (
git checkout -b feature/MejoraNueva) - Commit tus cambios (
git commit -m 'Agregar MejoraNueva') - Push a la Branch (
git push origin feature/MejoraNueva) - Abre un Pull Request
- 🌐 Traducciones a otros idiomas
- 📊 Estadísticas de éxito por región
- 🎨 Mejoras en la UI
- 🐛 Reportar/corregir bugs
- 📝 Mejorar documentación
- ✅ Fix de rutas relativas (funciona desde cualquier ubicación)
- ✅ Banner profesional ASCII art
- ✅ Guía integrada de extracción de tokens
- ✅ Mejoras en mensajes de error
- ✅ Display de directorio de trabajo
- ✅ Refactorización completa del código
- ✅ Type hints en funciones
- ✅ Countdown en tiempo real
- ✅ Múltiples servidores NTP
- ✅ Display de latencia
- ✅ UI con colores y emojis
Este proyecto está bajo la Licencia MIT. Ver archivo LICENSE para más detalles.
MIT License
Copyright (c) 2026 kevxngg
Se concede permiso, de forma gratuita, a cualquier persona que obtenga una copia
de este software y archivos de documentación asociados (el "Software"), para
utilizar el Software sin restricciones...
Si este proyecto te ayudó, considera:
- ⭐ Darle una estrella en GitHub
- 🐛 Reportar bugs o sugerir mejoras
- 🤝 Contribuir con código o documentación
- 📢 Compartirlo con otros que lo necesiten
unlockBOOTLOADER is a command-line tool that automates and optimizes the Xiaomi bootloader unlock request process.
It uses:
- ⏰ Ultra-precise NTP synchronization with atomic servers
- 🚀 Advanced network optimizations (TLS pre-warming, Keep-Alive)
- 🎯 Perfect timing to maximize success probabilities
| Feature | Description |
|---|---|
| 🎯 NTP Synchronization | Atomic servers: Google, Cloudflare, NIST, Windows |
| ⚡ Network Optimization | TLS pre-warming, HTTP/1.1 Keep-Alive, aggressive timeouts |
| 🔥 Automated Burst | Multiple requests at the exact moment (00:00:00 Beijing) |
| 📊 Real-Time Countdown | HH:MM:SS display until the critical moment |
| 🎨 Professional UI | Colorful interface with emojis and ASCII art |
| 📝 Detailed Logging | Timestamps with millisecond precision |
| 🛡️ Error Handling | Automatic recovery from network failures |
| 📁 Automatic Paths | Works from any location |
- Python 3.7 or higher
- pip (included with Python)
- Firefox Browser
- Google Chrome Browser
- Stable Internet connection- Download
unlockBOOTLOADER.zipfrom Releases - Unzip the file
In the folder created when you unzipped unlockBOOTLOADER.zip, create these two files:
token.txt
timeshift.txt
You will open the token.txt file with Notepad and edit it as follows:
1
2
3
4
You will put those rows of numbers.
And you will also open the timeshift.txt file and edit it like this:
300
280
260
240
There are TWO methods to extract the necessary tokens:
- Open Firefox and install the "Cookie Editor" extension
Click on Add to Firefox
Then click on Add
Once added, this options Sidebar will appear
-
Go to: https://c.mi.com/global/
-
Log in with your Mi account and wait for all the content to load
-
Open Cookie Editor (icon on the left sidebar)
-
Search for the cookie:
new_bbs_serviceToken -
Copy the complete value (it will be very long)
Right-click on the value, then press Ctrl + A to select all and then Ctrl + C to copy
-
Now you are going to open the token.txt file and paste that token on lines 1 and 3, (delete the line number) it should look something like this:
token_example_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
2
token_example_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
4
Press Ctrl + S and save
- Go to: https://c.mi.com/global/
- Log in with your Mi account, accept all Cookies and wait for all your content to load
- Paste this code into the address bar (URL):
javascript :(function(){var token=document.cookie.match(/popRunToken=([^;]+)/);if(token){prompt("Copy the token:", token[1]);}else{alert("Token not found");}})()-
⚠️ IMPORTANT: Remove the space betweenjavascriptand: -
Press Enter
-
Press Ctrl + C and copy the token from the popup
-
Now you will paste that token into the token.txt file on lines 2 and 4 (delete the line number) and it would look something like this:
token_example_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
token_example_googleNiTl2rmQWNdB7pABjG7Ac1twOzL%2F%2BD6nbR1D%2BUwg%2BTbJ%2B8H%2
token_example_firefox4Gf22VTTk5JjpZa8%2FxhO6XTUVNKLEMfatx2Uovt877noKGTU7%2Fjvx%
token_example_googleNiTl2rmQWNdB7pABjG7Ac1twOzL%2F%2BD6nbR1D%2BUwg%2BTbJ%2B8H%2
The timeshift is CRITICAL for success. If you have multiple accounts/tokens (e.g. 4 tokens), we recommend using a "staggered burst" strategy to maximize your chances.
Put these 4 values in your timeshift.txt file (one value per line in the same order) adjusting them according to your location:
| Location/Connection | Typical Latency | Recommended Values (timeshift.txt) | Notes |
|---|---|---|---|
| 🌎 Latin America (Wi-Fi) | 120-200ms | 340, 320, 300, 280 | Covers Wi-Fi ping variations |
| 🌎 Latin America (Fiber) | 80-120ms | 300, 280, 260, 240 | Optimal for very fast connections |
| 🌍 Europe | 150-250ms | 360, 340, 320, 300 | Compensates physical distance to Asia |
| 🌏 Asia | 20-80ms | 260, 240, 220, 200 | Low values due to server proximity |
| 🏢 Corporate Connection | Variable | 350, 330, 310, 290 | Compensates Firewall/VPN delays |
🎯 The best trick to adjust your strategy: When you run the script, pay close attention to this line in your console:
⏱️ Sincronizando con time.google.com... ✓ (latencia: 290.5ms)
Use that number as your center point. If the console shows 290ms, you should create a block surrounding it, for example: 310, 300, 290, 280.
🛠️ Troubleshooting:
- If the server tells you "quota exhausted" but your response arrived before 00:00:00 → You are shooting too early. Subtract 20ms from your entire block of values.
- If you arrive at 00:00:00 but someone beats you to the spot → You are arriving late. Add 20ms to your entire block of values.
The fastest and easiest way to run the script is by opening the command prompt (CMD) directly from the project folder.
-
Open File Explorer and go to the folder where you downloaded and unzipped the project (where the
unlockBOOTLOADER.py,token.txt, andtimeshift.txtfiles are). -
Click on the address bar at the top (where the folder path is seen, it will be highlighted in blue).
-
Delete that entire path, type the word
cmdand press the Enter key. -
A black console window (Command Prompt) will open, already located exactly in that folder.
-
To start the program, simply type the following command and press Enter:
python unlockBOOTLOADER.py
💡 PRO TIP: Multiple Execution (4 Token Strategy)
Since you have 4 tokens configured in your
token.txtfile and 4 staggered latency values intimeshift.txt, you can maximize your chances of success by running them at the same time:
- Repeat Step 3 to open 4 different CMD windows.
- Type
python unlockBOOTLOADER.pyand press Enter in each of them.- When the script prompts you for the "Token line number", enter
1in the first window,2in the second,3in the third, and4in the fourth.This way, you will have 4 processes running in parallel waiting for midnight. The script will fire the 4 automatic requests with the 4 different offset times you configured, perfectly covering all possible margins of your connection and ensuring that one arrives at the exact millisecond.
- Enter the token line number
- The script will show:
- ✅ Account status
- ⏰ NTP Synchronization
- 📊 Countdown to Beijing midnight
- 🚀 Request results
Does this script unlock my bootloader directly?
No. This script only optimizes the authorization request timing to Xiaomi's servers. After receiving authorization, you still need to use the official Mi Unlock Tool to physically unlock the bootloader.
Why do I need a timeshift?
Xiaomi resets daily quotas at 00:00:00 Beijing time. Due to network latency (your location → servers in Asia), your request takes time to arrive. The timeshift compensates for that delay so it arrives exactly at 00:00:00.
How many attempts do I have?
Generally one per day per account. If you fail, wait 24 hours. Some users report 168-hour (7 days) bans if abused.
Does it work on all Xiaomi / Redmi / POCO devices?
Yes, but due to Xiaomi's new security policies (HyperOS), you must meet very strict requirements and follow a specific order:
- Account age: Your Mi Account must have been created more than 30 days ago and be continuously active.
- Global Region: This script applies to Global region accounts and devices. (The Chinese ROM has a different system requiring Level 5 in their forum).
- Correct process order:
- Step 1 (Authorization): Use this script to secure the spot on Xiaomi servers at midnight.
- Step 2 (Binding): Once the script shows "🎉 AUTHORIZATION GRANTED!", go to your phone (Settings > Developer Options > Mi Unlock Status) and bind your account to the device.
- Step 3 (Unlocking): Use the official Mi Unlock Tool on your PC to perform the physical bootloader unlock (the tool might ask you to wait 72 hours or more after binding).
If you don't have the 30 days on your account or try to bind the phone before getting authorization with the script, Xiaomi servers will reject you.
Is it safe to use this script?
The code is open-source and you can review it. It contains no malware. However, using unofficial tools may violate Xiaomi's ToS. Use at your own risk.
My token says "expired". What do I do?
Tokens expire. Simply get a new one following the extraction guide.
⚠️ IMPORTANT - READ BEFORE USING
✗ This script DOES NOT unlock your bootloader directly
✗ It only optimizes the authorization request timing
✓ You still need to use official Mi Unlock Tool afterwards
✗ May violate Xiaomi's Terms of Service
✗ DOES NOT guarantee success - only maximizes probabilities
✗ Xiaomi may ban accounts detected using automation
✗ Unlocking the bootloader ERASES all your data
✗ May void your warranty
✗ Use completely at your OWN RISK
The author (@kevxngg) is NOT responsible for:
- Banned accounts
- Lost data
- Voided warranties
- Device issues
| Problem | Solution |
|---|---|
| ❌ "token.txt file not found" | Create token.txt in the same folder as the script |
| ❌ "Expired token" | Get a new token (they expire every few hours) |
| ❌ "Could not sync NTP" | Check your Internet connection / Firewall |
| ❌ Always arrives late | Decrease the timeshift by 20ms |
| ❌ Always arrives early | Increase the timeshift by 20ms |
| ❌ "Global quota exhausted" | Wait 24 hours and try again |
| ❌ Script can't find files in VSCode | Use version v2.1 which has path fixes |
Contributions are welcome!
- Fork this repository
- Create a Feature Branch (
git checkout -b feature/NewImprovement) - Commit your changes (
git commit -m 'Add NewImprovement') - Push to the Branch (
git push origin feature/NewImprovement) - Open a Pull Request
- 🌐 Translations to other languages
- 📊 Success statistics by region
- 🎨 UI improvements
- 🐛 Report/fix bugs
- 📝 Improve documentation
- ✅ Relative paths fix (works from any location)
- ✅ Professional ASCII art banner
- ✅ Integrated token extraction guide
- ✅ Error message improvements
- ✅ Working directory display
- ✅ Complete code refactoring
- ✅ Type hints in functions
- ✅ Real-time countdown
- ✅ Multiple NTP servers
- ✅ Latency display
- ✅ UI with colors and emojis
This project is under the MIT License. See the LICENSE file for more details.
MIT License
Copyright (c) 2026 kevxngg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...
If this project helped you, consider:
- ⭐ Giving it a star on GitHub
- 🐛 Reporting bugs or suggesting improvements
- 🤝 Contributing code or documentation
- 📢 Sharing it with others who might need it












