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:
parent
a48d15079a
commit
8b3d3cc91d
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user