Skip to content

Instantly share code, notes, and snippets.

@kenchou
Created May 14, 2018 06:27
Show Gist options
  • Save kenchou/7dbe12c514ab778496d21707f55a7aae to your computer and use it in GitHub Desktop.
Save kenchou/7dbe12c514ab778496d21707f55a7aae to your computer and use it in GitHub Desktop.
#!/bin/sh
# ZTE F450G 垃圾, WebUI 有漏洞,LAN 上 ajax 调用的 URI 并不需要认证。
#
# 获取路由信息的 URI 返回 json 如下:
# {"macAddr":"aa:bb:cc:dd:ee:ff","productClass":"F450G","wanIpAddr":"xxx.xxx.xxx.xxx","swVer":"V2.0.0P1T1sh","flashSize":256,"dnsIpAddr":"xxx.xxx.xxx.xxx","ramSize":467,"Status":"0","lanIpAddr":"192.168.1.1","runTime":"1619682","CmdType":"GET_GW_INFO"}
#
# wanIpAddr 即是我们需要的外部 IP。
#
# 格式化后:
# {
# "macAddr": "aa:bb:cc:dd:ee:ff",
# "productClass": "F450G",
# "wanIpAddr": "xxx.xxx.xxx.xxx",
# "swVer": "V2.0.0P1T1sh",
# "flashSize": 256,
# "dnsIpAddr": "xxx.xxx.xxx.xxx",
# "ramSize": 467,
# "Status": "0",
# "lanIpAddr": "192.168.1.1",
# "runTime": "1619707",
# "CmdType": "GET_GW_INFO"
# }
curl -s -d "jsonCfg=%7B'RPCMethod'%3A'Post'%2C+'Parameter'%3A%7B'CmdType'%3A'GET_GW_INFO'%7D%7D" http://192.168.1.1/common_page/gatewayManage.lua | grep wanIpAddr | sed 's/.*"wanIpAddr":"\([0-9\.]*\)".*/\1/'
@mlzxgzy
Copy link

mlzxgzy commented Dec 1, 2018

差点以为是获取超管密码了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment