mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
Re-run gofmt -s after modifications
This commit is contained in:
parent
e91d0cb63c
commit
d80fef3ef9
11 changed files with 30 additions and 30 deletions
|
@ -2,11 +2,11 @@ package core
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/evilsocket/islazy/fs"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
"io"
|
||||
"os"
|
||||
"testing"
|
||||
"github.com/evilsocket/islazy/str"
|
||||
"github.com/evilsocket/islazy/fs"
|
||||
)
|
||||
|
||||
func hasInt(a []int, v int) bool {
|
||||
|
|
|
@ -122,7 +122,7 @@ func (p *HTTPProxy) Configure(address string, proxyPort int, httpPort int, scrip
|
|||
data, err := ioutil.ReadFile(jsToInject)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
jsToInject = string(data)
|
||||
}
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ func (s *SSLStripper) isMaxRedirs(hostname string) bool {
|
|||
delete(s.redirs, hostname)
|
||||
return true
|
||||
}
|
||||
// increment
|
||||
// increment
|
||||
s.redirs[hostname]++
|
||||
} else {
|
||||
// start tracking redirections
|
||||
|
|
|
@ -122,11 +122,11 @@ func (d *Discovery) Show(by string, expr string) (err error) {
|
|||
}
|
||||
|
||||
switch by {
|
||||
case "seen" :
|
||||
case "seen":
|
||||
sort.Sort(BySeenSorter(targets))
|
||||
case "sent" :
|
||||
case "sent":
|
||||
sort.Sort(BySentSorter(targets))
|
||||
case "rcvd" :
|
||||
case "rcvd":
|
||||
sort.Sort(ByRcvdSorter(targets))
|
||||
default:
|
||||
sort.Sort(ByAddressSorter(targets))
|
||||
|
|
|
@ -84,7 +84,7 @@ func (w *WiFiModule) getRow(station *network.Station) ([]string, bool) {
|
|||
recvd,
|
||||
seen,
|
||||
}, include
|
||||
}
|
||||
}
|
||||
// this is ugly, but necessary in order to have this
|
||||
// method handle both access point and clients
|
||||
// transparently
|
||||
|
|
|
@ -162,10 +162,10 @@ func (t *Endpoint) OnMeta(meta map[string]string) {
|
|||
for k, v := range meta {
|
||||
// simple heuristics to get the longest candidate name
|
||||
if len(v) > len(host) {
|
||||
if strings.HasSuffix(k, ":hostname"){
|
||||
if strings.HasSuffix(k, ":hostname") {
|
||||
host = v
|
||||
}
|
||||
if k == "mdns:md"{
|
||||
if k == "mdns:md" {
|
||||
host = v
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ func setup(t testing.TB, envFile bool, envFileData bool) {
|
|||
teardown(t)
|
||||
|
||||
if envFile {
|
||||
fp, err := os.OpenFile(testEnvFile, os.O_RDONLY|os.O_CREATE, 0666);
|
||||
fp, err := os.OpenFile(testEnvFile, os.O_RDONLY|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ func setup(t testing.TB, envFile bool, envFileData bool) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = ioutil.WriteFile(testEnvFile, raw, 0755);
|
||||
err = ioutil.WriteFile(testEnvFile, raw, 0755)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ func TestSessionEnvironmentWithDataFile(t *testing.T) {
|
|||
}
|
||||
if len(env.Data) != len(testEnvData) {
|
||||
t.Fatalf("expected %d, found %d", len(testEnvData), len(env.Data))
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(env.Data, testEnvData) {
|
||||
t.Fatalf("unexpected contents: %v", env.Data)
|
||||
}
|
||||
|
@ -147,12 +147,12 @@ func TestSessionEnvironmentHas(t *testing.T) {
|
|||
env, err := NewEnvironment(testEnvFile)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
if len(env.Data) != len(testEnvData) {
|
||||
t.Fatalf("expected %d, found %d", len(testEnvData), len(env.Data))
|
||||
}
|
||||
t.Log("expected environment")
|
||||
|
||||
|
||||
for k := range testEnvData {
|
||||
if !env.Has(k) {
|
||||
t.Fatalf("could not find key '%s'", k)
|
||||
|
@ -213,7 +213,7 @@ func TestSessionEnvironmentSetWithCallback(t *testing.T) {
|
|||
old = env.Set("people", "shitagain")
|
||||
if old != "ok" {
|
||||
t.Fatalf("unexpected old value: %s", old)
|
||||
}
|
||||
}
|
||||
if !cbCalled {
|
||||
t.Fatal("callback has not been called")
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ func TestSessionEnvironmentGet(t *testing.T) {
|
|||
t.Fatalf("expected %d, found %d", len(testEnvData), len(env.Data))
|
||||
}
|
||||
t.Log("expected environment")
|
||||
|
||||
|
||||
for k, v := range testEnvData {
|
||||
found, vv := env.Get(k)
|
||||
if !found {
|
||||
|
@ -276,10 +276,10 @@ func TestSessionEnvironmentGetInt(t *testing.T) {
|
|||
}
|
||||
|
||||
env.Data["num"] = "1234"
|
||||
err, i := env.GetInt("num");
|
||||
err, i := env.GetInt("num")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
if i != 1234 {
|
||||
t.Fatalf("unexpected integer: %d", i)
|
||||
}
|
||||
|
|
|
@ -61,11 +61,11 @@ func (m *SessionModule) Param(name string) *ModuleParam {
|
|||
|
||||
func (m SessionModule) ListParam(name string) (err error, values []string) {
|
||||
values = make([]string, 0)
|
||||
err, list := m.StringParam(name);
|
||||
err, list := m.StringParam(name)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
parts := strings.Split(list, ",")
|
||||
for _, part := range parts {
|
||||
part = str.Trim(part)
|
||||
|
@ -77,9 +77,9 @@ func (m SessionModule) ListParam(name string) (err error, values []string) {
|
|||
}
|
||||
|
||||
func (m SessionModule) StringParam(name string) (error, string) {
|
||||
p, found := m.params[name];
|
||||
p, found := m.params[name]
|
||||
if found {
|
||||
err, v := p.Get(m.Session);
|
||||
err, v := p.Get(m.Session)
|
||||
if err != nil {
|
||||
return err, ""
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ func (m SessionModule) StringParam(name string) (error, string) {
|
|||
}
|
||||
|
||||
func (m SessionModule) IPParam(name string) (error, net.IP) {
|
||||
err, v := m.StringParam(name);
|
||||
err, v := m.StringParam(name)
|
||||
if err != nil {
|
||||
return err, nil
|
||||
}
|
||||
|
@ -97,9 +97,9 @@ func (m SessionModule) IPParam(name string) (error, net.IP) {
|
|||
}
|
||||
|
||||
func (m SessionModule) IntParam(name string) (error, int) {
|
||||
p, found := m.params[name];
|
||||
p, found := m.params[name]
|
||||
if found {
|
||||
err, v := p.Get(m.Session);
|
||||
err, v := p.Get(m.Session)
|
||||
if err != nil {
|
||||
return err, 0
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func (m SessionModule) IntParam(name string) (error, int) {
|
|||
}
|
||||
|
||||
func (m SessionModule) BoolParam(name string) (error, bool) {
|
||||
err, v := m.params[name].Get(m.Session);
|
||||
err, v := m.params[name].Get(m.Session)
|
||||
if err != nil {
|
||||
return err, false
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ func New() (*Session, error) {
|
|||
}
|
||||
|
||||
if *s.Options.CpuProfile != "" {
|
||||
f, err := os.Create(*s.Options.CpuProfile);
|
||||
f, err := os.Create(*s.Options.CpuProfile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ func (s *Session) exitHandler(args []string, sess *Session) error {
|
|||
}
|
||||
|
||||
func (s *Session) sleepHandler(args []string, sess *Session) error {
|
||||
secs, err := strconv.Atoi(args[0]);
|
||||
secs, err := strconv.Atoi(args[0])
|
||||
if err == nil {
|
||||
time.Sleep(time.Duration(secs) * time.Second)
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ func ParseCommands(line string) []string {
|
|||
func (s *Session) parseEnvTokens(str string) (string, error) {
|
||||
for _, m := range reEnvVarCapture.FindAllString(str, -1) {
|
||||
varName := strings.Trim(strings.Replace(m, "env.", "", -1), "{}")
|
||||
found, value := s.Env.Get(varName);
|
||||
found, value := s.Env.Get(varName)
|
||||
if !found {
|
||||
return "", fmt.Errorf("variable '%s' is not defined", varName)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue