This commit is contained in:
evilsocket 2024-10-01 00:37:54 +02:00
commit 7e1cb69071
2 changed files with 13 additions and 3 deletions

View file

@ -44,14 +44,21 @@ func (mod *EventsStream) viewZeroConfEvent(output io.Writer, e session.Event) {
instPart = fmt.Sprintf(" and instances %s", strings.Join(instances, ", ")) 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), e.Time.Format(mod.timeFormat),
tui.Green(e.Tag), tui.Green(e.Tag),
source, source,
ops.Ternary(event.Query.QR, "RESPONSE", "QUERY"), ops.Ternary(event.Query.QR, "RESPONSE", "QUERY"),
strings.Join(services, ", "), strings.Join(services, ", "),
instPart, instPart,
textPart,
) )
} else { } else {
fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e) fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e)
} }

View file

@ -27,6 +27,7 @@ type BrowsingEvent struct {
Endpoint *network.Endpoint `json:"endpoint"` Endpoint *network.Endpoint `json:"endpoint"`
Services []string `json:"services"` Services []string `json:"services"`
Instances []string `json:"instances"` Instances []string `json:"instances"`
Text []string `json:"text"`
Query layers.DNS `json:"query"` Query layers.DNS `json:"query"`
} }
@ -258,11 +259,12 @@ func (mod *ZeroGod) onPacket(pkt gopacket.Packet) {
} }
instances := make([]string, 0) instances := make([]string, 0)
text := make([]string, 0)
for _, answer := range append(append(dns.Answers, dns.Additionals...), dns.Authorities...) { for _, answer := range append(append(dns.Answers, dns.Additionals...), dns.Authorities...) {
if answer.Class == layers.DNSClassIN && answer.Type == layers.DNSTypePTR { if answer.Class == layers.DNSClassIN && answer.Type == layers.DNSTypePTR {
instances = append(instances, string(answer.PTR)) instances = append(instances, string(answer.PTR))
} else { } else if answer.Type == layers.DNSTypeTXT {
instances = append(instances, answer.String()) text = append(text, string(answer.TXT))
} }
} }
@ -271,6 +273,7 @@ func (mod *ZeroGod) onPacket(pkt gopacket.Packet) {
Query: dns, Query: dns,
Services: services, Services: services,
Instances: instances, Instances: instances,
Text: text,
Endpoint: mod.Session.Lan.GetByIp(srcIP.String()), Endpoint: mod.Session.Lan.GetByIp(srcIP.String()),
} }