From 27596d87ed9531f6bf4a20db1d444e557e672a8c Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Fri, 23 Feb 2024 15:41:25 -0700 Subject: [PATCH 1/4] recommit files --- framework/python/src/common/testreport.py | 20 +++- testing/unit/dns/{ => captures}/dns.pcap | Bin testing/unit/dns/{ => captures}/monitor.pcap | Bin testing/unit/dns/{ => captures}/startup.pcap | Bin testing/unit/dns/dns_module_test.py | 20 ++-- .../dns/{ => reports}/dns_report_local.md | 0 .../{ => reports}/dns_report_local_no_dns.md | 0 testing/unit/nmap/nmap_module_test.py | 16 ++- testing/unit/nmap/nmap_report_local.md | 8 -- .../nmap/{ => reports}/all_closed_report.md | 0 .../unit/nmap/reports/nmap_report_local.md | 12 ++ .../nmap/{ => reports}/ports_open_report.md | 22 ++-- .../{ => results}/all_closed_scan_result.json | 0 .../{ => results}/ports_open_scan_result.json | 0 testing/unit/ntp/ntp_module_test.py | 18 +-- testing/unit/report/report_test.py | 11 +- testing/unit/run_tests.sh | 111 +++++++++--------- 17 files changed, 131 insertions(+), 107 deletions(-) rename testing/unit/dns/{ => captures}/dns.pcap (100%) rename testing/unit/dns/{ => captures}/monitor.pcap (100%) rename testing/unit/dns/{ => captures}/startup.pcap (100%) rename testing/unit/dns/{ => reports}/dns_report_local.md (100%) rename testing/unit/dns/{ => reports}/dns_report_local_no_dns.md (100%) delete mode 100644 testing/unit/nmap/nmap_report_local.md rename testing/unit/nmap/{ => reports}/all_closed_report.md (100%) create mode 100644 testing/unit/nmap/reports/nmap_report_local.md rename testing/unit/nmap/{ => reports}/ports_open_report.md (97%) rename testing/unit/nmap/{ => results}/all_closed_scan_result.json (100%) rename testing/unit/nmap/{ => results}/ports_open_scan_result.json (100%) diff --git a/framework/python/src/common/testreport.py b/framework/python/src/common/testreport.py index 6d0b6e78e..fd9bd3d25 100644 --- a/framework/python/src/common/testreport.py +++ b/framework/python/src/common/testreport.py @@ -308,8 +308,8 @@ def generate_module_reports(self, json_data): #Add styling to the markdown content = content.replace('', '
') - content = content.replace('

', '

') - content = content.replace('

', '

') + content = content.replace('

', '

') + content = content.replace('

', '

') content = self.generate_module_pages(json_data=json_data, module_reports=content) @@ -804,10 +804,24 @@ def generate_css(self): padding: 8px; } - .markdown-header{ + .markdown-header-h1{ margin-left:20px; margin-top:20px; margin-bottom:20px; + margin-right:0px; + + font-size: 2em; + font-weight: bold; + } + + .markdown-header-h2{ + margin-left:20px; + margin-top:20px; + margin-bottom:20px; + margin-right:0px; + + font-size: 1.5em; + font-weight: bold; } .module-page-content{ diff --git a/testing/unit/dns/dns.pcap b/testing/unit/dns/captures/dns.pcap similarity index 100% rename from testing/unit/dns/dns.pcap rename to testing/unit/dns/captures/dns.pcap diff --git a/testing/unit/dns/monitor.pcap b/testing/unit/dns/captures/monitor.pcap similarity index 100% rename from testing/unit/dns/monitor.pcap rename to testing/unit/dns/captures/monitor.pcap diff --git a/testing/unit/dns/startup.pcap b/testing/unit/dns/captures/startup.pcap similarity index 100% rename from testing/unit/dns/startup.pcap rename to testing/unit/dns/captures/startup.pcap diff --git a/testing/unit/dns/dns_module_test.py b/testing/unit/dns/dns_module_test.py index 13911a7f3..ad9c89e02 100644 --- a/testing/unit/dns/dns_module_test.py +++ b/testing/unit/dns/dns_module_test.py @@ -19,18 +19,20 @@ MODULE = 'dns' -# Define the file paths +# Define the directories TEST_FILES_DIR = 'testing/unit/' + MODULE -OUTPUT_DIR = TEST_FILES_DIR + '/output/' -# TEMP_DIR = TEST_FILES_DIR + '/temp/' -LOCAL_REPORT = TEST_FILES_DIR + '/dns_report_local.md' -LOCAL_REPORT_NO_DNS = TEST_FILES_DIR + '/dns_report_local_no_dns.md' +OUTPUT_DIR = os.path.join(TEST_FILES_DIR,'output/') +REPORTS_DIR = os.path.join(TEST_FILES_DIR,'reports/') +CAPTURES_DIR = os.path.join(TEST_FILES_DIR,'captures/') + +LOCAL_REPORT = os.path.join(REPORTS_DIR,'dns_report_local.md') +LOCAL_REPORT_NO_DNS = os.path.join(REPORTS_DIR,'dns_report_local_no_dns.md') CONF_FILE = 'modules/test/' + MODULE + '/conf/module_config.json' -# Define the capture files to be used for the test -DNS_SERVER_CAPTURE_FILE = TEST_FILES_DIR + '/dns.pcap' -STARTUP_CAPTURE_FILE = TEST_FILES_DIR + '/startup.pcap' -MONITOR_CAPTURE_FILE = TEST_FILES_DIR + '/monitor.pcap' +# Define the capture files to be used for the test +DNS_SERVER_CAPTURE_FILE = os.path.join(CAPTURES_DIR,'dns.pcap') +STARTUP_CAPTURE_FILE = os.path.join(CAPTURES_DIR,'startup.pcap') +MONITOR_CAPTURE_FILE = os.path.join(CAPTURES_DIR,'monitor.pcap') class TLSModuleTest(unittest.TestCase): """Contains and runs all the unit tests concerning DNS behaviors""" diff --git a/testing/unit/dns/dns_report_local.md b/testing/unit/dns/reports/dns_report_local.md similarity index 100% rename from testing/unit/dns/dns_report_local.md rename to testing/unit/dns/reports/dns_report_local.md diff --git a/testing/unit/dns/dns_report_local_no_dns.md b/testing/unit/dns/reports/dns_report_local_no_dns.md similarity index 100% rename from testing/unit/dns/dns_report_local_no_dns.md rename to testing/unit/dns/reports/dns_report_local_no_dns.md diff --git a/testing/unit/nmap/nmap_module_test.py b/testing/unit/nmap/nmap_module_test.py index 0a08ff2d5..8fa42738f 100644 --- a/testing/unit/nmap/nmap_module_test.py +++ b/testing/unit/nmap/nmap_module_test.py @@ -21,8 +21,11 @@ # Define the file paths TEST_FILES_DIR = 'testing/unit/' + MODULE -OUTPUT_DIR = TEST_FILES_DIR + '/output/' -LOCAL_REPORT = TEST_FILES_DIR + '/nmap_report_local.md' +OUTPUT_DIR = os.path.join(TEST_FILES_DIR,'output/') +REPORTS_DIR = os.path.join(TEST_FILES_DIR,'reports/') +RESULTS_DIR = os.path.join(TEST_FILES_DIR,'results/') + +LOCAL_REPORT = os.path.join(REPORTS_DIR,'nmap_report_local.md') CONF_FILE = 'modules/test/' + MODULE + '/conf/module_config.json' @@ -37,7 +40,7 @@ def setUpClass(cls): # Test the module report generation def nmap_module_ports_open_report_test(self): # Move test scan into expected folder - src_scan_results_path = os.path.join(TEST_FILES_DIR,'ports_open_scan_result.json') + src_scan_results_path = os.path.join(RESULTS_DIR,'ports_open_scan_result.json') dst_scan_results_path = os.path.join(OUTPUT_DIR,'nmap_scan_results.json') shutil.copy(src_scan_results_path, dst_scan_results_path) @@ -55,7 +58,8 @@ def nmap_module_ports_open_report_test(self): report_out = file.read() # Read the local good report - local_report = TEST_FILES_DIR + '/ports_open_report.md' + + local_report = os.path.join(REPORTS_DIR,'ports_open_report.md') with open(local_report, 'r', encoding='utf-8') as file: report_local = file.read() @@ -63,7 +67,7 @@ def nmap_module_ports_open_report_test(self): # Test the module report generation with all ports closed def nmap_module_report_all_closed_test(self): - src_scan_results_path = os.path.join(TEST_FILES_DIR,'all_closed_scan_result.json') + src_scan_results_path = os.path.join(RESULTS_DIR,'all_closed_scan_result.json') dst_scan_results_path = os.path.join(OUTPUT_DIR,'nmap_scan_results.json') shutil.copy(src_scan_results_path, dst_scan_results_path) @@ -81,7 +85,7 @@ def nmap_module_report_all_closed_test(self): report_out = file.read() # Read the local good report - local_report = TEST_FILES_DIR + '/all_closed_report.md' + local_report = os.path.join(REPORTS_DIR,'all_closed_report.md') with open(local_report, 'r', encoding='utf-8') as file: report_local = file.read() diff --git a/testing/unit/nmap/nmap_report_local.md b/testing/unit/nmap/nmap_report_local.md deleted file mode 100644 index 1e69bc720..000000000 --- a/testing/unit/nmap/nmap_report_local.md +++ /dev/null @@ -1,8 +0,0 @@ -# NMAP Module - -- No ports detected open - -## Summary -- TCP Ports Open: 0 -- UDP Ports Open: 0 -- Total Ports Open: 0 \ No newline at end of file diff --git a/testing/unit/nmap/all_closed_report.md b/testing/unit/nmap/reports/all_closed_report.md similarity index 100% rename from testing/unit/nmap/all_closed_report.md rename to testing/unit/nmap/reports/all_closed_report.md diff --git a/testing/unit/nmap/reports/nmap_report_local.md b/testing/unit/nmap/reports/nmap_report_local.md new file mode 100644 index 000000000..df7c216f1 --- /dev/null +++ b/testing/unit/nmap/reports/nmap_report_local.md @@ -0,0 +1,12 @@ +# NMAP Module + +| Port | Type | State | Service | Version | +|------------|------------|------------|------|------------------| +| 22 | tcp | open | ssh | 8.8 protocol 2.0 | +| 443 | tcp | open | http | | +| 502 | tcp | open | mbap | | + +## Summary +- TCP Ports Open: 3 +- UDP Ports Open: 0 +- Total Ports Open: 3 \ No newline at end of file diff --git a/testing/unit/nmap/ports_open_report.md b/testing/unit/nmap/reports/ports_open_report.md similarity index 97% rename from testing/unit/nmap/ports_open_report.md rename to testing/unit/nmap/reports/ports_open_report.md index bace55c5a..df7c216f1 100644 --- a/testing/unit/nmap/ports_open_report.md +++ b/testing/unit/nmap/reports/ports_open_report.md @@ -1,12 +1,12 @@ -# NMAP Module - -| Port | Type | State | Service | Version | -|------------|------------|------------|------|------------------| -| 22 | tcp | open | ssh | 8.8 protocol 2.0 | -| 443 | tcp | open | http | | -| 502 | tcp | open | mbap | | - -## Summary -- TCP Ports Open: 3 -- UDP Ports Open: 0 +# NMAP Module + +| Port | Type | State | Service | Version | +|------------|------------|------------|------|------------------| +| 22 | tcp | open | ssh | 8.8 protocol 2.0 | +| 443 | tcp | open | http | | +| 502 | tcp | open | mbap | | + +## Summary +- TCP Ports Open: 3 +- UDP Ports Open: 0 - Total Ports Open: 3 \ No newline at end of file diff --git a/testing/unit/nmap/all_closed_scan_result.json b/testing/unit/nmap/results/all_closed_scan_result.json similarity index 100% rename from testing/unit/nmap/all_closed_scan_result.json rename to testing/unit/nmap/results/all_closed_scan_result.json diff --git a/testing/unit/nmap/ports_open_scan_result.json b/testing/unit/nmap/results/ports_open_scan_result.json similarity index 100% rename from testing/unit/nmap/ports_open_scan_result.json rename to testing/unit/nmap/results/ports_open_scan_result.json diff --git a/testing/unit/ntp/ntp_module_test.py b/testing/unit/ntp/ntp_module_test.py index 7d2bc32c6..40eab9515 100644 --- a/testing/unit/ntp/ntp_module_test.py +++ b/testing/unit/ntp/ntp_module_test.py @@ -21,18 +21,18 @@ # Define the file paths TEST_FILES_DIR = 'testing/unit/' + MODULE -OUTPUT_DIR = f'{TEST_FILES_DIR}/output/' -REPORTS_DIR = '/reports' -CAPTURES_DIR = '/captures' +OUTPUT_DIR = os.path.join(TEST_FILES_DIR,'output/') +REPORTS_DIR = os.path.join(TEST_FILES_DIR,'reports/') +CAPTURES_DIR = os.path.join(TEST_FILES_DIR,'captures/') -LOCAL_REPORT = f'{TEST_FILES_DIR}/{REPORTS_DIR}/ntp_report_local.md' -LOCAL_REPORT_NO_NTP = (f'{TEST_FILES_DIR}/{REPORTS_DIR}/' - f'ntp_report_local_no_ntp.md') +LOCAL_REPORT = os.path.join(REPORTS_DIR,'ntp_report_local.md') +LOCAL_REPORT_NO_NTP = os.path.join(REPORTS_DIR,'ntp_report_local_no_ntp.md') CONF_FILE = 'modules/test/' + MODULE + '/conf/module_config.json' + # Define the capture files to be used for the test -NTP_SERVER_CAPTURE_FILE = f'{TEST_FILES_DIR}/{CAPTURES_DIR}/ntp.pcap' -STARTUP_CAPTURE_FILE = f'{TEST_FILES_DIR}/{CAPTURES_DIR}/startup.pcap' -MONITOR_CAPTURE_FILE = f'{TEST_FILES_DIR}/{CAPTURES_DIR}/monitor.pcap' +NTP_SERVER_CAPTURE_FILE = os.path.join(CAPTURES_DIR,'ntp.pcap') +STARTUP_CAPTURE_FILE = os.path.join(CAPTURES_DIR,'startup.pcap') +MONITOR_CAPTURE_FILE = os.path.join(CAPTURES_DIR,'monitor.pcap') class NTPModuleTest(unittest.TestCase): diff --git a/testing/unit/report/report_test.py b/testing/unit/report/report_test.py index 287e90bed..4a46b81f7 100644 --- a/testing/unit/report/report_test.py +++ b/testing/unit/report/report_test.py @@ -20,10 +20,9 @@ MODULE = 'report' # Define the file paths -TEST_FILES_DIR = 'testing/unit/' + MODULE -OUTPUT_DIR = TEST_FILES_DIR + '/output/' UNIT_TEST_DIR = 'testing/unit/' - +TEST_FILES_DIR = os.path.join('testing/unit',MODULE) +OUTPUT_DIR = os.path.join(TEST_FILES_DIR,'output/') class ReportTest(unittest.TestCase): """Contains and runs all the unit tests concerning DNS behaviors""" @@ -47,6 +46,7 @@ def report_test(self): reports_md = [] reports_md.append(self.get_module_md_report('dns')) reports_md.append(self.get_module_md_report('nmap')) + reports_md.append(self.get_module_md_report('ntp')) report.add_module_reports(reports_md) # Generate the report @@ -56,8 +56,9 @@ def report_test(self): def get_module_md_report(self, module): # Combine the path components using os.path.join - report_file = os.path.join(UNIT_TEST_DIR, module, - module + '_report_local.md') + report_file = os.path.join(UNIT_TEST_DIR, + os.path.join(module, + os.path.join('reports',module+'_report_local.md'))) with open(report_file, 'r', encoding='utf-8') as file: report = file.read() diff --git a/testing/unit/run_tests.sh b/testing/unit/run_tests.sh index c42923a2d..6643db92b 100644 --- a/testing/unit/run_tests.sh +++ b/testing/unit/run_tests.sh @@ -1,57 +1,56 @@ -#!/bin/bash -e - -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script should be run from within the unit_test directory. If -# it is run outside this directory, paths will not be resolved correctly. - -# Move into the root directory of test-run -pushd ../../ >/dev/null 2>&1 - -echo "Root Dir: $PWD" - -# Add the framework sources -PYTHONPATH="$PWD/framework/python/src:$PWD/framework/python/src/common" - -# Add the test module sources -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/base/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/tls/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/dns/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/nmap/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/ntp/python/src" -# Set the python path with all sources -export PYTHONPATH - -# Run the DHCP Unit tests -python3 -u $PWD/modules/network/dhcp-1/python/src/grpc_server/dhcp_config_test.py -python3 -u $PWD/modules/network/dhcp-2/python/src/grpc_server/dhcp_config_test.py - -# Run the TLS Module Unit Tests -python3 -u $PWD/testing/unit/tls/tls_module_test.py - -# Run the DNS Module Unit Tests -python3 -u $PWD/testing/unit/dns/dns_module_test.py - -# Run the NMAP Module Unit Tests -python3 -u $PWD/testing/unit/nmap/nmap_module_test.py - -# Run the Report Unit Tests -python3 -u $PWD/testing/unit/report/report_test.py - -# Run the NMAP Module Unit Tests -python3 -u $PWD/testing/unit/ntp/ntp_module_test.py - - +#!/bin/bash -e + +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script should be run from within the unit_test directory. If +# it is run outside this directory, paths will not be resolved correctly. + +# Move into the root directory of test-run +pushd ../../ >/dev/null 2>&1 + +echo "Root Dir: $PWD" + +# Add the framework sources +PYTHONPATH="$PWD/framework/python/src:$PWD/framework/python/src/common" + +# Add the test module sources +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/base/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/tls/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/dns/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/nmap/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/ntp/python/src" +# Set the python path with all sources +export PYTHONPATH + +# Run the DHCP Unit tests +python3 -u $PWD/modules/network/dhcp-1/python/src/grpc_server/dhcp_config_test.py +python3 -u $PWD/modules/network/dhcp-2/python/src/grpc_server/dhcp_config_test.py + +# Run the TLS Module Unit Tests +python3 -u $PWD/testing/unit/tls/tls_module_test.py + +# Run the DNS Module Unit Tests +python3 -u $PWD/testing/unit/dns/dns_module_test.py + +# Run the NMAP Module Unit Tests +python3 -u $PWD/testing/unit/nmap/nmap_module_test.py + +# Run the NTP Module Unit Tests +python3 -u $PWD/testing/unit/ntp/ntp_module_test.py + +# Run the Report Unit Tests +python3 -u $PWD/testing/unit/report/report_test.py + popd >/dev/null 2>&1 \ No newline at end of file From 4f50c4d350b5bf97525d41e33cc093f7c3ce7c6a Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Mon, 26 Feb 2024 08:00:42 -0700 Subject: [PATCH 2/4] Cleanup DNS module report Nmap module misc cleanup --- modules/test/dns/python/src/dns_module.py | 47 +++++--- modules/test/nmap/python/src/nmap_module.py | 1 - testing/unit/dns/reports/dns_report_local.md | 2 +- .../dns/reports/dns_report_local_no_dns.md | 8 +- testing/unit/run_tests.sh | 110 +++++++++--------- 5 files changed, 90 insertions(+), 78 deletions(-) diff --git a/modules/test/dns/python/src/dns_module.py b/modules/test/dns/python/src/dns_module.py index eefc0c872..5d109f699 100644 --- a/modules/test/dns/python/src/dns_module.py +++ b/modules/test/dns/python/src/dns_module.py @@ -63,18 +63,6 @@ def generate_module_report(self): total_responses = sum(1 for row in dns_table_data if row['Type'] == 'Response') - #total_requests = len(dns_table_data) - - # Find the maximum length of 'Destination' values - max_data_length = max(len(row['Data']) for row in dns_table_data) if len(dns_table_data)>0 else 8 - - table_content = '' - for row in dns_table_data: - table_content += f'''| {row['Source']: ^12} | {row['Destination']: ^13} | {row['Type']: ^9} | {row['Data']: ^{max_data_length}} |\r''' - - # Dynamically adjust the header width based on the longest 'Destination' content - header = f'''| {'Source': ^12} | {'Destination': ^{13}} | {'Type': ^9} | {'Data': ^{max_data_length}} |''' - header_line = f'''|{'-' * 14}|{'-' * 15}|{'-' * 11}|{'-' * (max_data_length + 2)}|''' summary = '## Summary' summary += f'''\n- Requests to local DNS server: {local_requests}''' @@ -82,11 +70,38 @@ def generate_module_report(self): summary += f'''\n- Total DNS requests: {total_requests}''' summary += f'''\n- Total DNS responses: {total_responses}''' - markdown_template = f'''# DNS Module - \r{header}\r{header_line}\r{table_content}\r{summary} - ''' + if (total_requests + total_responses) > 0: + + # Find the maximum length of 'Destination' values + max_data_length = max(len(row['Data']) for row in dns_table_data) if len(dns_table_data)>0 else 8 + + table_content = '' + for row in dns_table_data: + #table_content += f'''| {row['Source']: ^12} | {row['Destination']: ^13} | {row['Type']: ^9} | {row['Data']: ^{max_data_length}} |\r''' + table_content += (f'''| {row['Source']: ^12} ''' + f'''| {row['Destination']: ^13} ''' + f'''| {row['Type']: ^9} ''' + f'''| {row['Data']: ^{max_data_length}} |\n''') - LOGGER.debug("Markdown Report:\n" + markdown_template) + # Dynamically adjust the header width based on the longest 'Destination' content + # header = f'''| {'Source': ^12} | {'Destination': ^{13}} | {'Type': ^9} | {'Data': ^{max_data_length}} |''' + # header_line = f'''|{'-' * 14}|{'-' * 15}|{'-' * 11}|{'-' * (max_data_length + 2)}|''' + + header = (f'''| {'Source': ^12} ''' + f'''| {'Destination': ^{13}} ''' + f'''| {'Type': ^{9}} ''' + f'''| {'Data': ^{max_data_length}} |''') + header_line = (f'''|{'-' * 14}|{'-' * 15}|{'-' * 11}|''' + f'''{'-' * (max_data_length + 2)}''') + + markdown_template = (f'''# DNS Module\n''' + f'''\n{header}\n{header_line}\n{table_content}\n{summary}''') + + else: + markdown_template = (f'''# DNS Module\n''' + f'''\n- No DNS traffic detected\n''' + f'''\n{summary}''') + LOGGER.debug('Markdown Report:\n' + markdown_template) # Use os.path.join to create the complete file path report_path = os.path.join(self._results_dir, MODULE_REPORT_FILE_NAME) diff --git a/modules/test/nmap/python/src/nmap_module.py b/modules/test/nmap/python/src/nmap_module.py index 93477b7ee..2bd0d3a5b 100644 --- a/modules/test/nmap/python/src/nmap_module.py +++ b/modules/test/nmap/python/src/nmap_module.py @@ -57,7 +57,6 @@ def generate_module_report(self): # Use os.path.join to create the complete file path nmap_scan_results_file = os.path.join(self._nmap_scan_results_path, NMAP_SCAN_RESULTS_SCAN_FILE) - LOGGER.info('Scan Results File:\n' + str(nmap_scan_results_file)) # Read the nmap scan results with open(nmap_scan_results_file, 'r', encoding='utf-8') as file: diff --git a/testing/unit/dns/reports/dns_report_local.md b/testing/unit/dns/reports/dns_report_local.md index c0f076a54..423745d73 100644 --- a/testing/unit/dns/reports/dns_report_local.md +++ b/testing/unit/dns/reports/dns_report_local.md @@ -1 +1 @@ -# DNS Module | Source | Destination | Type | Data | |--------------|---------------|-----------|---------------------| | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 8.8.8.8 | Query | mqtt.googleapis.com | | 10.10.10.4 | 8.8.8.8 | Query | mqtt.googleapis.com | | 8.8.8.8 | 10.10.10.4 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 8.8.8.8 | 10.10.10.4 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Query | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Query | pool.ntp.org | | 8.8.8.8 | 10.10.10.4 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 8.8.8.8 | 10.10.10.4 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Query | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 8.8.8.8 | 10.10.10.4 | Response | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 8.8.8.8 | Query | mqtt.googleapis.com | | 8.8.8.8 | 10.10.10.4 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | ## Summary - Requests to local DNS server: 71 - Requests to external DNS servers: 6 - Total DNS requests: 77 - Total DNS responses: 91 \ No newline at end of file +# DNS Module | Source | Destination | Type | Data | |--------------|---------------|-----------|--------------------- | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 8.8.8.8 | Query | mqtt.googleapis.com | | 10.10.10.4 | 8.8.8.8 | Query | mqtt.googleapis.com | | 8.8.8.8 | 10.10.10.4 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 8.8.8.8 | 10.10.10.4 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Query | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Query | pool.ntp.org | | 8.8.8.8 | 10.10.10.4 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 8.8.8.8 | 10.10.10.4 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Query | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 8.8.8.8 | 10.10.10.4 | Response | pool.ntp.org | | 10.10.10.4 | 8.8.8.8 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 8.8.8.8 | Query | mqtt.googleapis.com | | 8.8.8.8 | 10.10.10.4 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.4 | 10.10.10.14 | Response | pool.ntp.org | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.14 | 10.10.10.4 | Query | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | | 10.10.10.4 | 10.10.10.14 | Response | mqtt.googleapis.com | ## Summary - Requests to local DNS server: 71 - Requests to external DNS servers: 6 - Total DNS requests: 77 - Total DNS responses: 91 \ No newline at end of file diff --git a/testing/unit/dns/reports/dns_report_local_no_dns.md b/testing/unit/dns/reports/dns_report_local_no_dns.md index 6e07516ab..b07302289 100644 --- a/testing/unit/dns/reports/dns_report_local_no_dns.md +++ b/testing/unit/dns/reports/dns_report_local_no_dns.md @@ -1,11 +1,9 @@ # DNS Module - -| Source | Destination | Type | Data | -|--------------|---------------|-----------|----------| + +- No DNS traffic detected ## Summary - Requests to local DNS server: 0 - Requests to external DNS servers: 0 - Total DNS requests: 0 -- Total DNS responses: 0 - \ No newline at end of file +- Total DNS responses: 0 \ No newline at end of file diff --git a/testing/unit/run_tests.sh b/testing/unit/run_tests.sh index 6643db92b..64c911ab6 100644 --- a/testing/unit/run_tests.sh +++ b/testing/unit/run_tests.sh @@ -1,56 +1,56 @@ -#!/bin/bash -e - -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script should be run from within the unit_test directory. If -# it is run outside this directory, paths will not be resolved correctly. - -# Move into the root directory of test-run -pushd ../../ >/dev/null 2>&1 - -echo "Root Dir: $PWD" - -# Add the framework sources -PYTHONPATH="$PWD/framework/python/src:$PWD/framework/python/src/common" - -# Add the test module sources -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/base/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/tls/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/dns/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/nmap/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/ntp/python/src" -# Set the python path with all sources -export PYTHONPATH - -# Run the DHCP Unit tests -python3 -u $PWD/modules/network/dhcp-1/python/src/grpc_server/dhcp_config_test.py -python3 -u $PWD/modules/network/dhcp-2/python/src/grpc_server/dhcp_config_test.py - -# Run the TLS Module Unit Tests -python3 -u $PWD/testing/unit/tls/tls_module_test.py - -# Run the DNS Module Unit Tests -python3 -u $PWD/testing/unit/dns/dns_module_test.py - -# Run the NMAP Module Unit Tests -python3 -u $PWD/testing/unit/nmap/nmap_module_test.py - -# Run the NTP Module Unit Tests -python3 -u $PWD/testing/unit/ntp/ntp_module_test.py - -# Run the Report Unit Tests -python3 -u $PWD/testing/unit/report/report_test.py - +#!/bin/bash -e + +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script should be run from within the unit_test directory. If +# it is run outside this directory, paths will not be resolved correctly. + +# Move into the root directory of test-run +pushd ../../ >/dev/null 2>&1 + +echo "Root Dir: $PWD" + +# Add the framework sources +PYTHONPATH="$PWD/framework/python/src:$PWD/framework/python/src/common" + +# Add the test module sources +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/base/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/tls/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/dns/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/nmap/python/src" +PYTHONPATH="$PYTHONPATH:$PWD/modules/test/ntp/python/src" +# Set the python path with all sources +export PYTHONPATH + +# # Run the DHCP Unit tests +# python3 -u $PWD/modules/network/dhcp-1/python/src/grpc_server/dhcp_config_test.py +# python3 -u $PWD/modules/network/dhcp-2/python/src/grpc_server/dhcp_config_test.py + +# # Run the TLS Module Unit Tests +# python3 -u $PWD/testing/unit/tls/tls_module_test.py + +# Run the DNS Module Unit Tests +python3 -u $PWD/testing/unit/dns/dns_module_test.py + +# # Run the NMAP Module Unit Tests +# python3 -u $PWD/testing/unit/nmap/nmap_module_test.py + +# # Run the NTP Module Unit Tests +# python3 -u $PWD/testing/unit/ntp/ntp_module_test.py + +# # # Run the Report Unit Tests +# python3 -u $PWD/testing/unit/report/report_test.py + popd >/dev/null 2>&1 \ No newline at end of file From a36448d325928ba940c5b8adbc1f0f30d7de882a Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Mon, 26 Feb 2024 12:27:59 -0700 Subject: [PATCH 3/4] enable all unit tests --- testing/unit/run_tests.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/testing/unit/run_tests.sh b/testing/unit/run_tests.sh index 64c911ab6..fe186c8db 100644 --- a/testing/unit/run_tests.sh +++ b/testing/unit/run_tests.sh @@ -34,23 +34,23 @@ PYTHONPATH="$PYTHONPATH:$PWD/modules/test/ntp/python/src" # Set the python path with all sources export PYTHONPATH -# # Run the DHCP Unit tests -# python3 -u $PWD/modules/network/dhcp-1/python/src/grpc_server/dhcp_config_test.py -# python3 -u $PWD/modules/network/dhcp-2/python/src/grpc_server/dhcp_config_test.py +# Run the DHCP Unit tests +python3 -u $PWD/modules/network/dhcp-1/python/src/grpc_server/dhcp_config_test.py +python3 -u $PWD/modules/network/dhcp-2/python/src/grpc_server/dhcp_config_test.py -# # Run the TLS Module Unit Tests -# python3 -u $PWD/testing/unit/tls/tls_module_test.py +# Run the TLS Module Unit Tests +python3 -u $PWD/testing/unit/tls/tls_module_test.py # Run the DNS Module Unit Tests python3 -u $PWD/testing/unit/dns/dns_module_test.py -# # Run the NMAP Module Unit Tests -# python3 -u $PWD/testing/unit/nmap/nmap_module_test.py +# Run the NMAP Module Unit Tests +python3 -u $PWD/testing/unit/nmap/nmap_module_test.py -# # Run the NTP Module Unit Tests -# python3 -u $PWD/testing/unit/ntp/ntp_module_test.py +# Run the NTP Module Unit Tests +python3 -u $PWD/testing/unit/ntp/ntp_module_test.py -# # # Run the Report Unit Tests -# python3 -u $PWD/testing/unit/report/report_test.py +# # Run the Report Unit Tests +python3 -u $PWD/testing/unit/report/report_test.py popd >/dev/null 2>&1 \ No newline at end of file From db378b9249b2095421dddad2e3dabe094a6fe427 Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Mon, 26 Feb 2024 13:55:05 -0700 Subject: [PATCH 4/4] dns module cleanup --- modules/test/dns/python/src/dns_module.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/test/dns/python/src/dns_module.py b/modules/test/dns/python/src/dns_module.py index 5d109f699..2272c6859 100644 --- a/modules/test/dns/python/src/dns_module.py +++ b/modules/test/dns/python/src/dns_module.py @@ -77,16 +77,11 @@ def generate_module_report(self): table_content = '' for row in dns_table_data: - #table_content += f'''| {row['Source']: ^12} | {row['Destination']: ^13} | {row['Type']: ^9} | {row['Data']: ^{max_data_length}} |\r''' table_content += (f'''| {row['Source']: ^12} ''' f'''| {row['Destination']: ^13} ''' f'''| {row['Type']: ^9} ''' f'''| {row['Data']: ^{max_data_length}} |\n''') - # Dynamically adjust the header width based on the longest 'Destination' content - # header = f'''| {'Source': ^12} | {'Destination': ^{13}} | {'Type': ^9} | {'Data': ^{max_data_length}} |''' - # header_line = f'''|{'-' * 14}|{'-' * 15}|{'-' * 11}|{'-' * (max_data_length + 2)}|''' - header = (f'''| {'Source': ^12} ''' f'''| {'Destination': ^{13}} ''' f'''| {'Type': ^{9}} '''