diff --git a/configure_zaprets.sh b/configure_zaprets.sh index ace4790..14d8f3c 100644 --- a/configure_zaprets.sh +++ b/configure_zaprets.sh @@ -7,24 +7,36 @@ config_files="dhcp youtubeUnblock https-dns-proxy" +checkAndAddDomainPermanentName() +{ + nameRule="option name '$1'" + str=$(grep -i "$nameRule" /etc/config/dhcp) + if [ -z "$str" ] + then + + uci add dhcp domain + uci set dhcp.@domain[-1].name="$1" + uci set dhcp.@domain[-1].ip="$2" + uci commit dhcp + fi +} + echo "Upgrade packages..." opkg update opkg upgrade youtubeUnblock opkg upgrade luci-app-youtubeUnblock -echo "Backup files..." - if [ ! -d "$DIR_BACKUP" ] then + echo "Backup files..." mkdir $DIR_BACKUP + for file in $config_files + do + cp -f "$DIR/$file" "$DIR_BACKUP/$file" + done fi -for file in $config_files -do - cp -f "$DIR/$file" "$DIR_BACKUP/$file" -done - echo "Replace configs..." for file in $config_files @@ -59,20 +71,47 @@ uci add_list dhcp.cfg01411c.server='/*.clashroyale.com/127.0.0.1#5056' uci add_list dhcp.cfg01411c.server='/*.brawlstars.com/127.0.0.1#5056' uci add_list dhcp.cfg01411c.server='/*.clash.com/127.0.0.1#5056' uci add_list dhcp.cfg01411c.server='/*.clashofclans.com/127.0.0.1#5056' -uci add dhcp domain # =cfg13f37d -uci set dhcp.@domain[-1].name='chatgpt.com' -uci set dhcp.@domain[-1].ip='94.131.119.85' -uci add dhcp domain # =cfg14f37d -uci set dhcp.@domain[-1].name='openai.com' -uci set dhcp.@domain[-1].ip='94.131.119.85' +uci add_list dhcp.cfg01411c.server='/*.x.ai/127.0.0.1#5056' +uci add_list dhcp.cfg01411c.server='/*.grok.com/127.0.0.1#5056' uci commit dhcp -echo "Crod task add restart service yotubeUnblock..." +echo "Add unblock ChatGPT..." -cronTask="0 4 * * * service youtubeUnblock restart" -str=$(grep -i "0 4 \* \* \* service youtubeUnblock restart" /etc/crontabs/root) +checkAndAddDomainPermanentName "chatgpt.com" "94.131.119.85" +checkAndAddDomainPermanentName "openai.com" "94.131.119.85" +checkAndAddDomainPermanentName "webrtc.chatgpt.com" "94.131.119.85" +checkAndAddDomainPermanentName "ios.chat.openai.com" "94.131.119.85" +checkAndAddDomainPermanentName "searchgpt.com" "94.131.119.85" + +nameRule="option name 'Block_UDP_443'" +str=$(grep -i "$nameRule" /etc/config/firewall) if [ -z "$str" ] then + echo "Add block QUIC..." + + uci add firewall rule # =cfg2492bd + uci set firewall.@rule[-1].name='Block_UDP_80' + uci add_list firewall.@rule[-1].proto='udp' + uci set firewall.@rule[-1].src='lan' + uci set firewall.@rule[-1].dest='wan' + uci set firewall.@rule[-1].dest_port='80' + uci set firewall.@rule[-1].target='REJECT' + uci add firewall rule # =cfg2592bd + uci set firewall.@rule[-1].name='Block_UDP_443' + uci add_list firewall.@rule[-1].proto='udp' + uci set firewall.@rule[-1].src='lan' + uci set firewall.@rule[-1].dest='wan' + uci set firewall.@rule[-1].dest_port='443' + uci set firewall.@rule[-1].target='REJECT' + uci commit firewall + service firewall restart +fi + +cronTask="0 4 * * * wget -O - $URL/configure_zaprets.sh | sh" +str=$(grep -i "0 4 \* \* \* wget -O - $URL/configure_zaprets.sh | sh" /etc/crontabs/root) +if [ -z "$str" ] +then + echo "Add cron task auto run configure_zapret..." echo "$cronTask" >> /etc/crontabs/root fi diff --git a/https-dns-proxy b/https-dns-proxy index 93e4e7c..f546eaa 100644 --- a/https-dns-proxy +++ b/https-dns-proxy @@ -28,7 +28,7 @@ config https-dns-proxy config https-dns-proxy option resolver_url 'https://router.comss.one/dns-query' - option bootstrap_dns '195.133.25.16, 212.109.195.93' + option bootstrap_dns '195.133.25.16,212.109.195.93' option listen_addr '127.0.0.1' option listen_port '5056' diff --git a/off_configure_zaprets.sh b/off_configure_zaprets.sh index 8825da5..a4f5953 100644 --- a/off_configure_zaprets.sh +++ b/off_configure_zaprets.sh @@ -1,5 +1,6 @@ #!/bin/sh +URL="https://raw.githubusercontent.com/CodeRoK7/RouterichAX3000_configs/refs/heads/main" DIR="/etc/config" DIR_BACKUP="/root/backup" config_files="dhcp @@ -13,6 +14,8 @@ do cp -f "$DIR_BACKUP/$file" "$DIR/$file" done +rm -rf "$DIR_BACKUP" + echo "Restart service..." service youtubeUnblock restart @@ -20,4 +23,10 @@ service https-dns-proxy restart service dnsmasq restart service odhcpd restart +echo "Remove cron task auto run script configure zaprets.." + +grep -v "0 4 \* \* \* wget -O - $URL/configure_zaprets.sh | sh" /etc/crontabs/root > /etc/crontabs/temp +cp -f "/etc/crontabs/temp" "/etc/crontabs/root" +rm -f "/etc/crontabs/temp" + echo "Off configure complete..."