Created
January 27, 2018 18:29
-
-
Save happyhater/69bede3513d9bd81d6afca5fde5b9359 to your computer and use it in GitHub Desktop.
Fix resolver from VPN and others software for Mac OS X and uid-root only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -------------------------------- | |
# Description: scutil - fix resolver from VPN clients (Mac OS X and uid-root/sudo) | |
# Author: God <god@whitehats.net> | |
# WWW: whitehat.ro / whitehats.net | |
# -------------------------------- | |
# Mar 23 Ian 2018 00:33:59 EET - first release | |
dns="185.220.184.184" | |
comanda=$(scutil <<EOF | |
open | |
list | |
quit | |
EOF) | |
variabile=$(echo -en "$comanda\n"|grep State|grep "/DNS"|awk '{print $4}') | |
for i in $variabile | |
do | |
echo "Modificare nameserver: $i, catre: $dns." | |
scutil <<FINAL | |
open | |
d.init | |
d.add ServerAddresses * $dns | |
set $i | |
quit | |
FINAL | |
done | |
networksetup -setdnsservers Wi-Fi $dns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment