宝宝
宝宝
发布于 2025-07-06 / 4 阅读
0
0

天翼4.0TEWA-707E获取超级密码

这款光猫很魔性,没有WIFI,没有USB接口,没有Telnet,试了很多方法去获取超级密码都不行。后来偶尔的机会找到了方法,现与大家共享。

1、用FTP登录,用户名和密码就是光猫背面标签上的。

ftp 192.168.1.1

2、进入/userconfig/cfg目录,将db_user_cfg.xml文件下载下来。例如我将文件下载到我的D盘下的test文件夹

可以使用get命令下载需要的文件到lcd命令指定的本地文件夹也可以使用wget命令下载

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)
    # 确保hex字符串长度为32的倍数(AES块大小的2倍)
    if len(text) % 32 != 0:
        text = text.ljust((len(text) // 32 + 1) * 32, '0')
    plain_text = cryptor.decrypt(a2b_hex(text))
    return plain_text

input_path = "d:/test/db_user_cfg.xml"
output_path = "d:/test/db_user_cfg.decode.xml"

with open(input_path, "rb") as cfg_file, open(output_path, "wb") as dec_file:
    # 保留文件头
    file_header = cfg_file.read(60)
    dec_file.write(file_header)
    
    while True:
        # 读取块信息
        trunk_info = cfg_file.read(12)
        if not trunk_info or len(trunk_info) < 12:
            break
            
        # 解析块信息
        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(f"块信息: 实际大小={trunk_real_size}, 块大小={trunk_size}, 下一块={next_trunk}")
        
        # 读取加密数据
        trunk_data = cfg_file.read(trunk_size)
        if not trunk_data:
            break
            
        try:
            # 解密数据
            decrypted_data = decrypt(trunk_data.hex())
            
            # 写入实际有效数据
            dec_file.write(decrypted_data[:trunk_real_size])
        except Exception as e:
            print(f"解密出错: {e}")
            continue
            
        if next_trunk == 0:
            break

正常情况下完全解密的话文件大小不会差距太大

我们可以使用notepad++来打开.xml文件然后查找需要的超级密码和宽带账号密码,宽带账号一般为11位数字,在电信APP里面有,密码则在解密文件中宽带账号的下面

Notepad++下载地址:下载 |记事本++https://notepad-plus-plus.org/downloads/


评论