fix: dont' show interface twice if it is the gateway

This commit is contained in:
evilsocket 2018-01-29 15:30:30 +01:00
commit 6bd88bc7e3
2 changed files with 7 additions and 2 deletions

View file

@ -81,7 +81,7 @@ func (s *EventsStream) dumpEvent(e session.Event) {
if e.Tag == "sys.log" {
fmt.Printf("[%s] [%s] (%s) %s\n", tm, core.Green(e.Tag), e.Label(), e.Data.(session.LogMessage).Message)
} else {
fmt.Printf("[%s] [%s] %v\n", tm, core.Green(e.Tag), e)
fmt.Printf("[%s] [%s] %+v\n", tm, core.Green(e.Tag), e)
}
s.Session.Refresh()

View file

@ -126,7 +126,12 @@ func (d *Discovery) Show(by string) error {
sort.Sort(ByAddressSorter(targets))
}
if d.Session.Interface.HwAddress == d.Session.Gateway.HwAddress {
targets = append([]*net.Endpoint{d.Session.Interface}, targets...)
} else {
targets = append([]*net.Endpoint{d.Session.Interface, d.Session.Gateway}, targets...)
}
rows := make([][]string, 0)
for i, t := range targets {
rows = append(rows, d.getRow(t))