当前位置: 首页 > article >正文

4-电脑一连接上自动弹框到路由器web配置页面

很多路由器在还没有配置路由信息的时候,只要一连接wifi/有线,就会自动弹出路由器web配置页面,强制用户配置一次基本信息才可以进行上网

这也其实也是portal认证的一种应用,原本的portal是跳转到后台认证服务器页面,目前是跳转到路由器本地管理页面。

所以我们只需要根据应用策略进行区分,然后修改跳转的页面url即可。

为啥有时候会自动弹出,有时候不会自动弹出呢?

portal的原理是捕获80端口和443端口的流量,转到2060端口,然后做重定向。所以只要设备没有这两个80的数据访问就没有办法跳转。

我们抓取电脑网络刚通时的数据包,可以发现比如window就会自动访问类似www.microsoft.com、www.msftconnecttest.com这些域名。

但是访问的这些域名不一定是通过80/443来访问,而是其他私有协议交互,所以为了加快跳转,我们不通过portal的端口捕获原理,而直接使用dnsmasq的域名劫持原理,只要访问这个域名就直接跳转到路由器本地配置页面。

dnsmasq启动代码添加:

local target_ip="1.127.127.254"

#windows
uci add_list dhcp.@dnsmasq[0].address='/www.msftconnecttest.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/dns.msftncsi.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/geo.prod.do.dsp.mp.microsoft.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/www.microsoft.com/'$target_ip

#ubuntu
uci add_list dhcp.@dnsmasq[0].address='/connectivity-check.ubuntu.com/'$target_ip

#google
uci add_list dhcp.@dnsmasq[0].address='/connectivitycheck.gstatic.com/'$target_ip

#apple
uci add_list dhcp.@dnsmasq[0].address='/www.apple.com/'$target_ip

#Samsung
uci add_list dhcp.@dnsmasq[0].address='/connectivitycheck.android.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/clients3.google.com/'$target_ip

#xiaomi
uci add_list dhcp.@dnsmasq[0].address='/connect.rom.miui.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connect.miui.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/s1.miui.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/captive.v2ex.co/'$target_ip

#vivo
uci add_list dhcp.@dnsmasq[0].address='/www.googleapis.cn/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connectivitycheck.vivo.com.cn/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connect.vivo.com.cn/'$target_ip

#oppo
uci add_list dhcp.@dnsmasq[0].address='/connectivity.oppo.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connect.oppo.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connect.oppomobile.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/www.oppo.com/'$target_ip

#huawei
uci add_list dhcp.@dnsmasq[0].address='/www.huawei.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connect.cloud.huawei.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/www.hwcdn.net/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connect.vmall.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/hispace.dbankcloud.com/'$target_ip

#huawei harmonyOs
uci add_list dhcp.@dnsmasq[0].address='/connectivitycheck.platform.hicloud.com/'$target_ip
uci add_list dhcp.@dnsmasq[0].address='/connectivitycheck.cbg-app.huawei.com/'$target_ip

#Google Chrome
uci add_list dhcp.@dnsmasq[0].address='/connectivitycheck.gstatic.com/'$target_ip

#Mozilla Firefox
uci add_list dhcp.@dnsmasq[0].address='/detectportal.firefox.com/'$target_ip

#Apple Safari or Opera
uci add_list dhcp.@dnsmasq[0].address='/captive.apple.com/'$target_ip

#Microsoft Edge
uci add_list dhcp.@dnsmasq[0].address='/msftconnecttest.com/'$target_ip

uci commit dhcp
/etc/init.d/dnsmasq restart

dnsmasq停止代码添加:

uci -q delete dhcp.@dnsmasq[0].address

local ret=$?
if [ "$ret" == "0" ]; then
        logger -t portal "del dnsmasq url address success, restart dnsmasq"
        uci commit dhcp
        /etc/init.d/dnsmasq restart
fi

http://www.kler.cn/a/544145.html

相关文章:

  • C#综合知识点面试集锦
  • Spring 核心技术解析【纯干货版】- XIII:Spring 消息模块 Spring-Messaging 模块精讲
  • 清华大学新闻与传播学院沈阳团队出品的《DeepSeek:从入门到精通》104页PDF
  • 8K样本在DeepSeek-R1-7B模型上的复现效果
  • 玩转观察者模式
  • 和鲸科技上线 DeepSeek 系列模型服务,助力数智企业 AI 业务创新!
  • react 创建项目报错(react19)详细解决办法
  • forwardRef
  • 朝天椒USB服务器让RPA机器人远程连接网银U盾
  • DeepSeek 的 API 服务引入 WPS Office
  • ?.、??、||分别是什么,又有哪些区别???
  • Linux部署DeepSeek r1 模型训练
  • 开启AI绘画的魔法大门!探索Stable Diffusion的无限魅力~
  • k8s之亲和性和反亲和性
  • 【ISO 14229-1:2023 UDS诊断全量测试用例清单系列:第一节】
  • UNITY计算fps时应忽略掉time.timescale的影响
  • [Linux][问题处理]修改密码报You must wait longer to change your password
  • 人生的转折点反而迷失了方向
  • 游戏内常见加密
  • Unity 卡死排查方法(游戏死循环、打包卡死)
  • python+unity落地方案实现AI 换脸融合
  • Spring 项目接入 DeepSeek,分享两种超简单的方式!
  • HTML之JavaScript函数声明
  • 【AI学习】DeepSeek-R1-Distill的意义和影响
  • MYSQL 索引 index
  • 求助帖: stm32通过 flash实现boot和app之间的api共享