From f9db4cc9901d41d4a1d0e8f4890c7f8ba5e565d6 Mon Sep 17 00:00:00 2001 From: lucus Date: Mon, 4 Jun 2018 17:40:02 +0900 Subject: [PATCH] Fix issue #89 Better handle dns on macOS --- security/dns.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/dns.go b/security/dns.go index 7360d801..69edfcc3 100644 --- a/security/dns.go +++ b/security/dns.go @@ -42,7 +42,8 @@ func dnsLinux() []string { } func dnsMacOS() []string { - cmd := exec.Command("networksetup", "-getdnsservers", "Wi-Fi") + cmdString := `scutil --dns | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'` + cmd := exec.Command("sh", "-c", cmdString) out := wtf.ExecuteCommand(cmd) lines := strings.Split(out, "\n")