fix: showing more info for endpoint.lost event.

This commit is contained in:
evilsocket 2018-02-09 19:27:22 +01:00
commit 77ada2f419

View file

@ -21,21 +21,30 @@ func (s EventsStream) viewLogEvent(e session.Event) {
func (s EventsStream) viewEndpointEvent(e session.Event) { func (s EventsStream) viewEndpointEvent(e session.Event) {
t := e.Data.(*net.Endpoint) t := e.Data.(*net.Endpoint)
if e.Tag == "endpoint.new" { vend := ""
vend := "" name := ""
if t.Vendor != "" {
vend = fmt.Sprintf(" (%s)", t.Vendor)
}
if t.Vendor != "" {
vend = fmt.Sprintf(" (%s)", t.Vendor)
}
if t.Hostname != "" {
name = fmt.Sprintf(" (%s)", t.Hostname)
} else if t.Alias != "" {
name = fmt.Sprintf(" (%s)", t.Alias)
}
if e.Tag == "endpoint.new" {
fmt.Printf("[%s] Endpoint %s detected as %s%s.\n", fmt.Printf("[%s] Endpoint %s detected as %s%s.\n",
e.Time.Format(eventTimeFormat), e.Time.Format(eventTimeFormat),
core.Bold(t.IpAddress), core.Bold(t.IpAddress),
core.Green(t.HwAddress), core.Green(t.HwAddress),
vend) vend)
} else if e.Tag == "endpoint.lost" { } else if e.Tag == "endpoint.lost" {
fmt.Printf("[%s] Endpoint %s lost.\n", fmt.Printf("[%s] Endpoint %s%s lost.\n",
e.Time.Format(eventTimeFormat), e.Time.Format(eventTimeFormat),
core.Red(t.IpAddress)) core.Red(t.IpAddress),
name)
} else { } else {
fmt.Printf("[%s] [%s] %s\n", fmt.Printf("[%s] [%s] %s\n",
e.Time.Format(eventTimeFormat), e.Time.Format(eventTimeFormat),