mirror of
https://github.com/bettercap/bettercap
synced 2025-07-31 12:10:10 -07:00
new: net.sniff now also reports mDNS questions
This commit is contained in:
parent
cf000fc5f7
commit
da9919484b
1 changed files with 15 additions and 0 deletions
|
@ -14,6 +14,21 @@ func mdnsParser(ip *layers.IPv4, pkt gopacket.Packet, udp *layers.UDP) bool {
|
|||
if udp.SrcPort == packets.MDNSPort && udp.DstPort == packets.MDNSPort {
|
||||
dns := layers.DNS{}
|
||||
if err := dns.DecodeFromBytes(udp.Payload, gopacket.NilDecodeFeedback); err == nil && dns.OpCode == layers.DNSOpCodeQuery {
|
||||
for _, q := range dns.Questions {
|
||||
NewSnifferEvent(
|
||||
pkt.Metadata().Timestamp,
|
||||
"mdns",
|
||||
ip.SrcIP.String(),
|
||||
ip.DstIP.String(),
|
||||
nil,
|
||||
"%s %s : %s query for %s",
|
||||
core.W(core.BG_DGRAY+core.FG_WHITE, "mdns"),
|
||||
vIP(ip.SrcIP),
|
||||
core.Dim(q.Type.String()),
|
||||
core.Yellow(string(q.Name)),
|
||||
).Push()
|
||||
}
|
||||
|
||||
m := make(map[string][]string)
|
||||
answers := append(dns.Answers, dns.Additionals...)
|
||||
answers = append(answers, dns.Authorities...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue