github.com/wtfutil/wtf@v0.43.0/modules/security/security_data.go (about)

     1  package security
     2  
     3  type SecurityData struct {
     4  	Dns             []string
     5  	FirewallEnabled string
     6  	FirewallStealth string
     7  	LoggedInUsers   []string
     8  	WifiEncryption  string
     9  	WifiName        string
    10  }
    11  
    12  func NewSecurityData() *SecurityData {
    13  	return &SecurityData{}
    14  }
    15  
    16  func (data SecurityData) DnsAt(idx int) string {
    17  	if len(data.Dns) > idx {
    18  		return data.Dns[idx]
    19  	}
    20  	return ""
    21  }
    22  
    23  func (data *SecurityData) Fetch() {
    24  	data.Dns = DnsServers()
    25  	data.FirewallEnabled = FirewallState()
    26  	data.FirewallStealth = FirewallStealthState()
    27  	data.LoggedInUsers = LoggedInUsers()
    28  	data.WifiName = WifiName()
    29  	data.WifiEncryption = WifiEncryption()
    30  }