misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2019-03-30 18:19:34 +01:00
commit 5ef330f80b
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -41,7 +41,7 @@ func Make(iface *network.Endpoint) FirewallManager {
}
func (f PfFirewall) sysCtlRead(param string) (string, error) {
if out, err := core.ExecSilent("sysctl", []string{param}); err != nil {
if out, err := core.Exec("sysctl", []string{param}); err != nil {
return "", err
} else if m := sysCtlParser.FindStringSubmatch(out); len(m) == 3 && m[1] == param {
return m[2], nil
@ -52,7 +52,7 @@ func (f PfFirewall) sysCtlRead(param string) (string, error) {
func (f PfFirewall) sysCtlWrite(param string, value string) (string, error) {
args := []string{"-w", fmt.Sprintf("%s=%s", param, value)}
_, err := core.ExecSilent("sysctl", args)
_, err := core.Exec("sysctl", args)
if err != nil {
return "", err
}
@ -115,9 +115,9 @@ func (f PfFirewall) generateRule(r *Redirection) string {
func (f *PfFirewall) enable(enabled bool) {
f.enabled = enabled
if enabled {
core.ExecSilent("pfctl", []string{"-e"})
core.Exec("pfctl", []string{"-e"})
} else {
core.ExecSilent("pfctl", []string{"-d"})
core.Exec("pfctl", []string{"-d"})
}
}
@ -139,7 +139,7 @@ func (f PfFirewall) EnableRedirection(r *Redirection, enabled bool) error {
f.enable(true)
// load the rule
if _, err := core.ExecSilent("pfctl", []string{"-f", f.filename}); err != nil {
if _, err := core.Exec("pfctl", []string{"-f", f.filename}); err != nil {
return err
}
} else {