Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions modules/test/dns/python/src/dns_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""DNS test module"""
import subprocess
from scapy.all import rdpcap, DNS, IP, Ether, DNSRR
from scapy.error import Scapy_Exception
from test_module import TestModule
import os
from collections import Counter
Expand Down Expand Up @@ -156,9 +157,15 @@ def generate_module_report(self):
def extract_dns_data(self):
dns_data = []

# Read the pcap file
packets = rdpcap(self.dns_server_capture_file) + rdpcap(
self.startup_capture_file) + rdpcap(self.monitor_capture_file)
# Read the startup and monitor pcap files
packets = (rdpcap(self.startup_capture_file) +
rdpcap(self.monitor_capture_file))

# Read the dns.pcap file
try:
packets += rdpcap(self.dns_server_capture_file)
except (FileNotFoundError, Scapy_Exception):
LOGGER.error('dns.pcap not found or empty, ignoring')

# Iterate through DNS packets
for packet in packets:
Expand Down