Skip to content

Instantly share code, notes, and snippets.

@mostafabahri
Created June 18, 2020 17:26
Show Gist options
  • Save mostafabahri/115d4473b0ab7b187e5d35b0972c46de to your computer and use it in GitHub Desktop.
Save mostafabahri/115d4473b0ab7b187e5d35b0972c46de to your computer and use it in GitHub Desktop.
Shecan.ir script
shecan(){
# dns config file
conf=/etc/resolv.conf
downNames=$(cat << EOF
nameserver 8.8.4.4
nameserver 8.8.8.8
EOF
)
upNames=$(cat << EOF
# shecan servers
nameserver 178.22.122.100
nameserver 185.51.200.2
EOF
)
# status flag
if [[ $1 = "-s" ]]; then
cat $conf;
return;
fi
# deactivate flag
if [[ $1 = "-d" ]]; then
echo $downNames | sudo tee $conf && echo "shecan off.";
# activate (no flag)
else
echo $upNames| sudo tee $conf && echo "shecan on!";
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment