#!/bin/sh
#############################################################
#### Block Trendmicro / Asus / Google / Unknown Entities ####
#############################################################
##########################################################
#### Block redundant NXDOMAIN dnsmasq querys and logs ####
##########################################################
# Blocks most repated 10-14 second querys to google
# Blocks All Querys to Asus / Trend Micro
# Blocks Redundant Logging for cleaner logs
#Be sure to ping google.com, and replace IP with what you see, in the first append line (I found the google entry necessary on earlier versions of the firmware, it may be redundant on 384.7-beta1
CONFIG=$1
source /usr/sbin/helper.sh
sed -i '$a\#' $CONFIG
sed -i '$a\## begin of silently block all redundant querys to Google, TrendMicro, and Asus ##' $CONFIG
pc_append "74.125.205.147 google.com" $CONFIG
pc_append "192.168.50.2 fbsv1.trendmicro.com" $CONFIG
pc_append "192.168.50.2 fbsv2.trendmicro.com" $CONFIG
pc_append "192.168.50.2 gslb1.fbs.trendmicro.com.akadns.net" $CONFIG
pc_append "192.168.50.2 rgom10-en.url.trendmicro.com" $CONFIG
pc_append "192.168.50.2 trendmicro.com.edgesuite.net" $CONFIG
pc_append "192.168.50.2 slb1.fbs.trendmicro.com.akadns.net" $CONFIG
pc_append "192.168.50.2 activeupdate.trendmicro.co.jp" $CONFIG
pc_append "192.168.50.2 backup21.url.trendmicro.com" $CONFIG
pc_append "192.168.50.2 backup37.url.trendmicro.com" $CONFIG
pc_append "192.168.50.2 wrs.trendmicro.com" $CONFIG
pc_append "192.168.50.2 e5110.dscd.akamaiedge.net" $CONFIG
pc_append "#AsusWRT AI Protection Signature updates" $CONFIG
pc_append "#https://dlcdnets.asus.com/pub/ASUS/LiveUpdate/Release/Wireless/sig2nd_update.zip" $CONFIG
pc_append "#https://raw.githubusercontent.com/RMerl/asuswrt-merlin.382/master/release/src/router/rom/webs_scripts/sig2nd_update.sh" $CONFIG
pc_append "#remove --no-check-certificate from sig2nd_update.sh to assure no MITM. Just unblock host, run at leisure, reblock" $CONFIG
pc_append "192.168.50.2 dlcdnets.asus.com #Unblock just this for AI-Protection sig updates; permanent unblock will factory sigcheck every reboot" $CONFIG
pc_append "192.168.50.2 dlcdnets-ds.asus.com.edgekey.net" $CONFIG
pc_append "#Signature updates In Asia?" $CONFIG
pc_append "192.168.50.2 wideip-dlcdnets.isoi.asia" $CONFIG
pc_append "#Noticed during initial sig update check, not subsequent checks. Not necessary for sig-updates." $CONFIG
pc_append "192.168.50.2 ntd-asus-2014b-en.fbs20.trendmicro.com" $CONFIG
pc_append "192.168.50.2 ntd-asus-2014b-en-cfg.fbs20.trendmicro.com" $CONFIG
sed -i '$a\## end of Silently Block All Redundant Querys to Google, TrendMicro, and Asus ##' $CONFIG