From 7e1cb69071b8d964b2634ff8ee6ed9e49fe6d108 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Tue, 1 Oct 2024 00:37:54 +0200 Subject: [PATCH] misc --- modules/events_stream/events_view_zeroconf.go | 9 ++++++++- modules/zerogod/zerogod_discovery.go | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/events_stream/events_view_zeroconf.go b/modules/events_stream/events_view_zeroconf.go index 8de9dfc6..766fe4bc 100644 --- a/modules/events_stream/events_view_zeroconf.go +++ b/modules/events_stream/events_view_zeroconf.go @@ -44,14 +44,21 @@ func (mod *EventsStream) viewZeroConfEvent(output io.Writer, e session.Event) { instPart = fmt.Sprintf(" and instances %s", strings.Join(instances, ", ")) } - fmt.Fprintf(output, "[%s] [%s] %s is browsing (%s) for services %s%s\n", + textPart := "" + if len(event.Text) > 0 { + textPart = fmt.Sprintf("\n text records: %s\n", strings.Join(event.Text, ", ")) + } + + fmt.Fprintf(output, "[%s] [%s] %s is browsing (%s) for services %s%s\n%s", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), source, ops.Ternary(event.Query.QR, "RESPONSE", "QUERY"), strings.Join(services, ", "), instPart, + textPart, ) + } else { fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e) } diff --git a/modules/zerogod/zerogod_discovery.go b/modules/zerogod/zerogod_discovery.go index 4e805271..97d0f486 100644 --- a/modules/zerogod/zerogod_discovery.go +++ b/modules/zerogod/zerogod_discovery.go @@ -27,6 +27,7 @@ type BrowsingEvent struct { Endpoint *network.Endpoint `json:"endpoint"` Services []string `json:"services"` Instances []string `json:"instances"` + Text []string `json:"text"` Query layers.DNS `json:"query"` } @@ -258,11 +259,12 @@ func (mod *ZeroGod) onPacket(pkt gopacket.Packet) { } instances := make([]string, 0) + text := make([]string, 0) for _, answer := range append(append(dns.Answers, dns.Additionals...), dns.Authorities...) { if answer.Class == layers.DNSClassIN && answer.Type == layers.DNSTypePTR { instances = append(instances, string(answer.PTR)) - } else { - instances = append(instances, answer.String()) + } else if answer.Type == layers.DNSTypeTXT { + text = append(text, string(answer.TXT)) } } @@ -271,6 +273,7 @@ func (mod *ZeroGod) onPacket(pkt gopacket.Packet) { Query: dns, Services: services, Instances: instances, + Text: text, Endpoint: mod.Session.Lan.GetByIp(srcIP.String()), }