最近新花样了?你家光猫的超级密码是不是隔三差五就被偷偷改掉?只需两个骚操作:
趁Telnet开放时直接修改超管密码锁死权限
移除IPv6防火墙实现公网直连内网
再也不用苦求桥接模式!不用加软路由/服务器!光猫本身就能当跳板机!(高危操作老鸟专属)
核心痛点突破:
运营商陰招:现在光猫超密定时自动变更(TR069远程操控,定期间隔有无大佬知道)
【永续方案】; 光靠手工改一次怎么够?运营商半夜重置超密怎么办?上定时任务自动化战斗!
破解关键:只要Telnet没封,就能用sidbg命令直接改写密码数据库
终极目标:配合ip6tables删除防火墙规则,原生支持IPv6公网入站(比DDNS+端口映射更香)
本Python脚本实现自动化Telnet连接电信光猫,主要完成两个核心功能:
import telnetlib
import time
使用Python标准库的telnetlib实现远程连接,time模块用于命令执行间隔控制
tn.read_until(b"Login:")
tn.write(username.encode('ascii') + b"\n")
tn.read_until(b"Password:")
完整模拟人工登录过程,等待提示符后输入凭证
for cmd in commands:
tn.write(cmd.encode('ascii') + b"\n")
time.sleep(1) # 防止命令阻塞
output = tn.read_very_eager().decode('ascii')
循环执行预设命令组,包含1秒延时确保命令完整执行
commands = [
"sidbg 1 DB set DevAuthInfo 0 Pass CMCCAdmin", # 修改超级密码
"sidbg 1 DB save", # 保存配置
"ip6tables -t filter -I FORWARD 1 -i ppp+ -j ACCEPT", # IPv6规则
"ip6tables -t filter -I FORWARD 2 -i wan+ -j ACCEPT",
]
import telnetlib
import time
def telnet_connect(ip, username, password, commands):
# 创建Telnet对象
tn = telnetlib.Telnet(ip)
# 等待登录提示符
tn.read_until(b"Login:")
tn.write(username.encode('ascii') + b"\n")
# 等待密码提示符
tn.read_until(b"Password:")
tn.write(password.encode('ascii') + b"\n")
# 等待命令提示符或任何输出
tn.read_until(b"$")
# 发送命令
for cmd in commands:
tn.write(cmd.encode('ascii') + b"\n")
time.sleep(1) # 给服务器一些时间来处理命令
output = tn.read_very_eager().decode('ascii')
print(output)
# 关闭连接
tn.close()
if __name__ == "__main__":
ip = "192.168.6.1"
username = "admin"
password = "chzhdpl@246"
commands = [
"sidbg 1 DB set DevAuthInfo 0 Pass CMCCAdmin",
"sidbg 1 DB save",
"ip6tables -t filter -I FORWARD 1 -i ppp+ -j ACCEPT",
"ip6tables -t filter -I FORWARD 2 -i wan+ -j ACCEPT ",
]
【免责声明】本工具仅限技术研究使用,请勿用于非法用途,操作光猫配置可能导致设备异常,请谨慎使用。

