1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add DNS to Security

This commit is contained in:
Chris Cummer
2018-04-09 10:19:12 -07:00
committed by Chris Cummer
parent aa658db210
commit cc4b5714f0
5 changed files with 25 additions and 5 deletions

View File

@@ -5,10 +5,11 @@ import ()
func Fetch() map[string]string {
data := make(map[string]string)
data["Dns"] = DnsServers()
data["Enabled"] = FirewallState()
data["Stealth"] = FirewallStealthState()
data["Encryption"] = WifiEncryption()
data["Network"] = WifiName()
data["Stealth"] = FirewallStealthState()
return data
}

14
security/dns.go Normal file
View File

@@ -0,0 +1,14 @@
package security
import (
"os/exec"
"github.com/senorprogrammer/wtf/wtf"
)
const dnsCmd = "networksetup"
func DnsServers() string {
cmd := exec.Command(dnsCmd, "-getdnsservers", "Wi-Fi")
return wtf.ExecuteCommand(cmd)
}

View File

@@ -2,7 +2,7 @@ package security
import (
"fmt"
//"sort"
"strings"
"time"
"github.com/gdamore/tcell"
@@ -66,6 +66,11 @@ func (widget *Widget) contentFrom(data map[string]string) string {
str = str + fmt.Sprintf(" %8s: %s\n", "Enabled", data["Enabled"])
str = str + fmt.Sprintf(" %8s: %s\n", "Stealth", data["Stealth"])
str = str + "\n"
str = str + " [red]DNS[white]\n"
for _, record := range strings.Split(data["Dns"], "\n") {
str = str + fmt.Sprintf(" %8s\n", record)
}
return str
}