offici5l / miunlocktool Goto Github PK
View Code? Open in Web Editor NEWMiUnlockTool developed to retrieve encryptData(token) for Xiaomi devices for unlocking bootloader, It is compatible with all platforms.
License: Apache License 2.0
MiUnlockTool developed to retrieve encryptData(token) for Xiaomi devices for unlocking bootloader, It is compatible with all platforms.
License: Apache License 2.0
phone connected
DeviceInfo:
unlocked: None
product: zircon
token: *********
Device is allready unlocked !
fastboot getvar unlocked
unlocked: yes
Finished. Total time: 0.018s
I have been trying to unlock the bootloader of Poco m3. It always give me an error device not activated, activate device and try again. I searched this error and turns out I need to activate my sim in the miui account. But everytime I do that the Xiaomi sim activation service fails. Please make a fix for this, some bypass or anything
I cloned your repo and setup a venv and downloaded and unzipped a fresh darwin androidtools.
after realizing that your setup.py didn't have setuptools module in it, I ran it using the interpretor,
using python setup.py
.
Please add that in the README so folks knows.
I copied the 'offici5l-un-lock.py' to my 'platform-tools' dir created from the unzipping of the platformtools zipfile, and after running through the prompts in the script I got this error:
device token:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
device product:
lancelot
code: 10000 descEN: Request parameter error
Invalid device token or product.
Traceback (most recent call last):
File "/xxxxx/xxxxxx/xxxxxxxxxxxx/mitool/miunlock/platform-tools/offici5l-un-lock.py", line 224, in <module>
exec("\n".join(line for i, line in enumerate(codecs.open('un-lock.py', 'r', 'utf-8').read().split('\n'), 1) if i not in range(10, 27)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen codecs>", line 906, in open
FileNotFoundError: [Errno 2] No such file or directory: 'un-lock.py'
parts are obfuscated for security, but you can see that 'un-lock.py' is returning a Error no 2, as
I've stated above. Was that because you decided to rename the script from 'un-lock.py' to 'offici5l-un-lock.py'. There isn't any reference to this in the README, and the file doesn't appear in the repo.
When I think about it it doesn't make sense that 'un-lock.py' is a typo, since there won't much need to open another file from a script where all the data is already accessible.
It is very non-plus.
In looking through the MiTool main repo there is the identical layout with one exception being that the open()
function is pointing towards an address on the termux filesystem.
It says something like '/data/data/com.termux/files/usr/bin/un-lock.py' or soemthing.
and in the repo there is actually a file called 'un-lock.py' as oppsed to here where there is only a 'offici5l-un-lock.py'. Maybe that is the source of the problem.
I put up a long sprawling post about it where I suggest near the end that you might have a feature here that dumps the token so that a user might use it with a fastboot command.
the tool crashes and failed to start windows 10 pro and latest python installed
terminal:
invalid product or deviceToken
Check if device is connected in bootloader mode...
product saved.
and the R S OK page url doesn't return deviceToken
After waiting the 168 hours, I was disappointed when the unlocking failed.
Here's the output:
Press Enter to unlock bootloader
Sending 'encryptData' (0 KB) FAILED (remote: 'Download is not allowed on locked devices')
fastboot: error: Command failed
FAILED (remote: 'Command not supported in default implementation')
fastboot: error: Command failed
________________________________________________________
(version: 1.5.0) For issues or feedback:
- GitHub: github.com/offici5l/MiUnlockTool/issues
- Telegram: t.me/Offici5l_Group
Press Enter to exit ...MiUnlockTool.py
Why is this happening? How do I fix it?
Thank you
code: 20038
description: 该手机已被账号 221****878 通过查找手机锁定,无法解锁
translates to : This phone has been locked by account 221****878 through Find Phone and cannot be unlocked
(remote: 'Token Verify Failed, Reboot the device')
The solution is (if the data has not been automatically refreshed by the device to Xiaomi servers... synchronization):
Insert the same SIM card you used previously in the exact same slot(1 or 2) (if your phone supports dual SIM).
Reboot the device in normal mode.
Wait a few seconds (until the SIM card data is automatically reset).
Reboot the device in bootloader mode. Then try again.
When a request is sent to the Xiaomi server through the "Mi Unlock status" in developer settings, multiple pieces of data, including SIM card data, are sent.
The "Token Verify Failed" issue occurs due to removing the SIM card from the device or replacing it with another card after linking the account in developer options. Consequently, upon restarting the device, the device's data will be updated, meaning it won't contain the SIM card data initially sent to the Xiaomi server. As a result, when attempting to unlock the bootloader via the tool, the server will send an unlock token based on the initial data, leading to conflicting information and resulting in the "Token Verify Failed" error.
notice :
To avoid this error in the future, please refrain from removing the SIM card from the device until the bootloader is successfully unlocked.
My best regards. I'm stuck with the dreaded "device not activated" error (apart from the fact that activating hasn't ever been a compulsory step while just binding under developer options has always been enough, my device is correctly activated instead) arisen only after waiting for the time asked by Xiaomi and I've tried to install miunlock according to the guidelines.
I log in with Mi account only after launching the script and, just to be on the safe side, I start with a browser with empty cache. Tried three different browsers too (Kiwi, Fennec and Soul) with the same outcome. After logging in, I get no confirmation page with the token in its address but just errors (401 with Kiwi and Fennec, net::ERR_HTTP_RESPONSE_CODE_FAILURE with Soul) at this address.
If I try to paste that address, miunlock says it can't find the token there but I'm not surprised given that I'm leaving the path very well outlined in the documentation.
Considering, I've strictly adehered to the setup and usage guidelines, I tend to exclude errors on my side and so I do with a bug in the script itself so I believe Xiaomi has changed something, again, to prevent users from successfully unlocking bootloaders.
Have a nice day! :)
So am using MacOS btw and am my device is the Xiaomi Note 9 (merlin) and am getting this error
code 10000
Request parameter error
invalid product or token
i have no idea how to fix this so please help me with this, thank you!
I committed un-lock to the AUR un-lock-git
I found that pyshorteners has been archived, and running it on Arch may be missing the corresponding dependency packages, can I replace them with python packages that already exist on other arch?
issue "Not connected to the phone !"
Sometimes just try reboot device to bootloader mode again solves the problem
Some devices take a long time to recognize the device The default time set is 6 seconds, so this can be changed by increasing the time with the command :
miunlock time12
(Instead of 12, you can use the time you see fit, "in seconds")
therefore, if you encounter problems, you can change the device in which you use the termux because the problem is only in some devices
If you do not have another device, you can use manual mode with command :
miunlock -m
If the fastboot commands do not work for you in termux, you can use other app such as the bugjaeger to obtain information.
command to get product
fastboot getvar product
command to get token
fastboot getvar token
or for mtk
fastboot oem get_token
When I try to unlock my redmi k60 with hyperos I get this error. How do I fix it?
Traceback (most recent call last):
File "/root/xiaomi/MiBypassTool.py", line 105, in <module>
headers = {"Cookie": re.search(r"Cookie=\[(.*)\]", AES.new(b'20nr1aobv2xi8ax4', AES.MODE_CBC, b'0102030405060708').decrypt(base64.b64decode(headers)).rstrip(b'\0').decode('utf-8')).group(1).strip(), "Content-Type": "application/x-www-form-urlencoded"}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 2: invalid start byte
So I've waited for 300 hours to unlock the bootloader, today did run the app, got the following warning:
user data will be cleared when the device is unlocked.
Press Enter to unlock bootloader
So I had to cancel (via ctrl+c) to back my data up, and after that on the next app run got the following:
code 20030
Sorry, couldn't unlock more devices by this account this month.
Guess there should be a warning for that.
get something wrong
`
securityStatus 16
Please go to: settings > Mi Account > Devices > select Current device > Find device "enable Find device"
`
but, I have finish this. Find device is enabled.
My phone is RedMi K7Pro
After entering the link, program output is as follows:
wb_id saved successfully
Check if the device is connected in bootloader mode...
product saved successfully
Check if the device is connected in bootloader mode...
Check if the device is connected in bootloader mode...
token saved successfully
DeviceInfo:
product: vili
token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AccountInfo:
id: xxxxxxxxxx
region: europe
________________________________________________________
Traceback (most recent call last):
File "/home/karl/Downloads/MiUnlockTool.py", line 222, in <module>
with open("encryptData", "wb") as edfile:
^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'encryptData'
(Account data and token are obviously different). There seems to be a problem with opening the code file? I can't quite track down the problem.
code 20035 = Please upgrade your unlock tool.
If you are using an official tool or other tools Download the latest version of the tool.
If you are using the MiUnlockTool, Just update "clientVersion":"Place a higher version than the previous one"
You find it in the file MiUnlockTool.py., in the line containing :
r = RetrieveEncryptData("/api/v3/ahaUnlock", {"appId":"1", "data":{"clientId":"2", "clientVersion":"7.6.727.43", .........
I'm getting "Failed to obtain the deviceProduct. Please enter it manually:" but I don't know what to enter. Thanks for any help!
code 10013 = This device is not activated, please activate it and try to unlock it again
the issue is due to changing a piece of the phone's hardware, most likely the motherboard
Currently, there is no solution for this issue unfortunately
The only solution currently is to contact the Xiaomi support team.
When sending a request to Xiaomi's server through developer settings "Mi Unlock status" the following information is sent to Xiaomi's server for verification:
I believe the issue is related to cloudsp_fid, which is the security DeviceId.
Therefore, Xiaomi's server, upon analyzing the security DeviceId, returns error code 10013 when attempting to unlock the bootloader.
Hi,
Thank you for your work 🙏
In my case the script is failing at line 222 because I'm receiving code 10000
in the response:
elif "code" in r and r["code"] == 10000:
remove("product", "token")
sys.exit()
Do you have any idea why? My password contains special characters like ~,>!
. Could it be an encoding issue?
code 20030 = Sorry, couldn't unlock more devices by this account this month
The reason is because you have already unlocked a device recently from one Mi account at once
You must wait for the beginning of next month, meaning the 1st of next month ( according to the time zone of the server region )
Question:
But I haven't unlocked any device before!
Answer:
Yes, but you have used a bootloader unlocking tool before (or reason) with the same account (whether it's official or unofficial doesn't matter).
The Xiaomi server has indeed sent the encryptedData(token) before, to unlock the bootloader. So, whether you have previously unlocked a device or failed to unlock the same device, it doesn't matter. Because new data (with the same account) For some Reason(explained at the end of the answer) was sent to the server that doesn't match the data sent in the initial attempt. Therefore, the Xiaomi server considers that you're attempting to unlock a new device, and it only allows unlocking one device per month.
Reason: after the last encryptedData(token) received from the server(
) Conclusion: data no longer matches > So Xiaomi's server considers it a new device
If logged in with any account(Xiaomi) in your default browser, please log out Before running the tool
This can be checked by opening the following link in the [ default browser ] : https://account.xiaomi.com
If you have not linked an email or phone number to your Xiaomi account, please do so
If the problem persists, Please go to:
settings > Mi Account > Devices > select Current device > Find device "enable Find device
I am trying to unlock the Redmi 5 Plus (vince). I finished with this:
=========================================================
product saved successfully
token saved successfully
DeviceInfo:
product: vince
token: ******
AccountInfo:
id: ******
region: *******
code: 20038
What I found strange is that in settings there is information that the device is unlocked. But the output of command "fastboot oem device-info" is different:
(bootloader) Device unlocked: false
(bootloader) Device critical unlocked: false
I would appreciate any idea how to solve it. Thank you.
Sending 'encryptData' (0 KB) FAILED (remote: 'Download is not allowed on locked devices')
fastboot: error: Command failed
FAILED (remote: 'Command not supported in default implementation')
fastboot: error: Command failed
Device: Redmi K50
product: rubens
First of all, I want to thank you for this script that helped me unlock the bootloader on Poco M6 Pro on Linux Desktop, however, I do not understand why there are no warnings that all data in the device's internal memory will be erased after unlocking the bootloader?
Probably not a bug of the tool, but I'm stuck and don't know how to proceed.
I got this code when trying to unlock. Unfortunately I can't add a recovery phone to my MI account. The options suggested in https://account.xiaomi.com/helpcenter/faq/en_US/03.account-safety/04.security-phone-and-email/faq-3 aren't there. I even tried creating a new MI account on another phone so it links to it, but it didn't work.
Does anybody have an idea on how to do this? Thanks in advance!
What is the reason for this? Do you want to enter Fastboot mode link?
Traceback (most recent call last):
File "/home/muqiu/Applications/MiUnlockTool/MiUnlockTool.py", line 194, in <module>
data = json.loads(requests.get("https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&_json=true&passive=true&hidden=true", headers=headers, cookies={'passToken': p['passToken'], 'userId': str(p['userId']), 'deviceId': parse_qs(urlparse(p['location']).query)['d'][0]}).text.replace("&&&START&&&", ""))
~^^^^^^^^^^^^^
KeyError: 'passToken'
I kept getting Failed to obtain the token! Please enter it manually:
until I noticed that the device shows "fastbootd" in blue instead of "fastboot" in orange. After entering fastboot the other way it worked.
Look like adb reboot fastboot
is not the same as entering fastboot using button presses.
MiUnlockTool may show a helpful message that the device may be not in the expected mode when fastboot
platform tool works, but getting the code fails.
Also the message itself may be more specific "Failed to obtain the token from the device" - I initially assumed it fails to get the code from Xiaomi.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.