offici5l / MiUnlockTool

MiUnlockTool developed to retrieve encryptData(token) for Xiaomi devices for unlocking bootloader, It is compatible with all platforms.
Apache License 2.0
291 stars 18 forks source link

Receiving code 10000 (product: topaz) ! #8

Closed EgidioCaprino closed 8 months ago

EgidioCaprino commented 8 months ago

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?

offici5l commented 8 months ago

Code 10000 is not related to the password but rather associated with the device token and the product

Tell me whether the token is printed when you run tool (example in the picture) ?IMG_20240309_183328.jpg

EgidioCaprino commented 8 months ago

Yes, it is printed in a loop

image

offici5l commented 8 months ago

Try command1 :

fastboot oem get_token

If the first command doesn't work, try the second command2:

fastboot getvar token

Tell me what command work for you cmd1 or cmd2 ?

And. Are there many tokens:?

EgidioCaprino commented 8 months ago

The one that works for me is fastboot getvar token which returns a single token

image

offici5l commented 8 months ago

Try Edit data.json file Manually:

{ "user": "your id account", "pwd": "your password account", "wb_id": "your value of the wb_id", "token": "Your value command fastboot getvar token", "product": "topaz" }

then run tool

EgidioCaprino commented 8 months ago

It gets into a loop

image

offici5l commented 8 months ago

Frankly, I don't know the exact cause of your problem currently !

Try changing the clientVersion": "6.5.224.28" (Line 210)

to clientVersion": "7.6.727.43"

EgidioCaprino commented 8 months ago

I tried with that version number but I still get the same loop

offici5l commented 8 months ago

Try: version atest https://gitfront.io/r/offici5l/K9tZKivzQj8i/atest/blob/MiUnlockTool.py

Maybe it will work for you !

EgidioCaprino commented 8 months ago

I believe I'm making progress 😃 because now I get an error at this line

if "code" in r and r["code"] == 0:
    ed = io.BytesIO(bytes.fromhex(r["encryptData"]))
    with open("encryptData", "wb") as edfile:
        edfile.write(ed.getvalue())
➡️➡️CheckB(cmd)
    input("\nPress Enter to unlock bootloader\n")
    os.system(f"{cmd} stage encryptData")
    os.system(f"{cmd} oem unlock")
TypeError: CheckB() missing 1 required positional argument: 'var_name'

So I assume I'm getting a valid response now since r["code"] == 0

offici5l commented 8 months ago

Good code 0 means that the encryptData to unlock the bootloader has been obtained

now Try:

https://github.com/offici5l/atest/blob/main/MiUnlockTool.py

And tell me the result

EgidioCaprino commented 8 months ago

It worked 😀 Thank you very much ❤️