Skip to content

Instantly share code, notes, and snippets.

@happyhater
Created January 27, 2018 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save happyhater/69bede3513d9bd81d6afca5fde5b9359 to your computer and use it in GitHub Desktop.
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.
#!/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