#!/bin/bash green='\033[0;32m' yellow='\033[0;33m' plain='\033[0m' red='\033[0;31m' green=[${green}OK${plain}] yellow=[${yellow}Info${plain}] red=[${red}Error${plain}] unlock(){ if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install bind-utils wget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh && bash dnsmasq_sniproxy.sh -id elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then apt-get update apt-get install dnsutils wget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh && bash dnsmasq_sniproxy.sh -id elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then apt-get update apt-get install dnsutils wget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh && bash dnsmasq_sniproxy.sh -id else echo "This script only supports CentOS, Ubuntu and Debian." exit 1 fi if [ $? -eq 0 ]; then systemctl enable dnsmasq chattr -i /etc/resolv.conf if [ ! -f '/etc/resolv.conf.bak' ];then cp -f /etc/resolv.conf /etc/resolv.conf.bak fi rm -f /etc/resolv.conf echo "nameserver 127.0.0.1" > /etc/resolv.conf chattr +i /etc/resolv.conf cat > /etc/dnsmasq.d/unlock.conf < /etc/resolv.conf <