Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error during unlocking caused by 'fastboot getvar token' returning 'GetVar Variabe Not found' on newer devices #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nik-Kot
Copy link

@Nik-Kot Nik-Kot commented Dec 8, 2022

Xiaomi has changed the fastboot behavior on newer devices. Now you need to call "fastboot oem get_token" instead of "fastboot getvar token", and the token also bacame longer.

This fix tries to get the token using the old way, and if the tken is not returned, it uses the new method to retrieve it, ensuring compatibility with both older and newer devices.

…e Not found' on newer devices when unlocking bootloader.
@Nik-Kot
Copy link
Author

Nik-Kot commented Dec 8, 2022

Fixes #54

@Okazakee
Copy link

Fixes #54

Hey can you provide a build with that fix somewhere? i am trying to do it but i am not a java dev. Thanks in advance

@Nik-Kot
Copy link
Author

Nik-Kot commented Jan 14, 2023

Fixes #54

Hey can you provide a build with that fix somewhere? i am trying to do it but i am not a java dev. Thanks in advance

Onto it, figuring out how to properly build this

@Nik-Kot
Copy link
Author

Nik-Kot commented Jan 17, 2023

Fixes #54

Hey can you provide a build with that fix somewhere? i am trying to do it but i am not a java dev. Thanks in advance

Here you go, please report if anything doesn't work as intended, i'll probably try to fix
https://github.com/Nik-Kot/XiaoMiToolV2/releases/tag/dev

@Okazakee
Copy link

Fixes #54

Hey can you provide a build with that fix somewhere? i am trying to do it but i am not a java dev. Thanks in advance

Here you go, please report if anything doesn't work as intended, i'll probably try to fix
https://github.com/Nik-Kot/XiaoMiToolV2/releases/tag/dev

Omg I will try that tomorrow, a friend of mine has a Xiaomi to unlock, let's see. Thank you very much either way

@Okazakee
Copy link

There is something strange on login, it says the JSON response {R S OK}, something like that. Even the old app is giving problems

@edisionnano
Copy link

I'm trying to login however I'm never receiving the SMS with the verification code

@edisionnano
Copy link

edisionnano commented Feb 6, 2023

OK so small update, scanning the QR code to login will NOT work due to the aforementioned JSON issue; here's what you need to do:
The correct way to login is via phone and password, it must send you an SMS with a token but you can't see the captcha from the tool's login window. Open a Chromium tab instead, navigate to
https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&_locale=en_US&checkSafePhone=true
Login, input the captcha and once you get the SMS input the code on the tool's login window instead of Chromium. This should let you login.
PS:Thanks to #67 if you change the JavaFX version to the latest stable you will get the captcha but I wasn't able to receive the SMS even after changing the URL on LoginController to
private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&_locale=en_US&checkSafePhone=true";

First problem solved, the second issue was that on Linux it couldn't find any devices and looking at the terminal there seemed to be some permission issue that chmod +x couldn't fix but this was easy to overcome.
I cloned OP's branch using
https://github.com/Nik-Kot/XiaoMiToolV2.git
CDd inside
cd XiaoMiToolV2
and built and ran the app using
sudo ./gradlew run
Now on Arch Linux I had to set java-11-openjdk using
sudo archlinux-java set java-11-openjdk

Second problem solved, then I ran into another issue; when booting to fastboot it would stay there for a split second and then black screen and no device on lsusb, this was an easy one. See I used the usb hub my keyboard had, using the usb ports on the back of my PC solved this issue.

And now my fourth problem, while trying to solve issue #3 I ran out of SMS verification attempts and I shall wait 24 hours to receive another one.

@edisionnano
Copy link

YES! It worked and I was able to unlock my Mi 8 Lite on Linux, thanks

@ajaypaul619
Copy link

ajaypaul619 commented Mar 18, 2023

Hey there this build is not working for me. everything worked well but atlast i got a error message like this
image

image

Please help me to solve this.Thanks!!

@ajaypaul619
Copy link

I also tried running java application .Please find below the error i got :
[16:10:18][INFO ][4fa65672] Unlock request token: [16:10:18][INFO ][4fa65672] Unlock request (/api/v2/nonce) params: r=wcrefgdlhjivxomb&sid=miui_unlocktool_client&sign=7a6fcb796033f0d07460601311f9550e0b2e4472 [16:10:19][INFO ][4fa65672] Unlock request (/api/v2/nonce) response: {"code":0,"nonce":"eyJzIjoiZWUxZTYxNTZhYjRhZGM4YmMyYTgxMzQ3Nzk4NTVjY2U3NzNhMGEzYSIsInQiOjE2NzkxMzYwMTg2MTIsInIiOiJEWkh2WSJ9","description":"??"} [16:10:19][INFO ][4fa65672] Unlock request (/api/v3/ahaUnlock) params: appId=1&data=ewogICAiY2xpZW50SWQiIDogIjIiLAogICAiY2xpZW50VmVyc2lvbiIgOiAiNS41LjIyNC41NSIsCiAgICJkZXZpY2VJbmZvIiA6IHsKICAgICAgImJvYXJkVmVyc2lvbiIgOiAiIiwKICAgICAgImRldmljZU5hbWUiIDogIiIsCiAgICAgICJwcm9kdWN0IiA6ICJyb3N5IiwKICAgICAgInNvY0lkIiA6ICIiCiAgIH0sCiAgICJkZXZpY2VUb2tlbiIgOiAiIiwKICAgImxhbmd1YWdlIiA6ICJlbiIsCiAgICJvcGVyYXRlIiA6ICJ1bmxvY2siLAogICAicGNJZCIgOiAiNTllN2MwMzk4MTY2YWJhZTIwYWYzNThkYTVlNjI1OTgiLAogICAicmVnaW9uIiA6ICIiLAogICAidWlkIiA6ICI1NTgwNzQ0MDYzIgp9Cg==&nonce=eyJzIjoiZWUxZTYxNTZhYjRhZGM4YmMyYTgxMzQ3Nzk4NTVjY2U3NzNhMGEzYSIsInQiOjE2NzkxMzYwMTg2MTIsInIiOiJEWkh2WSJ9&sid=miui_unlocktool_client&sign=7636acf77eda96340771e99287d432aa7d236c05 [16:10:19][INFO ][4fa65672] Unlock request (/api/v3/ahaUnlock) response: {"code":10000,"description":"????","descCN":"????","descEN":"Request parameter error","uid":"5580744063"} [16:10:19][INFO ][4fa65672] Unlock request response: {"code":10000,"description":"????","descCN":"????","descEN":"Request parameter error","uid":"5580744063"} [16:10:19][PROC ][7ec57f6c] Process (67) output: could not read ok from ADB Server

@hhacker1999
Copy link

Hello, Can you please make a mac os build? I am trying to build this branch but always getting java errors.

@ghost
Copy link

ghost commented Aug 3, 2023

OK so small update, scanning the QR code to login will NOT work due to the aforementioned JSON issue; here's what you need to do: The correct way to login is via phone and password, it must send you an SMS with a token but you can't see the captcha from the tool's login window. Open a Chromium tab instead, navigate to https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&_locale=en_US&checkSafePhone=true Login, input the captcha and once you get the SMS input the code on the tool's login window instead of Chromium. This should let you login. PS:Thanks to #67 if you change the JavaFX version to the latest stable you will get the captcha but I wasn't able to receive the SMS even after changing the URL on LoginController to private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&_locale=en_US&checkSafePhone=true";

First problem solved, the second issue was that on Linux it couldn't find any devices and looking at the terminal there seemed to be some permission issue that chmod +x couldn't fix but this was easy to overcome. I cloned OP's branch using https://github.com/Nik-Kot/XiaoMiToolV2.git CDd inside cd XiaoMiToolV2 and built and ran the app using sudo ./gradlew run Now on Arch Linux I had to set java-11-openjdk using sudo archlinux-java set java-11-openjdk

Second problem solved, then I ran into another issue; when booting to fastboot it would stay there for a split second and then black screen and no device on lsusb, this was an easy one. See I used the usb hub my keyboard had, using the usb ports on the back of my PC solved this issue.

And now my fourth problem, while trying to solve issue #3 I ran out of SMS verification attempts and I shall wait 24 hours to receive another one.

I've done what you said. I changed the LoginController file and the JavaFX version for the captcha to shows up. Then, I built and ran the tool, I also navigated to the site you pointed out and requested and SMS code. After I tried to place the code in the tool I got a verification code error, then, when I tried to use the same code in the browser I got the same error.
2023-08-03_15-08-1691094692
However, if I don't try to use the code in the tool and put it in the browser right away it succeeds and shows the following:
2023-08-03_15-08-1691095092
Do you know how can I avoid the verification code error?
I'm trying to unlock a Xiaomi Redmi Note 6 pro using the XiaoMiToolV2 on an ArchLinux machine.

@dreit-p
Copy link

dreit-p commented Oct 31, 2023

Here you go, please report if anything doesn't work as intended, i'll probably try to fix https://github.com/Nik-Kot/XiaoMiToolV2/releases/tag/dev

@Nik-Kot , could you please make a build for macos?

@darkcous
Copy link

Xiaomi has changed the fastboot behavior on newer devices. Now you need to call "fastboot oem get_token" instead of "fastboot getvar token", and the token also bacame longer.

This fix tries to get the token using the old way, and if the tken is not returned, it uses the new method to retrieve it, ensuring compatibility with both older and newer devices.

Xiaomi ha cambiado el comportamiento de fastboot en dispositivos más nuevos. Ahora necesita llamar a "fastboot oem get_token" en lugar de "fastboot getvar token", y el token también se hizo más largo.

Esta solución intenta obtener el token de la forma anterior y, si no se devuelve, utiliza el nuevo método para recuperarlo, lo que garantiza la compatibilidad tanto con dispositivos antiguos como nuevos.

Amigo tengo un problema, se que este tema está cerrado y no sé si todavía siga esto o estás activo, pero he bloqueado en bootloader lo que bloqueado con una rom personalizada me puede ayudar a desbloquearlo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants