mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
f9ebb1a77e
commit
5ef330f80b
1 changed files with 5 additions and 5 deletions
|
@ -41,7 +41,7 @@ func Make(iface *network.Endpoint) FirewallManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f PfFirewall) sysCtlRead(param string) (string, error) {
|
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
|
return "", err
|
||||||
} else if m := sysCtlParser.FindStringSubmatch(out); len(m) == 3 && m[1] == param {
|
} else if m := sysCtlParser.FindStringSubmatch(out); len(m) == 3 && m[1] == param {
|
||||||
return m[2], nil
|
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) {
|
func (f PfFirewall) sysCtlWrite(param string, value string) (string, error) {
|
||||||
args := []string{"-w", fmt.Sprintf("%s=%s", param, value)}
|
args := []string{"-w", fmt.Sprintf("%s=%s", param, value)}
|
||||||
_, err := core.ExecSilent("sysctl", args)
|
_, err := core.Exec("sysctl", args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -115,9 +115,9 @@ func (f PfFirewall) generateRule(r *Redirection) string {
|
||||||
func (f *PfFirewall) enable(enabled bool) {
|
func (f *PfFirewall) enable(enabled bool) {
|
||||||
f.enabled = enabled
|
f.enabled = enabled
|
||||||
if enabled {
|
if enabled {
|
||||||
core.ExecSilent("pfctl", []string{"-e"})
|
core.Exec("pfctl", []string{"-e"})
|
||||||
} else {
|
} 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)
|
f.enable(true)
|
||||||
|
|
||||||
// load the rule
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue