mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
Merge pull request #548 from stefanoj3/minor_improvements
Minor improvements
This commit is contained in:
commit
7a80dc2b49
3 changed files with 10 additions and 5 deletions
|
@ -8,8 +8,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func UniqueInts(a []int, sorted bool) []int {
|
func UniqueInts(a []int, sorted bool) []int {
|
||||||
tmp := make(map[int]bool)
|
tmp := make(map[int]bool, len(a))
|
||||||
uniq := make([]int, 0)
|
uniq := make([]int, 0, len(a))
|
||||||
|
|
||||||
for _, n := range a {
|
for _, n := range a {
|
||||||
tmp[n] = true
|
tmp[n] = true
|
||||||
|
|
|
@ -123,7 +123,12 @@ func (l *TriggerList) Dispatch(e session.Event) (ident string, cmd string, err e
|
||||||
if node := jsonquery.FindOne(doc, expr); node != nil {
|
if node := jsonquery.FindOne(doc, expr); node != nil {
|
||||||
cmd = strings.Replace(cmd, m, node.InnerText(), -1)
|
cmd = strings.Replace(cmd, m, node.InnerText(), -1)
|
||||||
} else {
|
} else {
|
||||||
err = fmt.Errorf("error while parsing expressionfor trigger %s: '%s' doesn't resolve any object", tui.Bold(id), expr, expr, err)
|
err = fmt.Errorf(
|
||||||
|
"error while parsing expressionfor trigger %s: '%s' doesn't resolve any object: %v",
|
||||||
|
tui.Bold(id),
|
||||||
|
expr,
|
||||||
|
err,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/evilsocket/islazy/tui"
|
"github.com/evilsocket/islazy/tui"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
const (
|
||||||
AliveTimeInterval = time.Duration(10) * time.Second
|
AliveTimeInterval = time.Duration(10) * time.Second
|
||||||
PresentTimeInterval = time.Duration(1) * time.Minute
|
PresentTimeInterval = time.Duration(1) * time.Minute
|
||||||
JustJoinedTimeInterval = time.Duration(10) * time.Second
|
JustJoinedTimeInterval = time.Duration(10) * time.Second
|
||||||
|
@ -109,7 +109,7 @@ func (mod *Discovery) getRow(e *network.Endpoint, withMeta bool) [][]string {
|
||||||
})
|
})
|
||||||
sort.Strings(metas)
|
sort.Strings(metas)
|
||||||
|
|
||||||
rows := [][]string{}
|
rows := make([][]string, 0, len(metas))
|
||||||
for i, m := range metas {
|
for i, m := range metas {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
rows = append(rows, append(row, m))
|
rows = append(rows, append(row, m))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue