返回列表 發帖

How to block whatsapp

剛剛看到這個script

http://forum.mikrotik.com/viewtopic.php?f=13&t=75263
  1. # Copy and Paste the above to WinBox New Terminal #

  2. /system scheduler
  3. add comment="Whatsapp Blocker" interval=2m name="Whatsapp Blocker" on-event="#\
  4. \_Use DNS Entrys and add Address to the Firewall Address-list #\r\
  5. \n:foreach i in=[/ip dns cache all find where (name~\"whatsapp\") && (type\
  6. =\"A\") ] do={\r\
  7. \n :local tmpAddress [/ip dns cache get \$i address];\r\
  8. \ndelay delay-time=10ms\r\
  9. \n# prevent script from using all cpu time #\r\
  10. \n :if ( [/ip firewall address-list find where address=\$tmpAddress] = \
  11. \"\") do={ \r\
  12. \n :local cacheName [/ip dns cache get \$i name] ;\r\
  13. \n :log info (\"added entry: \$cacheName \$tmpAddress\");\r\
  14. \n /ip firewall address-list add address=\$tmpAddress list=Whatsapp co\
  15. mment=\$cacheName;\r\
  16. \n}\r\
  17. \n}" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive \
  18. start-time=startup

  19. /ip firewall filter add chain=forward action=drop dst-address-list=Whatsapp disabled=no comment="Whatsapp Blocker"
複製代碼

蠻容易理解的script.
到dns cache裡找name的關鍵字含"whatsapp" ,然後將address記錄到list=Whatsapp

最後用利用firewall filter ,將dst-address-list=Whatsapp的連線全給封鎖.

TOP

回復 2# gfx86674


我不明白我的DNS cache 沒有whatsapp
所以用下面的方法
https://virtualitsupport.wordpre ... senger-in-mikrotik/

TOP

現在用這方法去動態留意 Whatsapp使用的IP,然後在指定時間內禁止使用
  1. /ip firewall mangle
  2. add action=add-dst-to-address-list address-list=Whatsapp \
  3.     address-list-timeout=10m chain=prerouting content=whatsapp.com dst-port=\
  4.     80 in-interface=!wan protocol=tcp
  5. add action=add-dst-to-address-list address-list=Whatsapp \
  6.     address-list-timeout=10m chain=prerouting content=whatsapp.com dst-port=\
  7.     443 in-interface=!wan protocol=tcp
  8. add action=add-dst-to-address-list address-list=Whatsapp \
  9.     address-list-timeout=10m chain=prerouting content=whatsapp.com dst-port=\
  10.     5222 in-interface=!wan protocol=tcp
  11. add action=add-dst-to-address-list address-list=Whatsapp \
  12.     address-list-timeout=10m chain=prerouting content=whatsapp.com dst-port=\
  13.     5223 in-interface=!wan protocol=tcp
  14. add action=add-dst-to-address-list address-list=Whatsapp \
  15.     address-list-timeout=10m chain=prerouting content=whatsapp.com dst-port=\
  16.     5228 in-interface=!wan protocol=tcp
複製代碼
  1. /ip firewall filter
  2. add action=drop chain=forward comment="Whatsapp Drop" dst-address-list=\
  3.     Whatsapp time=9h-11h59m59s,sun,mon,tue,wed,thu,fri,sat
  4. add action=drop chain=input comment="Whatsapp Drop" src-address-list=Whatsapp \
  5.     time=9h-11h59m59s,sun,mon,tue,wed,thu,fri,sat
複製代碼

TOP

返回列表