tewa-707e光猫超级密码获取方法

这款光猫很魔性,没有WIFI,没有USB接口,没有Telnet,试了很多方法去获取超级密码都不行。后来偶尔的机会找到了方法,现与大家共享。
1、用FTP登录,用户名和密码就是光猫背面标签上的。FTP软件比较好使的是:FlashFXP
2、进入/userconfig/cfg目录,将db_user_cfg.xml文件下载下来。
3、这个文件是用AES加密了的,直接打开是乱码,所以得用AES解密,key为16个字节的 x00。
4、附解密用的python代码。

from Crypto.Cipher import AES
from binascii import a2b_hex
KEY = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
def decrypt(text):
    cryptor = AES.new(KEY, AES.MODE_ECB)
    plain_text = cryptor.decrypt(a2b_hex(text))
    return plain_text
cfg_file = open("db_user_cfg.xml", "rb")
dec_file = open("db_user_cfg.decode.xml", "w")
file_header = cfg_file.read(60)
while 1:
    trunk_info = cfg_file.read(12)
    trunk_data = cfg_file.read(65536)
    trunk_real_size = int.from_bytes(trunk_info[0:4], byteorder='big', signed=False)
    trunk_size = int.from_bytes(trunk_info[4:8], byteorder='big', signed=False)
    next_trunk = int.from_bytes(trunk_info[8:12], byteorder='big', signed=False)
    print(trunk_real_size, trunk_size, next_trunk)
    dec_file.write(decrypt(trunk_data.hex()).decode(encoding="utf-8"))
    if next_trunk==0:
        break

解密时可能会报错,可能是文件后面部分不晓得是咋拼接过来的,用AES解密时分组数据有问题。不过似乎不影响我们需要的结果。
打开解出来的文件,然后搜索 telecomadmin,就可以发现超级密码了。

是不是很简单?但我为此费了几天的功夫,其他的办法试了很多很多,为了感谢我的分享,你就点个赞吧。

参考资料:https://www.52pojie.cn/forum.php?mod=viewthread&tid=1577267

参考资料里面的光猫不是同一款,但解密的方法基本相同的。