Created
October 6, 2021 16:53
-
-
Save z3ntu/cc2e151d48bdf983672deafa7f37c56f to your computer and use it in GitHub Desktop.
Calculate unlock code for Medion Lifetab S831X (bootloader is buggy so unlock actually doesn't work)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
def get_secret(serial: str) -> str: | |
secret = "" | |
for i in range(16): | |
value = ord(serial[i]) + ord("AB2D3F3B37890C1A"[i]) + 9 | |
secret += format(value, 'X') | |
return secret | |
# Get serial number - in adb shell: | |
# $ cat /sys/sys_info/serial_number | |
# Errors: | |
# 0x7000 - ERR_UNLOCK_KEY_WRONG_LENGTH | |
# 0x7001 - ERR_UNLOCK_WRONG_KEY_CODE | |
# 0x100d - PART_ERASE_FAIL | |
# Unlock failed - Err:0x7000 | |
if __name__ == '__main__': | |
if len(sys.argv) < 2: | |
print(f"Usage: {sys.argv[0]} SERIAL_NUMbER") | |
sys.exit(1) | |
if len(sys.argv[1]) != 16: | |
print("ERROR: The given serial number must be 16 characters long!") | |
sys.exit(1) | |
print("Calculated unlock secret:") | |
secret = get_secret(sys.argv[1]) | |
print() | |
print("Boot into bootloader mode (Vol+Up during boot + fastboot)") | |
print(f"fastboot oem key {secret}") | |
print("fastboot oem unlock") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment