Advertisement
pintcat

make-dns - switches between default & alternative DNS to bypass legal shit.

Apr 10th, 2022 (edited)
988
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.00 KB | None | 0 0
  1. #! /bin/sh
  2. # make-dns 1.0 - switches between default & alternative DNS (CyberGhost) to bypass legal shit.
  3.  
  4. ERROR(){
  5.     printf "\033[31mERROR! $1 argument. Must be either ON or OFF.\033[0m\n"
  6.     exit 1
  7. }
  8.  
  9. EDIT(){
  10.     [ "$(id -u)" -eq 0 ] || exec sudo sh "$0" $1
  11.     chattr -i /etc/resolv.conf
  12.     printf "$CONTENT" > /etc/resolv.conf
  13.     chattr +i /etc/resolv.conf
  14.     echo "Done - DNS server set $2."
  15. }
  16.  
  17. if [ $# -gt 0 ]; then
  18.     if [ "$1" = "on" ] || [ "$1" = "ON" ]; then
  19.         CONTENT="# Generated by NetworkManager
  20. #search fritz.box
  21. #nameserver 192.168.178.1
  22. #nameserver fd00::f2b0:14ff:fe67:ea25\n
  23. #CyberGhost
  24. nameserver 38.132.106.139
  25. nameserver 194.187.251.67\n"
  26.         EDIT $1 "to CyberGhost"
  27.     elif [ "$1" = "off" ] || [ "$1" = "OFF" ]; then
  28.         CONTENT="# Generated by NetworkManager
  29. search fritz.box
  30. nameserver 192.168.178.1
  31. nameserver fd00::f2b0:14ff:fe67:ea25\n
  32. #CyberGhost
  33. #nameserver 38.132.106.139
  34. #nameserver 194.187.251.67\n"
  35.         EDIT $1 "back to default"
  36.     else
  37.         ERROR "Wrong"
  38.     fi
  39. else
  40.     ERROR "No"
  41. fi
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement