refact: refactored to use islazy and updated deps

This commit is contained in:
evilsocket 2018-10-10 19:00:25 +02:00
parent a2b3ee79fb
commit d070445225
238 changed files with 12662 additions and 1586 deletions

View file

@ -148,13 +148,13 @@ func (f PfFirewall) EnableRedirection(r *Redirection, enabled bool) error {
lines := ""
scanner := bufio.NewScanner(fd)
for scanner.Scan() {
line := core.Trim(scanner.Text())
line := str.Trim(scanner.Text())
if line != rule {
lines += line + "\n"
}
}
if core.Trim(lines) == "" {
if str.Trim(lines) == "" {
os.Remove(f.filename)
f.enable(false)
} else {

View file

@ -7,6 +7,8 @@ import (
"github.com/bettercap/bettercap/core"
"github.com/bettercap/bettercap/network"
"github.com/evilsocket/islazy/str"
)
type LinuxFirewall struct {
@ -54,7 +56,7 @@ func (f LinuxFirewall) IsForwardingEnabled() bool {
if out, err := ioutil.ReadFile(IPV4ForwardingFile); err != nil {
return false
} else {
return core.Trim(string(out)) == "1"
return str.Trim(string(out)) == "1"
}
}