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:
parent
aa658db210
commit
cc4b5714f0
@ -72,11 +72,11 @@ wtf:
|
|||||||
position:
|
position:
|
||||||
top: 4
|
top: 4
|
||||||
left: 0
|
left: 0
|
||||||
height: 1
|
height: 2
|
||||||
width: 1
|
width: 1
|
||||||
refreshInterval: 3600
|
refreshInterval: 3600
|
||||||
status:
|
status:
|
||||||
enabled: true
|
enabled: false
|
||||||
position:
|
position:
|
||||||
top: 5
|
top: 5
|
||||||
left: 0
|
left: 0
|
||||||
|
@ -71,7 +71,7 @@ func (widget *Widget) contentFrom(deploys []nr.ApplicationDeployment) string {
|
|||||||
str = str + fmt.Sprintf(
|
str = str + fmt.Sprintf(
|
||||||
" [green]%s[white] %s %-16s\n",
|
" [green]%s[white] %s %-16s\n",
|
||||||
deploy.Revision[0:8],
|
deploy.Revision[0:8],
|
||||||
deploy.Timestamp.Format("Jan 02, 15:04"),
|
deploy.Timestamp.Format("Jan 02, 15:04 MST"),
|
||||||
wtf.NameFromEmail(deploy.User),
|
wtf.NameFromEmail(deploy.User),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,10 +5,11 @@ import ()
|
|||||||
func Fetch() map[string]string {
|
func Fetch() map[string]string {
|
||||||
data := make(map[string]string)
|
data := make(map[string]string)
|
||||||
|
|
||||||
|
data["Dns"] = DnsServers()
|
||||||
data["Enabled"] = FirewallState()
|
data["Enabled"] = FirewallState()
|
||||||
data["Stealth"] = FirewallStealthState()
|
|
||||||
data["Encryption"] = WifiEncryption()
|
data["Encryption"] = WifiEncryption()
|
||||||
data["Network"] = WifiName()
|
data["Network"] = WifiName()
|
||||||
|
data["Stealth"] = FirewallStealthState()
|
||||||
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
14
security/dns.go
Normal file
14
security/dns.go
Normal 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)
|
||||||
|
}
|
@ -2,7 +2,7 @@ package security
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
//"sort"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gdamore/tcell"
|
"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", "Enabled", data["Enabled"])
|
||||||
str = str + fmt.Sprintf(" %8s: %s\n", "Stealth", data["Stealth"])
|
str = str + fmt.Sprintf(" %8s: %s\n", "Stealth", data["Stealth"])
|
||||||
str = str + "\n"
|
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
|
return str
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user