File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -44,23 +44,22 @@ func FirewallStealthState() string {
4444
4545func firewallStateLinux () string { // might be very Ubuntu specific
4646 user , _ := user .Current ()
47+ cmd := exec .Command ("sudo" , "/usr/sbin/ufw" , "status" )
4748
4849 if strings .Contains (user .Username , "root" ) {
49- cmd := exec .Command ("ufw" , "status" )
50-
51- var o bytes.Buffer
52- cmd .Stdout = & o
53- if err := cmd .Run (); err != nil {
54- return "[red]NA[white]"
55- }
56-
57- if strings .Contains (o .String (), "inactive" ) {
58- return "[red]Disabled[white]"
59- } else {
60- return "[green]Enabled[white]"
61- }
50+ cmd = exec .Command ("ufw" , "status" )
51+ }
52+
53+ var o bytes.Buffer
54+ cmd .Stdout = & o
55+ if err := cmd .Run (); err != nil {
56+ return "[red]NA[white]"
57+ }
58+
59+ if strings .Contains (o .String (), "inactive" ) {
60+ return "[red]Disabled[white]"
6261 } else {
63- return "[red]N/A [white]"
62+ return "[green]Enabled [white]"
6463 }
6564}
6665
You can’t perform that action at this time.
0 commit comments