Last active
December 6, 2023 12:37
-
-
Save viliampucik/54956df2302362dab281f86178a4b848 to your computer and use it in GitHub Desktop.
ZTE Speedport Entry 2i Key Generator
This file contains hidden or 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/env python | |
# | |
# ZTE Speedport Entry 2i Key Generator | |
# | |
# The script generates the key for decryption and encryption | |
# of ZTE Speedport Entry 2i configuration file using | |
# https://github.com/mkst/zte-config-utility | |
# | |
# Usage: | |
# | |
# ./zte-speedport-entry-2i-key-generator.py | |
# MAC address: c85a9fa21821 | |
# Serial: 268EG8JL4M16271 | |
# Factory SSID: ZTE-ABCDEF | |
# Factory WLAN Key: zxcvbnmasdfg | |
# Factory Username: admin | |
# Factory Password: qwertyui | |
# Hardware Version: V1.0.1 | |
# ade8b5e3e9c57a5f | |
# | |
# Configuration decryption: | |
# | |
# PYTHONPATH=./zte-config-utility | |
# python ./zte-config-utility/examples/decode.py config.bin config.xml --key ade8b5e3e9c57a5f | |
# | |
# Configuration encryption: | |
# | |
# PYTHONPATH=./zte-config-utility | |
# python ./zte-config-utility/examples/encode.py config.xml config.bin --key ade8b5e3e9c57a5f --signature "Speedport Entry 2i" | |
from hashlib import md5 | |
l = lambda s: len(s).to_bytes(3, "little") | |
a = lambda s: s.encode("ascii") | |
mac = int(input("MAC address: "), 16) | |
serial = a(input("Serial: ")) | |
ssid = a(input("Factory SSID: ")) | |
wlan_key = a(input("Factory WLAN Key: ")) | |
username = a(input("Factory Username: ")) | |
password = a(input("Factory Password: ")) | |
mac_zte = a("54BE53") | |
version = a(input("Hardware Version: ")) | |
zero = a("0") | |
print(md5( | |
b"\x01\x00\x00\x06\x00\x00" + (mac).to_bytes(6, "big") + \ | |
b"\x01\x01\x00\x06\x00\x00" + (mac + 1).to_bytes(6, "big") + \ | |
b"\x01\x02\x00\x06\x00\x00" + (mac + 2).to_bytes(6, "big") + \ | |
b"\x01\x03\x00\x06\x00\x00" + (mac + 3).to_bytes(6, "big") + \ | |
b"\x02\x00\x00" + l(serial) + serial + \ | |
b"\x04\x00\x00" + l(ssid) + ssid + \ | |
b"\x05\x10\x00" + l(wlan_key) + wlan_key + \ | |
b"\x06\x01\x00" + l(username) + username + \ | |
b"\x07\x01\x00" + l(password) + password + \ | |
b"\x03\x00\x00" + l(mac_zte) + mac_zte + \ | |
b"\x08\x06\x00" + l(version) + version + \ | |
b"\x08\x07\x00" + l(zero) + zero | |
).hexdigest()[:16]) |
This also did not work with my router. The firmware version is V1.0.0_OTET14MAPEA. I guess the tagparam_m file may be different as in the comment above.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I also have
ZTE Speedport Entry 2i
but mytagparam_m
is different it has additional padding and does not contain Factory Username: here is how it looks like