opensnitch/daemon/dns/parse.go
Gustavo Iñiguez Goia 93592b6b00 Allow to see which domain a process is trying to resolve
Ideally this information should go in a different Connection field, but
for now lets use DstHost.
2019-11-08 01:38:26 +01:00

20 lines
461 B
Go

package dns
import (
"github.com/gustavo-iniguez-goya/opensnitch/daemon/netfilter"
"github.com/google/gopacket/layers"
)
func GetQuestions(nfp *netfilter.Packet) (questions []string) {
dnsLayer := nfp.Packet.Layer(layers.LayerTypeDNS)
if dnsLayer == nil {
return questions
}
dns, _ := dnsLayer.(*layers.DNS)
for _, dnsQuestion := range dns.Questions {
questions = append(questions, string(dnsQuestion.Name))
}
return questions
}