mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 21:42:06 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
7f7e5a24f8
commit
c838abbe25
3 changed files with 8 additions and 34 deletions
|
@ -78,29 +78,6 @@ func (d Discovery) Author() string {
|
||||||
return "Simone Margaritelli <evilsocket@protonmail.com>"
|
return "Simone Margaritelli <evilsocket@protonmail.com>"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Discovery) checkShared(new net.ArpTable) {
|
|
||||||
n_gw_shared := 0
|
|
||||||
for ip, mac := range new {
|
|
||||||
if ip != d.Session.Gateway.IpAddress && mac == d.Session.Gateway.HwAddress {
|
|
||||||
n_gw_shared++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if n_gw_shared > 0 {
|
|
||||||
a := ""
|
|
||||||
b := ""
|
|
||||||
if n_gw_shared == 1 {
|
|
||||||
a = ""
|
|
||||||
b = "s"
|
|
||||||
} else {
|
|
||||||
a = "s"
|
|
||||||
b = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Warning("Found %d endpoint%s which share%s the same MAC of the gateway (%s), there're might be some IP isolation going on, skipping.", n_gw_shared, a, b, d.Session.Gateway.HwAddress)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Discovery) runDiff() {
|
func (d *Discovery) runDiff() {
|
||||||
// check for endpoints who disappeared
|
// check for endpoints who disappeared
|
||||||
var rem net.ArpTable = make(net.ArpTable)
|
var rem net.ArpTable = make(net.ArpTable)
|
||||||
|
|
|
@ -100,7 +100,7 @@ func (t *Endpoint) String() string {
|
||||||
return fmt.Sprintf("%s : %s", t.IpAddress, t.HwAddress)
|
return fmt.Sprintf("%s : %s", t.IpAddress, t.HwAddress)
|
||||||
} else if t.Hostname == "" {
|
} else if t.Hostname == "" {
|
||||||
return fmt.Sprintf("%s : %s ( %s )", t.IpAddress, t.HwAddress, t.Vendor)
|
return fmt.Sprintf("%s : %s ( %s )", t.IpAddress, t.HwAddress, t.Vendor)
|
||||||
} else {
|
|
||||||
return fmt.Sprintf("%s : %s ( %s ) - "+core.BOLD+t.Hostname+core.RESET, t.IpAddress, t.HwAddress, t.Vendor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("%s : %s ( %s ) - %s", t.IpAddress, t.HwAddress, t.Vendor, core.Bold(t.Hostname))
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,15 +40,12 @@ func (h *ModuleHandler) Parse(line string) (bool, []string) {
|
||||||
if h.Parser == nil {
|
if h.Parser == nil {
|
||||||
if line == h.Name {
|
if line == h.Name {
|
||||||
return true, nil
|
return true, nil
|
||||||
} else {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
result := h.Parser.FindStringSubmatch(line)
|
|
||||||
if len(result) == h.Parser.NumSubexp()+1 {
|
|
||||||
return true, result[1:]
|
|
||||||
} else {
|
|
||||||
return false, nil
|
|
||||||
}
|
}
|
||||||
|
return false, nil
|
||||||
}
|
}
|
||||||
|
result := h.Parser.FindStringSubmatch(line)
|
||||||
|
if len(result) == h.Parser.NumSubexp()+1 {
|
||||||
|
return true, result[1:]
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue