RouteOS ROS廣告過濾
圖片發自簡書App
圖為CCR1016-12G當時狀態
從卡飯等匯入兩千多條規則,結果網路卡慢,精簡一半仍不時有100%負荷,最後精簡至圖上不到20條才覺平衡點.
指令碼檔案大不能用貼上的辦法,需要選定檔案複製,上傳檔案:winbox—〉file——“貼上”,termnal——〉輸入“im 指令碼全名”
一段common lisp程式碼,對過濾規則改造成指令碼:
;檔案f-ad.txt是“卡飯”上用於金山網盾的過濾規則檔案
;檔案f-ad-out.txt是轉換為ros的firewall規則指令碼
;複製檔案 winbox->file 貼上
;winbox->terminal裡[[email protected]] > im f-ad-out.txt
;ansi common lisp通過
(let ((in (open "c:/f-ad.txt" :direction :input :if-does-not-exist nil))
(out (open "c:/f-ad-out.txt" :direction :output :if-exists :supersede)))
(when in
(loop for line = (read-line in nil)
while line do (format out "/ip firewall filter add chain=forward content=\"~A\" action=drop comment=\"~A\" disabled=no ~%" line line)))
(close in)
(close out)
)
轉換前的樣本:
www.qidian.com/*ltern.js*
*.1qwe3r.com/*
*.ruxianke.com/*
www.qidian.com/*__*.js
轉換後的樣本:
/ip firewall filter add chain=forward content="www.qidian.com/*ltern.js*" action=drop comment="www.qidian.com/*ltern.js*" disabled=no
/ip firewall filter add chain=forward content="*.1qwe3r.com/*" action=drop comment="*.1qwe3r.com/*" disabled=no
/ip firewall filter add chain=forward content="*.ruxianke.com/*" action=drop comment="*.ruxianke.com/*" disabled=no
/ip firewall filter add chain=forward content="www.qidian.com/*__*.js" action=drop comment="www.qidian.com/*__*.js" disabled=no
以下是其他網站的指令碼
#遮蔽各大視訊網站播放前15秒30秒廣告
#再次宣告 基本都是直接跳過 不是黑屏 歡迎測試;
#只遮蔽播放前廣告 其他頁面廣告未遮蔽 如有不足之處歡迎指教;
#優酷帶有反遮蔽機制 所以第一次播放會有提示 第二次播放即可正常;
#遮蔽列表:騰訊視訊,迅雷看看,奇藝,PPS,PPTV,搜狐,優酷,酷6,土豆
/ip firewall filter
add action=drop chain=forward comment="\CC\DA\D1\B6\CA\D3\C6\B5\B9\E3\B8\E6" content="Host: livem.l.qq.com" disabled=no
add action=drop chain=forward comment="\D1\B8\C0\D7\BF\B4\BF\B4\B9\E3\B8\E6" content="Host: logic.cpm.cm.sandai.net" disabled=no
add action=drop chain=forward comment="\C6\E6\D2\D5\B9\E3\B8\E6" content="Host: policy.cupid.qiyi.com" disabled=no
add action=drop chain=forward comment="PPS\B9\E3\B8\E6" content="Host: notice.ppstream.com" disabled=no
add action=jump chain=forward comment="PPTV\B9\E3\B8\E6" content="Host: pp2.pptv.com" disabled=no jump-target=pptv
add action=drop chain=pptv comment="" content=iafp.pptv.com/ikan disabled=no
add action=jump chain=forward comment="\CB\D1\BA\FC\B9\E3\B8\E6" content="Host: images.sohu.com" disabled=no jump-target=sohu
add action=drop chain=sohu comment="" content=.mp4 disabled=no
add action=jump chain=forward comment="\CD\C1\B6\B9\B9\E3\B8\E6" content="Host: v2.tudou.com" disabled=no jump-target=tudou
add action=drop chain=tudou comment="" content=/tdcm/adcontrol disabled=no
add action=drop chain=forward comment="\D3\C5\BF\E1\B9\E3\B8\E6" content="{\"RS\":\"http://f.youku.com/player/getFlvPath/fileid/" disabled=no
add action=drop chain=forward comment="\BF\E16\B9\E3\B8\E6" content=aagw.sdo.com disabled=no
add action=drop chain=forward comment="" content= "\"sad\":\"http://main.gslb.ku6.com/" disabled=no
#遮蔽各大視訊網站廣告:優酷、百度、奇異、
#遮蔽廣告:優酷、百度、奇異、CNTV、新浪、pptv、樂視、搜狐、我樂、6房間、土豆、酷六、激動、迅雷、MSN
#指令碼直接匯入防火牆即可!
/ ip firewall filter add chain=forward content="atm.youku.com" action=drop comment="atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="Fvid.atm.youku.com" action=drop comment="Fvid.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="html.atm.youku.com" action=drop comment="html.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="valb.atm.youku.com" action=drop comment="valb.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="valf.atm.youku.com" action=drop comment="valf.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="valo.atm.youku.com" action=drop comment="valo.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="valp.atm.youku.com" action=drop comment="valp.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="lstat.youku.com" action=drop comment="lstat.youku.com" disabled=no
/ ip firewall filter add chain=forward content="speed.lstat.youku.com" action=drop comment="speed.lstat.youku.com" disabled=no
/ ip firewall filter add chain=forward content="urchin.lstat.youku.com" action=drop comment="urchin.lstat.youku.com" disabled=no
/ ip firewall filter add chain=forward content="stat.youku.com" action=drop comment="stat.youku.com" disabled=no
/ ip firewall filter add chain=forward content="static.lstat.youku.com" action=drop comment="static.lstat.youku.com" disabled=no
/ ip firewall filter add chain=forward content="valc.atm.youku.com" action=drop comment="valc.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="vid.atm.youku.com" action=drop comment="vid.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="walp.atm.youku.com" action=drop comment="walp.atm.youku.com" disabled=no
/ ip firewall filter add chain=forward content="a.baidu.com" action=drop comment="a.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="baidutv.baidu.com" action=drop comment="baidutv.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="bar.baidu.com" action=drop comment="bar.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="c.baidu.com" action=drop comment="c.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="cjhq.baidu.com" action=drop comment="cjhq.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="cpro.baidu.com" action=drop comment="cpro.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="drmcmm.baidu.com" action=drop comment="drmcmm.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="e.baidu.com" action=drop comment="e.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="eiv.baidu.com" action=drop comment="eiv.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="hc.baidu.com" action=drop comment="hc.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="hm.baidu.com" action=drop comment="hm.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="ma.baidu.com" action=drop comment="ma.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="nsclick.baidu.com" action=drop comment="nsclick.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="spcode.baidu.com" action=drop comment="spcode.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="tk.baidu.com" action=drop comment="tk.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="union.baidu.com" action=drop comment="union.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="ucstat.baidu.com" action=drop comment="ucstat.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="utility.baidu.com" action=drop comment="utility.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="utk.baidu.com" action=drop comment="utk.baidu.com" disabled=no
/ ip firewall filter add chain=forward content="focusbaiduafp.allyes.com" action=drop comment="focusbaiduafp.allyes.com" disabled=no
/ ip firewall filter add chain=forward content="afp.qiyi.com" action=drop comment="afp.qiyi.com" disabled=no
/ ip firewall filter add chain=forward content="focusbaiduafp.allyes.com" action=drop comment="focusbaiduafp.allyes.com" disabled=no
/ ip firewall filter add chain=forward content="a.cctv.com" action=drop comment="a.cctv.com" disabled=no
/ ip firewall filter add chain=forward content="a.cntv.cn" action=drop comment="a.cntv.cn" disabled=no
/ ip firewall filter add chain=forward content="ad.cctv.com" action=drop comment="ad.cctv.com" disabled=no
/ ip firewall filter add chain=forward content="d.cntv.cn" action=drop comment="d.cntv.cn" disabled=no
/ ip firewall filter add chain=forward content="adguanggao.eee114.com" action=drop comment="adguanggao.eee114.com" disabled=no
/ ip firewall filter add chain=forward content="cctv.adsunion.com" action=drop comment="cctv.adsunion.com" disabled=no
/ ip firewall filter add chain=forward content="dcads.sina.com.cn" action=drop comment="dcads.sina.com.cn" disabled=no
/ ip firewall filter add chain=forward content="pp2.pptv.com" action=drop comment="pp2.pptv.com" disabled=no
/ ip firewall filter add chain=forward content="pro.letv.com" action=drop comment="pro.letv.com" disabled=no
/ ip firewall filter add chain=forward content="images.sohu.com" action=drop comment="images.sohu.com" disabled=no
/ ip firewall filter add chain=forward content="a.cctv.com" action=drop comment="a.cctv.com" disabled=no
/ ip firewall filter add chain=forward content="a.cntv.cn" action=drop comment="a.cntv.cn" disabled=no
/ ip firewall filter add chain=forward content="ad.cctv.com" action=drop comment="ad.cctv.com" disabled=no
/ ip firewall filter add chain=forward content="d.cntv.cn" action=drop comment="d.cntv.cn" disabled=no
/ ip firewall filter add chain=forward content="adguanggao.eee114.com" action=drop comment="adguanggao.eee114.com" disabled=no
/ ip firewall filter add chain=forward content="cctv.adsunion.com" action=drop comment="cctv.adsunion.com" disabled=no
/ ip firewall filter add chain=forward content="acs.56.com" action=drop comment="acs.56.com" disabled=no
/ ip firewall filter add chain=forward content="acs.agent.56.com" action=drop comment="acs.agent.56.com" disabled=no
/ ip firewall filter add chain=forward content="acs.agent.v-56.com" action=drop comment="acs.agent.v-56.com" disabled=no
/ ip firewall filter add chain=forward content="bill.agent.56.com" action=drop comment="bill.agent.56.com" disabled=no
/ ip firewall filter add chain=forward content="bill.agent.v-56.com" action=drop comment="bill.agent.v-56.com" disabled=no
/ ip firewall filter add chain=forward content="stat.56.com" action=drop comment="stat.56.com" disabled=no
/ ip firewall filter add chain=forward content="stat2.corp.56.com" action=drop comment="stat2.corp.56.com" disabled=no
/ ip firewall filter add chain=forward content="union.56.com" action=drop comment="union.56.com" disabled=no
/ ip firewall filter add chain=forward content="uvimage.56.com" action=drop comment="uvimage.56.com" disabled=no
/ ip firewall filter add chain=forward content="v16.56.com" action=drop comment="v16.56.com" disabled=no
/ ip firewall filter add chain=forward content="pole.6rooms.com" action=drop comment="pole.6rooms.com" disabled=no
/ ip firewall filter add chain=forward content="shrek.6.cn" action=drop comment="shrek.6.cn" disabled=no
/ ip firewall filter add chain=forward content="simba.6.cn" action=drop comment="simba.6.cn" disabled=no
/ ip firewall filter add chain=forward content="union.6.cn" action=drop comment="union.6.cn" disabled=no
/ ip firewall filter add chain=forward content="adextensioncontrol.tudou.com" action=drop comment="adextensioncontrol.tudou.com" disabled=no
/ ip firewall filter add chain=forward content="iwstat.tudou.com" action=drop comment="iwstat.tudou.com" disabled=no
/ ip firewall filter add chain=forward content="nstat.tudou.com" action=drop comment="nstat.tudou.com" disabled=no
/ ip firewall filter add chain=forward content="stats.tudou.com" action=drop comment="stats.tudou.com" disabled=no
/ ip firewall filter add chain=forward content="*.p2v.tudou.com*" action=drop comment="*.p2v.tudou.com*" disabled=no
/ ip firewall filter add chain=forward content="at-img1.tdimg.com" action=drop comment="at-img1.tdimg.com" disabled=no
/ ip firewall filter add chain=forward content="at-img2.tdimg.com" action=drop comment="at-img2.tdimg.com" disabled=no
/ ip firewall filter add chain=forward content="at-img3.tdimg.com" action=drop comment="at-img3.tdimg.com" disabled=no
/ ip firewall filter add chain=forward content="adplay.tudou.com" action=drop comment="adplay.tudou.com" disabled=no
/ ip firewall filter add chain=forward content="adcontrol.tudou.com" action=drop comment="adcontrol.tudou.com" disabled=no
/ ip firewall filter add chain=forward content="stat.tudou.com" action=drop comment="stat.tudou.com" disabled=no
/ ip firewall filter add chain=forward content="1.allyes.com.cn" action=drop comment="1.allyes.com.cn" disabled=no
/ ip firewall filter add chain=forward content="analytics.ku6.com" action=drop comment="analytics.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="gug.ku6cdn.com" action=drop comment="gug.ku6cdn.com" disabled=no
/ ip firewall filter add chain=forward content="ku6.allyes.com" action=drop comment="ku6.allyes.com" disabled=no
/ ip firewall filter add chain=forward content="ku6afp.allyes.com" action=drop comment="ku6afp.allyes.com" disabled=no
/ ip firewall filter add chain=forward content="pq.stat.ku6.com" action=drop comment="pq.stat.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="st.vq.ku6.cn" action=drop comment="st.vq.ku6.cn" disabled=no
/ ip firewall filter add chain=forward content="stat0.888.ku6.com" action=drop comment="stat0.888.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="stat1.888.ku6.com" action=drop comment="stat1.888.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="stat2.888.ku6.com" action=drop comment="stat2.888.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="stat3.888.ku6.com" action=drop comment="stat3.888.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="static.ku6.com" action=drop comment="static.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="v0.stat.ku6.com" action=drop comment="v0.stat.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="v1.stat.ku6.com" action=drop comment="v1.stat.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="v2.stat.ku6.com" action=drop comment="v2.stat.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="v3.stat.ku6.com" action=drop comment="v3.stat.ku6.com" disabled=no
/ ip firewall filter add chain=forward content="86file.megajoy.com" action=drop comment="86file.megajoy.com" disabled=no
/ ip firewall filter add chain=forward content="86get.joy.cn" action=drop comment="86get.joy.cn" disabled=no
/ ip firewall filter add chain=forward content="86log.joy.cn" action=drop comment="86log.joy.cn" disabled=no
/ ip firewall filter add chain=forward content="casting.openv.com" action=drop comment="casting.openv.com" disabled=no
/ ip firewall filter add chain=forward content="m.openv.tv" action=drop comment="m.openv.tv" disabled=no
/ ip firewall filter add chain=forward content="uniclick.openv.com" action=drop comment="uniclick.openv.com" disabled=no
/ ip firewall filter add chain=forward content="mcfg.sandai.net" action=drop comment="mcfg.sandai.net" disabled=no
/ ip firewall filter add chain=forward content="biz5.sandai.net" action=drop comment="biz5.sandai.net" disabled=no
/ ip firewall filter add chain=forward content="server1.adpolestar.net" action=drop comment="server1.adpolestar.net" disabled=no
/ ip firewall filter add chain=forward content="advstat.xunlei.com" action=drop comment="advstat.xunlei.com" disabled=no
/ ip firewall filter add chain=forward content="mpv.sandai.net" action=drop comment="mpv.sandai.net" disabled=no
/ ip firewall filter add chain=forward content="practivate.adobe.com " action=drop comment="practivate.adobe.com " disabled=no
/ ip firewall filter add chain=forward content="practivate.adobe.com" action=drop comment="practivate.adobe.com" disabled=no
/ ip firewall filter add chain=forward content="rad.msn.com" action=drop comment="rad.msn.com" disabled=no
/ ip firewall filter add chain=forward content="rad.live.com" action=drop comment="rad.live.com" disabled=no