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

Added firewall status on linux

This commit is contained in:
TheRedSpy15 2018-10-12 10:40:45 -04:00 committed by GitHub
parent a48d15079a
commit 8b3d3cc91d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import (
"os/exec" "os/exec"
"runtime" "runtime"
"strings" "strings"
"bytes"
"github.com/senorprogrammer/wtf/wtf" "github.com/senorprogrammer/wtf/wtf"
) )
@ -36,8 +37,21 @@ func FirewallStealthState() string {
/* -------------------- Unexported Functions -------------------- */ /* -------------------- Unexported Functions -------------------- */
func firewallStateLinux() string { func firewallStateLinux() string { // might be very Ubuntu specific
return "[red]NA[white]" cmd := exec.Command("ufw, "status")
var o bytes.Buffer
cmd.Stdout = &o
if err := cmd.Run(); err != nil {
panic(err.Error())
}
if strings.Contains(o.String(), "active") {
return "[green]Enabled[white]"
} else {
return "[red]Disabled[white]"
}
} }
func firewallStateMacOS() string { func firewallStateMacOS() string {