mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-05 17:10:57 +01:00

Ideally this information should go in a different Connection field, but for now lets use DstHost.
20 lines
461 B
Go
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
|
|
}
|