-
第一步:准备固件
编译OpenWrt固件-选择Privoxy
配置user.filter, user.action, config文件。
config文件中需要指定监听都地址与端口号
在user.action中注入广告脚本 xxx.js
具体参考我的脚本 https://gist.github.com/qianguozheng
user.filter中添加过滤规则
-
1. FILTER: block-weeds
2. s|</head>|<script type="text/javascript" src="http://www.yourdomainname.com/ystest/js/hupu.js"></script>$0|
user.action中调用过滤规则
1. {+filter{block-weeds}}
2. .*
将所有目标地址为80端口的请求转到8118端口
1. iptables -t nat -A PREROUTING -s 0.0.0.0/0.0.0.0 -p tcp --dport 80 -j REDIRECT --to-ports 8118
OpenWrt 广告植入原型搭建
最新推荐文章于 2024-05-22 09:54:04 发布