mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Security extracted to new config format
This commit is contained in:
18
modules/security/settings.go
Normal file
18
modules/security/settings.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package security
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
||||
@@ -10,11 +10,15 @@ import (
|
||||
|
||||
type Widget struct {
|
||||
wtf.TextWidget
|
||||
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application) *Widget {
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: wtf.NewTextWidget(app, "Security", "security", false),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
return &widget
|
||||
@@ -48,12 +52,10 @@ func (widget *Widget) contentFrom(data *SecurityData) string {
|
||||
str = str + "\n"
|
||||
|
||||
str = str + " [red]Users[white]\n"
|
||||
str = str + fmt.Sprintf(" %s", strings.Join(data.LoggedInUsers, "\n "))
|
||||
str = str + "\n"
|
||||
str = str + fmt.Sprintf(" %s", strings.Join(data.LoggedInUsers, "\n "))
|
||||
str = str + "\n\n"
|
||||
|
||||
str = str + " [red]DNS[white]\n"
|
||||
//str = str + fmt.Sprintf(" %8s: [%s]%-3s[white] %-16s\n", "Enabled", widget.labelColor(data.FirewallEnabled), data.FirewallEnabled, data.DnsAt(0))
|
||||
//str = str + fmt.Sprintf(" %8s: [%s]%-3s[white] %-16s\n", "Stealth", widget.labelColor(data.FirewallStealth), data.FirewallStealth, data.DnsAt(1))
|
||||
str = str + fmt.Sprintf(" %12s\n", data.DnsAt(0))
|
||||
str = str + fmt.Sprintf(" %12s\n", data.DnsAt(1))
|
||||
str = str + "\n"
|
||||
|
||||
Reference in New Issue
Block a user