diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 0556a2189..d6deb1ab0 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -39,7 +39,7 @@ jobs: run: cmd/prepare - name: Install Testrun shell: bash {0} - run: TESTRUN_DIR=. cmd/install + run: cmd/install -l timeout-minutes: 30 - name: Run tests shell: bash {0} @@ -55,6 +55,28 @@ jobs: name: runtime_api_${{ github.run_id }} path: runtime.tgz + testrun_unit: + permissions: {} + name: Unit + runs-on: ubuntu-20.04 + timeout-minutes: 15 + steps: + - name: Checkout source + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Install dependencies + shell: bash {0} + run: cmd/prepare + - name: Install Testrun + shell: bash {0} + run: cmd/install -l + - name: Build Testrun + shell: bash {0} + run: cmd/build + timeout-minutes: 10 + - name: Run tests + shell: bash {0} + run: bash testing/unit/run.sh + pylint: permissions: {} name: Pylint diff --git a/.gitignore b/.gitignore index 82b6bbf64..68203577f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ testing/unit/tls/output/ testing/unit/tls/tmp/ testing/unit/report/output/ testing/unit/risk_profile/output/ +testing/unit/services/output/ *.deb make/DEBIAN/postinst diff --git a/modules/test/baseline/baseline.Dockerfile b/modules/test/baseline/baseline.Dockerfile index f7d21f8c8..5e0288018 100644 --- a/modules/test/baseline/baseline.Dockerfile +++ b/modules/test/baseline/baseline.Dockerfile @@ -24,5 +24,11 @@ COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files COPY $MODULE_DIR/bin /testrun/bin +# Remove incorrect line endings +RUN dos2unix /testrun/bin/* + +# Make sure all the bin files are executable +RUN chmod u+x /testrun/bin/* + # Copy over all python files COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/modules/test/conn/conn.Dockerfile b/modules/test/conn/conn.Dockerfile index a9f523e44..97c411e63 100644 --- a/modules/test/conn/conn.Dockerfile +++ b/modules/test/conn/conn.Dockerfile @@ -35,5 +35,11 @@ COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files COPY $MODULE_DIR/bin /testrun/bin +# Remove incorrect line endings +RUN dos2unix /testrun/bin/* + +# Make sure all the bin files are executable +RUN chmod u+x /testrun/bin/* + # Copy over all python files COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/modules/test/dns/dns.Dockerfile b/modules/test/dns/dns.Dockerfile index 0197fd72e..1b0703ad3 100644 --- a/modules/test/dns/dns.Dockerfile +++ b/modules/test/dns/dns.Dockerfile @@ -30,5 +30,11 @@ COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files COPY $MODULE_DIR/bin /testrun/bin +# Remove incorrect line endings +RUN dos2unix /testrun/bin/* + +# Make sure all the bin files are executable +RUN chmod u+x /testrun/bin/* + # Copy over all python files COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/modules/test/ntp/ntp.Dockerfile b/modules/test/ntp/ntp.Dockerfile index 33b06287e..c0c742596 100644 --- a/modules/test/ntp/ntp.Dockerfile +++ b/modules/test/ntp/ntp.Dockerfile @@ -16,5 +16,11 @@ COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files COPY $MODULE_DIR/bin /testrun/bin +# Remove incorrect line endings +RUN dos2unix /testrun/bin/* + +# Make sure all the bin files are executable +RUN chmod u+x /testrun/bin/* + # Copy over all python files COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/modules/test/protocol/bin/start_test_module b/modules/test/protocol/bin/start_test_module index a0754836c..d85ae7d6b 100644 --- a/modules/test/protocol/bin/start_test_module +++ b/modules/test/protocol/bin/start_test_module @@ -1,53 +1,53 @@ -#!/bin/bash - -# 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. - -# Setup and start the connection test module - -# Define where the python source files are located -PYTHON_SRC_DIR=/testrun/python/src - -# Fetch module name -MODULE_NAME=$1 - -# Default interface should be veth0 for all containers -DEFAULT_IFACE=veth0 - -# Allow a user to define an interface by passing it into this script -DEFINED_IFACE=$2 - -# Select which interace to use -if [[ -z $DEFINED_IFACE || "$DEFINED_IFACE" == "null" ]] -then - echo "No interface defined, defaulting to veth0" - INTF=$DEFAULT_IFACE -else - INTF=$DEFINED_IFACE -fi - -# Create and set permissions on the log files -LOG_FILE=/runtime/output/$MODULE_NAME.log -RESULT_FILE=/runtime/output/$MODULE_NAME-result.json -touch $LOG_FILE -touch $RESULT_FILE -chown $HOST_USER $LOG_FILE -chown $HOST_USER $RESULT_FILE - -# Run the python script that will execute the tests for this module -# -u flag allows python print statements -# to be logged by docker by running unbuffered -python3 -u $PYTHON_SRC_DIR/run.py "-m $MODULE_NAME" - +#!/bin/bash + +# 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. + +# Setup and start the connection test module + +# Define where the python source files are located +PYTHON_SRC_DIR=/testrun/python/src + +# Fetch module name +MODULE_NAME=$1 + +# Default interface should be veth0 for all containers +DEFAULT_IFACE=veth0 + +# Allow a user to define an interface by passing it into this script +DEFINED_IFACE=$2 + +# Select which interace to use +if [[ -z $DEFINED_IFACE || "$DEFINED_IFACE" == "null" ]] +then + echo "No interface defined, defaulting to veth0" + INTF=$DEFAULT_IFACE +else + INTF=$DEFINED_IFACE +fi + +# Create and set permissions on the log files +LOG_FILE=/runtime/output/$MODULE_NAME.log +RESULT_FILE=/runtime/output/$MODULE_NAME-result.json +touch $LOG_FILE +touch $RESULT_FILE +chown $HOST_USER $LOG_FILE +chown $HOST_USER $RESULT_FILE + +# Run the python script that will execute the tests for this module +# -u flag allows python print statements +# to be logged by docker by running unbuffered +python3 -u $PYTHON_SRC_DIR/run.py "-m $MODULE_NAME" + echo Module has finished \ No newline at end of file diff --git a/modules/test/protocol/protocol.Dockerfile b/modules/test/protocol/protocol.Dockerfile index 6f55520e1..ce7b7b272 100644 --- a/modules/test/protocol/protocol.Dockerfile +++ b/modules/test/protocol/protocol.Dockerfile @@ -39,5 +39,11 @@ COPY $MODULE_DIR/bin /testrun/bin # Copy over all binary files COPY $MODULE_DIR/bin /testrun/bin +# Remove incorrect line endings +RUN dos2unix /testrun/bin/* + +# Make sure all the bin files are executable +RUN chmod u+x /testrun/bin/* + # Copy over all python files COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/modules/test/services/services.Dockerfile b/modules/test/services/services.Dockerfile index 3a89fc33c..cad8ea314 100644 --- a/modules/test/services/services.Dockerfile +++ b/modules/test/services/services.Dockerfile @@ -30,5 +30,11 @@ COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files COPY $MODULE_DIR/bin /testrun/bin +# Remove incorrect line endings +RUN dos2unix /testrun/bin/* + +# Make sure all the bin files are executable +RUN chmod u+x /testrun/bin/* + # Copy over all python files COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/modules/test/tls/bin/get_tls_client_connections.sh b/modules/test/tls/bin/get_tls_client_connections.sh index e2e6da91b..7335cac80 100755 --- a/modules/test/tls/bin/get_tls_client_connections.sh +++ b/modules/test/tls/bin/get_tls_client_connections.sh @@ -1,32 +1,32 @@ -#!/bin/bash - -# 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. - -CAPTURE_FILE="$1" -SRC_IP="$2" -PROTOCOL=$3 - -TSHARK_OUTPUT="-T json -e ip.src -e tcp.dstport -e ip.dst" -TSHARK_FILTER="ip.src == $SRC_IP and tls" - -# Add a protocol filter if defined -if [ -n "$PROTOCOL" ];then - TSHARK_FILTER="$TSHARK_FILTER and $PROTOCOL" -fi - -response=$(tshark -r "$CAPTURE_FILE" $TSHARK_OUTPUT $TSHARK_FILTER) - -echo "$response" +#!/bin/bash + +# 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. + +CAPTURE_FILE="$1" +SRC_IP="$2" +PROTOCOL=$3 + +TSHARK_OUTPUT="-T json -e ip.src -e tcp.dstport -e ip.dst" +TSHARK_FILTER="ip.src == $SRC_IP and tls" + +# Add a protocol filter if defined +if [ -n "$PROTOCOL" ];then + TSHARK_FILTER="$TSHARK_FILTER and $PROTOCOL" +fi + +response=$(tshark -r "$CAPTURE_FILE" $TSHARK_OUTPUT $TSHARK_FILTER) + +echo "$response" \ No newline at end of file diff --git a/modules/test/tls/python/requirements-test.txt b/modules/test/tls/python/requirements-test.txt new file mode 100644 index 000000000..93b351f44 --- /dev/null +++ b/modules/test/tls/python/requirements-test.txt @@ -0,0 +1 @@ +scapy \ No newline at end of file diff --git a/modules/test/tls/tls.Dockerfile b/modules/test/tls/tls.Dockerfile index cedf9531b..987ede591 100644 --- a/modules/test/tls/tls.Dockerfile +++ b/modules/test/tls/tls.Dockerfile @@ -31,14 +31,20 @@ COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files COPY $MODULE_DIR/bin /testrun/bin +# Remove incorrect line endings +RUN dos2unix /testrun/bin/* + +# Make sure all the bin files are executable +RUN chmod u+x /testrun/bin/* + # Copy over all python files COPY $MODULE_DIR/python /testrun/python -#Install all python requirements for the module +# Install all python requirements for the module RUN pip3 install -r /testrun/python/requirements.txt +# Install all python requirements for the modules unit test +RUN pip3 install -r /testrun/python/requirements-test.txt + # Create a directory inside the container to store the root certificates RUN mkdir -p /testrun/root_certs - - - diff --git a/testing/unit/build.sh b/testing/unit/build.sh deleted file mode 100644 index db84e0299..000000000 --- a/testing/unit/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/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. - -sudo docker build -f testing/unit/unit_test.Dockerfile -t testrun/unit-test . \ No newline at end of file diff --git a/testing/unit/dns/dns_module_test.py b/testing/unit/dns/dns_module_test.py index 6c3dec74d..11bd73b68 100644 --- a/testing/unit/dns/dns_module_test.py +++ b/testing/unit/dns/dns_module_test.py @@ -16,7 +16,6 @@ import unittest from scapy.all import rdpcap, DNS, wrpcap import os -from testreport import TestReport MODULE = 'dns' @@ -28,7 +27,6 @@ LOCAL_REPORT = os.path.join(REPORTS_DIR, 'dns_report_local.html') LOCAL_REPORT_NO_DNS = os.path.join(REPORTS_DIR, 'dns_report_local_no_dns.html') -CONF_FILE = 'modules/test/' + MODULE + '/conf/module_config.json' # Define the capture files to be used for the test DNS_SERVER_CAPTURE_FILE = os.path.join(CAPTURES_DIR, 'dns.pcap') @@ -48,7 +46,6 @@ def setUpClass(cls): def dns_module_report_test(self): dns_module = DNSModule(module=MODULE, log_dir=OUTPUT_DIR, - conf_file=CONF_FILE, results_dir=OUTPUT_DIR, dns_server_capture_file=DNS_SERVER_CAPTURE_FILE, startup_capture_file=STARTUP_CAPTURE_FILE, @@ -59,12 +56,6 @@ def dns_module_report_test(self): # Read the generated report with open(report_out_path, 'r', encoding='utf-8') as file: report_out = file.read() - formatted_report = self.add_formatting(report_out) - - # Write back the new formatted_report value - out_report_path = os.path.join(OUTPUT_DIR, 'dns_report_with_dns.html') - with open(out_report_path, 'w', encoding='utf-8') as file: - file.write(formatted_report) # Read the local good report with open(LOCAL_REPORT, 'r', encoding='utf-8') as file: @@ -104,7 +95,6 @@ def dns_module_report_no_dns_test(self): dns_module = DNSModule(module='dns', log_dir=OUTPUT_DIR, - conf_file=CONF_FILE, results_dir=OUTPUT_DIR, dns_server_capture_file=dns_server_cap_file, startup_capture_file=startup_cap_file, @@ -115,12 +105,6 @@ def dns_module_report_no_dns_test(self): # Read the generated report with open(report_out_path, 'r', encoding='utf-8') as file: report_out = file.read() - formatted_report = self.add_formatting(report_out) - - # Write back the new formatted_report value - out_report_path = os.path.join(OUTPUT_DIR, 'dns_report_no_dns.html') - with open(out_report_path, 'w', encoding='utf-8') as file: - file.write(formatted_report) # Read the local good report with open(LOCAL_REPORT_NO_DNS, 'r', encoding='utf-8') as file: @@ -128,17 +112,6 @@ def dns_module_report_no_dns_test(self): self.assertEqual(report_out, report_local) - def add_formatting(self, body): - return f''' - - - {TestReport().generate_head()} - - {body} - - - - {TestReport().generate_head()} - - {body} - - NTP Module 101 104 + @@ -30,1438 +31,1438 @@

NTP Module

- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + + - - + - + - - + + - + + - - + - + - - + + - + - + - + + - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + - - + - + - - + + - + - + - + - + - + - - + + - + + - - + - + - - + + - + + - - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
10.10.10.1510.10.10.5216.239.35.12 Client 4Feb 15, 2024 22:12:29.447Feb 15, 2024 22:12:28.681
10.10.10.5216.239.35.12 10.10.10.15 Server 4Feb 15, 2024 22:12:29.448Feb 15, 2024 22:12:28.728
10.10.10.1510.10.10.5216.239.35.4 Client 4Feb 15, 2024 22:12:31.577Feb 15, 2024 22:12:28.842
10.10.10.5216.239.35.4 10.10.10.15 Server 4Feb 15, 2024 22:12:31.577Feb 15, 2024 22:12:28.888
10.10.10.1510.10.10.5216.239.35.8 Client 4Feb 15, 2024 22:12:33.694Feb 15, 2024 22:12:29.042
10.10.10.5216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:12:33.694Feb 15, 2024 22:12:29.089
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:12:35.785Feb 15, 2024 22:12:29.243
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:12:35.786Feb 15, 2024 22:12:29.290
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:37.806Feb 15, 2024 22:12:29.447
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:37.806Feb 15, 2024 22:12:29.448
10.10.10.1510.10.10.5216.239.35.12 Client 4Feb 15, 2024 22:12:39.856Feb 15, 2024 22:12:30.802
10.10.10.5216.239.35.12 10.10.10.15 Server 4Feb 15, 2024 22:12:39.856Feb 15, 2024 22:12:30.850
10.10.10.1510.10.10.5216.239.35.4 Client 4Feb 15, 2024 22:12:41.931Feb 15, 2024 22:12:30.973
10.10.10.5216.239.35.4 10.10.10.15 Server 4Feb 15, 2024 22:12:41.932Feb 15, 2024 22:12:31.032
10.10.10.1510.10.10.5216.239.35.8 Client 4Feb 15, 2024 22:12:43.954Feb 15, 2024 22:12:31.173
10.10.10.5216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:12:43.956Feb 15, 2024 22:12:31.220
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:13:06.439Feb 15, 2024 22:12:31.376
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:13:06.439Feb 15, 2024 22:12:31.423
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:13:08.492Feb 15, 2024 22:12:31.577
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:08.494Feb 15, 2024 22:12:31.577
10.10.10.1510.10.10.5216.239.35.12 Client 4Feb 15, 2024 22:13:40.536Feb 15, 2024 22:12:32.867
10.10.10.5216.239.35.12 10.10.10.15 Server 4Feb 15, 2024 22:13:40.541Feb 15, 2024 22:12:32.914
10.10.10.1510.10.10.5216.239.35.4 Client 4Feb 15, 2024 22:13:48.274Feb 15, 2024 22:12:33.112
10.10.10.5216.239.35.4 10.10.10.15 Server 4Feb 15, 2024 22:13:48.277Feb 15, 2024 22:12:33.159
10.10.10.1510.10.10.5216.239.35.8 Client 4Feb 15, 2024 22:14:12.619Feb 15, 2024 22:12:33.271
10.10.10.5216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:14:12.624Feb 15, 2024 22:12:33.318
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:14:44.702Feb 15, 2024 22:12:33.475
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:14:44.703Feb 15, 2024 22:12:33.522
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:14:53.026Feb 15, 2024 22:12:33.694
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:53.029Feb 15, 2024 22:12:33.694
10.10.10.1510.10.10.5216.239.35.12 Client 4Feb 15, 2024 22:15:16.786Feb 15, 2024 22:12:34.956
10.10.10.5216.239.35.12 10.10.10.15 Server 4Feb 15, 2024 22:15:16.791Feb 15, 2024 22:12:35.002
10.10.10.1510.10.10.5216.239.35.4 Client 4Feb 15, 2024 22:15:48.884Feb 15, 2024 22:12:35.182
10.10.10.5216.239.35.4 10.10.10.15 Server 4Feb 15, 2024 22:15:48.887Feb 15, 2024 22:12:35.228
10.10.10.1510.10.10.5216.239.35.8 Client 4Feb 15, 2024 22:15:57.829Feb 15, 2024 22:12:35.398
10.10.10.5216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:15:57.829Feb 15, 2024 22:12:35.445
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:16:20.970Feb 15, 2024 22:12:35.625
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:16:20.970Feb 15, 2024 22:12:35.673
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:16:54.054Feb 15, 2024 22:12:35.785
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:54.054Feb 15, 2024 22:12:35.786
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:17:02.738Feb 15, 2024 22:12:37.806
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:17:02.740Feb 15, 2024 22:12:37.806
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:17:26.136Feb 15, 2024 22:12:39.856
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:17:26.139Feb 15, 2024 22:12:39.856
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:17:59.293Feb 15, 2024 22:12:41.931
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:17:59.293Feb 15, 2024 22:12:41.932
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:18:07.242Feb 15, 2024 22:12:43.954
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:18:07.242Feb 15, 2024 22:12:43.956
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:18:32.379Feb 15, 2024 22:13:06.439
10.10.10.5 10.10.10.15Server216.239.35.0Client 4Feb 15, 2024 22:18:32.379Feb 15, 2024 22:13:06.439
10.10.10.15 10.10.10.5Client10.10.10.15Server 4Feb 15, 2024 22:20:06.908Feb 15, 2024 22:13:06.439
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:20:06.908Feb 15, 2024 22:13:06.489
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:20:08.936Feb 15, 2024 22:13:08.492
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:20:08.937Feb 15, 2024 22:13:08.494
216.239.35.0 10.10.10.1510.10.10.5ClientServer 4Feb 15, 2024 22:20:10.974Feb 15, 2024 22:13:08.543
10.10.10.5 10.10.10.15Server216.239.35.12Client 4Feb 15, 2024 22:20:10.974Feb 15, 2024 22:13:40.310
216.239.35.12 10.10.10.1510.10.10.5ClientServer 4Feb 15, 2024 22:20:12.998Feb 15, 2024 22:13:40.357
10.10.10.5 10.10.10.15Server216.239.35.4Client 4Feb 15, 2024 22:20:12.999Feb 15, 2024 22:13:40.512
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:20:59.581Feb 15, 2024 22:13:40.536
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:20:59.582Feb 15, 2024 22:13:40.542
216.239.35.4 10.10.10.1510.10.10.5ClientServer 4Feb 15, 2024 22:21:34.063Feb 15, 2024 22:13:40.574
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:21:34.063Feb 15, 2024 22:13:40.583
10.10.10.1510.10.10.5216.239.35.8 Client 4Feb 15, 2024 22:21:36.121Feb 15, 2024 22:13:40.714
10.10.10.5216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:21:36.121Feb 15, 2024 22:13:40.764
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:21:38.176Feb 15, 2024 22:13:40.917
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:21:38.176Feb 15, 2024 22:13:40.965
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:21:40.277Feb 15, 2024 22:13:48.274
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:21:40.277Feb 15, 2024 22:13:48.277
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:22:05.704Feb 15, 2024 22:14:12.619
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:22:05.706
10.10.10.1510.10.10.5Client4Feb 15, 2024 22:22:45.469Feb 15, 2024 22:14:12.624
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:22:45.470Feb 15, 2024 22:14:12.668
10.10.10.1510.10.10.5216.239.35.12 Client 4Feb 15, 2024 22:23:09.826Feb 15, 2024 22:14:44.515
10.10.10.5216.239.35.12 10.10.10.15 Server 4Feb 15, 2024 22:23:09.828Feb 15, 2024 22:14:44.562
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:23:50.337Feb 15, 2024 22:14:44.702
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:23:50.343Feb 15, 2024 22:14:44.704
10.10.10.1510.10.10.5216.239.35.4 Client 4Feb 15, 2024 22:24:13.945Feb 15, 2024 22:14:45.158
10.10.10.5216.239.35.4 10.10.10.15 Server 4Feb 15, 2024 22:24:13.946Feb 15, 2024 22:14:45.219
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:24:54.876Feb 15, 2024 22:14:45.359
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:24:54.877Feb 15, 2024 22:14:45.406
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:25:59.000Feb 15, 2024 22:14:45.707
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:25:59.001Feb 15, 2024 22:14:45.755
10.10.10.15216.239.35.12216.239.35.8 Client 4Feb 15, 2024 22:12:28.681Feb 15, 2024 22:14:45.980
216.239.35.12216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:12:28.728Feb 15, 2024 22:14:46.027
10.10.10.15216.239.35.410.10.10.5 Client 4Feb 15, 2024 22:12:28.842Feb 15, 2024 22:14:53.026
216.239.35.410.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:28.888Feb 15, 2024 22:14:53.029
10.10.10.15216.239.35.810.10.10.5 Client 4Feb 15, 2024 22:12:29.042Feb 15, 2024 22:15:16.786
216.239.35.810.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:29.089Feb 15, 2024 22:15:16.791
10.10.10.15 216.239.35.0 Client 4Feb 15, 2024 22:12:29.243Feb 15, 2024 22:15:18.794
216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:12:29.290Feb 15, 2024 22:15:18.843
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:29.447Feb 15, 2024 22:15:48.884
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:29.448Feb 15, 2024 22:15:48.887
10.10.10.15 216.239.35.12 Client 4Feb 15, 2024 22:12:30.802Feb 15, 2024 22:15:49.063
216.239.35.12 10.10.10.15 Server 4Feb 15, 2024 22:12:30.850Feb 15, 2024 22:15:49.110
10.10.10.15 216.239.35.4 Client 4Feb 15, 2024 22:12:30.973Feb 15, 2024 22:15:49.462
216.239.35.4 10.10.10.15 Server 4Feb 15, 2024 22:12:31.032Feb 15, 2024 22:15:49.509
10.10.10.15216.239.35.8216.239.35.0 Client 4Feb 15, 2024 22:12:31.173Feb 15, 2024 22:15:50.127
216.239.35.8216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:12:31.220Feb 15, 2024 22:15:50.175
10.10.10.15216.239.35.0216.239.35.8 Client 4Feb 15, 2024 22:12:31.376Feb 15, 2024 22:15:51.107
216.239.35.0216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:12:31.423Feb 15, 2024 22:15:51.154
10.10.10.1510.10.10.5216.239.35.0 Client 4Feb 15, 2024 22:12:31.577Feb 15, 2024 22:15:51.890
10.10.10.5216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:12:31.577Feb 15, 2024 22:15:51.938
10.10.10.15216.239.35.1210.10.10.5 Client 4Feb 15, 2024 22:12:32.867Feb 15, 2024 22:15:57.829
216.239.35.1210.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:32.914Feb 15, 2024 22:15:57.829
10.10.10.15216.239.35.410.10.10.5 Client 4Feb 15, 2024 22:12:33.112Feb 15, 2024 22:16:20.970
216.239.35.410.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:33.159Feb 15, 2024 22:16:20.971
10.10.10.15216.239.35.8216.239.35.0 Client 4Feb 15, 2024 22:12:33.271Feb 15, 2024 22:16:24.975
216.239.35.8216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:12:33.318Feb 15, 2024 22:16:25.023
10.10.10.15216.239.35.0216.239.35.4 Client 4Feb 15, 2024 22:12:33.475Feb 15, 2024 22:16:53.677
216.239.35.0216.239.35.4 10.10.10.15 Server 4Feb 15, 2024 22:12:33.522Feb 15, 2024 22:16:53.739
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:33.694Feb 15, 2024 22:16:54.054
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:33.694Feb 15, 2024 22:16:54.054
10.10.10.15 216.239.35.12 Client 4Feb 15, 2024 22:12:34.956Feb 15, 2024 22:16:54.276
216.239.35.12 10.10.10.15 Server 4Feb 15, 2024 22:12:35.002Feb 15, 2024 22:16:54.322
10.10.10.15216.239.35.4216.239.35.0 Client 4Feb 15, 2024 22:12:35.182Feb 15, 2024 22:16:54.593
216.239.35.4216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:12:35.228Feb 15, 2024 22:16:54.648
10.10.10.15 216.239.35.8 Client 4Feb 15, 2024 22:12:35.398Feb 15, 2024 22:16:55.435
216.239.35.8 10.10.10.15 Server 4Feb 15, 2024 22:12:35.445Feb 15, 2024 22:16:55.481
10.10.10.15 216.239.35.0 Client 4Feb 15, 2024 22:12:35.625Feb 15, 2024 22:16:57.059
216.239.35.0 10.10.10.15 Server 4Feb 15, 2024 22:12:35.673Feb 15, 2024 22:16:57.107
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:35.785Feb 15, 2024 22:17:02.738
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:35.786Feb 15, 2024 22:17:02.740
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:37.806Feb 15, 2024 22:17:26.136
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:37.806Feb 15, 2024 22:17:26.139
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:39.856Feb 15, 2024 22:12:29.447
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:39.856Feb 15, 2024 22:12:29.448
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:41.931Feb 15, 2024 22:12:31.577
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:41.932Feb 15, 2024 22:12:31.577
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:12:43.954Feb 15, 2024 22:12:33.694
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:12:43.956Feb 15, 2024 22:12:33.694
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:13:06.439Feb 15, 2024 22:12:35.785
10.10.10.5 10.10.10.15216.239.35.0ClientServer 4Feb 15, 2024 22:13:06.439Feb 15, 2024 22:12:35.786
10.10.10.5 10.10.10.15Server10.10.10.5Client 4Feb 15, 2024 22:13:06.439Feb 15, 2024 22:12:37.806
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:06.489Feb 15, 2024 22:12:37.806
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:13:08.492Feb 15, 2024 22:12:39.856
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:08.494Feb 15, 2024 22:12:39.856
216.239.35.0 10.10.10.15Server10.10.10.5Client 4Feb 15, 2024 22:13:08.543Feb 15, 2024 22:12:41.931
10.10.10.5 10.10.10.15216.239.35.12ClientServer 4Feb 15, 2024 22:13:40.310Feb 15, 2024 22:12:41.932
216.239.35.12 10.10.10.15Server10.10.10.5Client 4Feb 15, 2024 22:13:40.357Feb 15, 2024 22:12:43.954
10.10.10.5 10.10.10.15216.239.35.4ClientServer 4Feb 15, 2024 22:13:40.512Feb 15, 2024 22:12:43.956
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:13:40.536Feb 15, 2024 22:13:06.439
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:40.542Feb 15, 2024 22:13:06.439
216.239.35.4 10.10.10.15Server10.10.10.5Client 4Feb 15, 2024 22:13:40.574Feb 15, 2024 22:13:08.492
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:40.583Feb 15, 2024 22:13:08.494
10.10.10.15216.239.35.810.10.10.5 Client 4Feb 15, 2024 22:13:40.714Feb 15, 2024 22:13:40.536
216.239.35.810.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:40.764Feb 15, 2024 22:13:40.541
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:13:40.917Feb 15, 2024 22:13:48.274
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:40.965Feb 15, 2024 22:13:48.277
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:13:48.274Feb 15, 2024 22:14:12.619
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:13:48.277Feb 15, 2024 22:14:12.624
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:14:12.619Feb 15, 2024 22:14:44.702
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:12.624Feb 15, 2024 22:14:44.703
216.239.35.010.10.10.1510.10.10.5Client4Feb 15, 2024 22:14:53.026
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:12.668Feb 15, 2024 22:14:53.029
10.10.10.15216.239.35.1210.10.10.5 Client 4Feb 15, 2024 22:14:44.515Feb 15, 2024 22:15:16.786
216.239.35.1210.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:44.562Feb 15, 2024 22:15:16.791
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:14:44.702Feb 15, 2024 22:15:48.884
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:44.704Feb 15, 2024 22:15:48.887
10.10.10.15216.239.35.410.10.10.5 Client 4Feb 15, 2024 22:14:45.158Feb 15, 2024 22:15:57.829
216.239.35.410.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:45.219Feb 15, 2024 22:15:57.829
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:14:45.359Feb 15, 2024 22:16:20.970
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:45.406Feb 15, 2024 22:16:20.970
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:14:45.707Feb 15, 2024 22:16:54.054
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:45.755Feb 15, 2024 22:16:54.054
10.10.10.15216.239.35.810.10.10.5 Client 4Feb 15, 2024 22:14:45.980Feb 15, 2024 22:17:02.738
216.239.35.810.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:46.027Feb 15, 2024 22:17:02.740
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:14:53.026Feb 15, 2024 22:17:26.136
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:14:53.029Feb 15, 2024 22:17:26.139
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:15:16.786Feb 15, 2024 22:17:59.293
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:16.791Feb 15, 2024 22:17:59.293
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:15:18.794Feb 15, 2024 22:18:07.242
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:18.843Feb 15, 2024 22:18:07.242
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:15:48.884Feb 15, 2024 22:18:32.379
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:48.887Feb 15, 2024 22:18:32.379
10.10.10.15216.239.35.1210.10.10.5 Client 4Feb 15, 2024 22:15:49.063Feb 15, 2024 22:20:06.908
216.239.35.1210.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:49.110Feb 15, 2024 22:20:06.908
10.10.10.15216.239.35.410.10.10.5 Client 4Feb 15, 2024 22:15:49.462Feb 15, 2024 22:20:08.936
216.239.35.410.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:49.509Feb 15, 2024 22:20:08.937
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:15:50.127Feb 15, 2024 22:20:10.974
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:50.175Feb 15, 2024 22:20:10.974
10.10.10.15216.239.35.810.10.10.5 Client 4Feb 15, 2024 22:15:51.107Feb 15, 2024 22:20:12.998
216.239.35.810.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:51.154Feb 15, 2024 22:20:12.999
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:15:51.890Feb 15, 2024 22:20:59.581
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:51.938Feb 15, 2024 22:20:59.582
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:15:57.829Feb 15, 2024 22:21:34.063
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:15:57.829Feb 15, 2024 22:21:34.063
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:16:20.970Feb 15, 2024 22:21:36.121
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:20.971Feb 15, 2024 22:21:36.121
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:16:24.975Feb 15, 2024 22:21:38.176
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:25.023Feb 15, 2024 22:21:38.176
10.10.10.15216.239.35.410.10.10.5 Client 4Feb 15, 2024 22:16:53.677Feb 15, 2024 22:21:40.277
216.239.35.410.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:53.739Feb 15, 2024 22:21:40.277
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:16:54.054Feb 15, 2024 22:22:05.704
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:54.054Feb 15, 2024 22:22:05.706
10.10.10.15216.239.35.1210.10.10.5 Client 4Feb 15, 2024 22:16:54.276Feb 15, 2024 22:22:45.469
216.239.35.1210.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:54.322Feb 15, 2024 22:22:45.470
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:16:54.593Feb 15, 2024 22:23:09.826
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:54.648Feb 15, 2024 22:23:09.828
10.10.10.15216.239.35.810.10.10.5 Client 4Feb 15, 2024 22:16:55.435Feb 15, 2024 22:23:50.337
216.239.35.810.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:55.481Feb 15, 2024 22:23:50.343
10.10.10.15216.239.35.010.10.10.5 Client 4Feb 15, 2024 22:16:57.059Feb 15, 2024 22:24:13.945
216.239.35.010.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:16:57.107Feb 15, 2024 22:24:13.946
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:17:02.738Feb 15, 2024 22:24:54.876
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:17:02.740Feb 15, 2024 22:24:54.877
10.10.10.15 10.10.10.5 Client 4Feb 15, 2024 22:17:26.136Feb 15, 2024 22:25:59.000
10.10.10.5 10.10.10.15 Server 4Feb 15, 2024 22:17:26.139Feb 15, 2024 22:25:59.001
diff --git a/testing/unit/ntp/reports/ntp_report_local_no_ntp.html b/testing/unit/ntp/reports/ntp_report_local_no_ntp.html index 7df0fbd87..7fe2e6ab5 100644 --- a/testing/unit/ntp/reports/ntp_report_local_no_ntp.html +++ b/testing/unit/ntp/reports/ntp_report_local_no_ntp.html @@ -15,6 +15,7 @@

NTP Module

0 0 +
diff --git a/testing/unit/protocol/protocol_module_test.py b/testing/unit/protocol/protocol_module_test.py index 32a0021cd..6ba3143c0 100644 --- a/testing/unit/protocol/protocol_module_test.py +++ b/testing/unit/protocol/protocol_module_test.py @@ -46,7 +46,6 @@ def setUpClass(cls): BACNET = BACnet(log=LOGGER, captures_dir=CAPTURES_DIR, capture_file='bacnet.pcap', - bin_dir='modules/test/protocol/bin', device_hw_addr=HW_ADDR) # Test the BACNet traffic for a matching Object ID and HW address diff --git a/testing/unit/report/report_test.py b/testing/unit/report/report_test.py index f92666b2c..c67d81b1e 100644 --- a/testing/unit/report/report_test.py +++ b/testing/unit/report/report_test.py @@ -16,6 +16,7 @@ from testreport import TestReport import os import json +import shutil MODULE = 'report' @@ -30,6 +31,10 @@ class ReportTest(unittest.TestCase): @classmethod def setUpClass(cls): + # Delete old files + if os.path.exists(OUTPUT_DIR) and os.path.isdir(OUTPUT_DIR): + shutil.rmtree(OUTPUT_DIR) + # Create the output directories and ignore errors if it already exists os.makedirs(OUTPUT_DIR, exist_ok=True) @@ -59,6 +64,47 @@ def report_compliant_test(self): def report_noncompliant_test(self): self.create_report(os.path.join(TEST_FILES_DIR, 'report_noncompliant.json')) + # Generate formatted reports for each report generated from + # the test containers. + # Not a unit test but can't run from within the test module container and must + # be done through the venv. Useful for doing visual inspections + # of report formatting changes without having to re-run a new device test. + def report_formatting(self): + test_modules = ['conn','dns','ntp','protocol','services','tls'] + unit_tests = os.listdir(UNIT_TEST_DIR) + for test in unit_tests: + if test in test_modules: + output_dir = os.path.join(UNIT_TEST_DIR,test,'output') + if os.path.isdir(output_dir): + output_files = os.listdir(output_dir) + for file in output_files: + if file.endswith('.html'): + + # Read the generated report and add formatting + report_out_path = os.path.join(output_dir,file) + with open(report_out_path, 'r', encoding='utf-8') as f: + report_out = f.read() + formatted_report = self.add_formatting(report_out) + + # Write back the new formatted_report value + out_report_dir = os.path.join(OUTPUT_DIR, test) + os.makedirs(out_report_dir, exist_ok=True) + + with open(os.path.join( + out_report_dir,file), 'w', + encoding='utf-8') as f: + f.write(formatted_report) + + def add_formatting(self, body): + return f''' + + + {TestReport().generate_head()} + + {body} + + /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/conn/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/tls/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/dns/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/services/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/ntp/python/src" -PYTHONPATH="$PYTHONPATH:$PWD/modules/test/protocol/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 Conn Module Unit Tests -python3 -u $PWD/testing/unit/conn/conn_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/services/services_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 RiskProfile Unit Tests -python3 -u $PWD/testing/unit/risk_profile/risk_profile_test.py - -# Run the RiskProfile Unit Tests -python3 -u $PWD/testing/unit/protocol/protocol_module_test.py - -popd >/dev/null 2>&1 diff --git a/testing/unit/services/services_module_test.py b/testing/unit/services/services_module_test.py index 30c4928bf..a8c60262b 100644 --- a/testing/unit/services/services_module_test.py +++ b/testing/unit/services/services_module_test.py @@ -16,7 +16,7 @@ import unittest import os import shutil -from testreport import TestReport +# from testreport import TestReport MODULE = 'services' @@ -29,8 +29,6 @@ LOCAL_REPORT = os.path.join(REPORTS_DIR, 'services_report_local.html') LOCAL_REPORT_ALL_CLOSED = os.path.join(REPORTS_DIR, 'services_report_all_closed_local.html') -CONF_FILE = 'modules/test/' + MODULE + '/conf/module_config.json' - class ServicesTest(unittest.TestCase): """Contains and runs all the unit tests concerning DNS behaviors""" @@ -51,7 +49,6 @@ def services_module_ports_open_report_test(self): services_module = ServicesModule(module=MODULE, log_dir=OUTPUT_DIR, - conf_file=CONF_FILE, results_dir=OUTPUT_DIR, run=False, nmap_scan_results_path=OUTPUT_DIR) @@ -61,13 +58,6 @@ def services_module_ports_open_report_test(self): # Read the generated report with open(report_out_path, 'r', encoding='utf-8') as file: report_out = file.read() - formatted_report = self.add_formatting(report_out) - - # Write back the new formatted_report value - out_report_path = os.path.join( - OUTPUT_DIR, 'services_report_ports_open.html') - with open(out_report_path, 'w', encoding='utf-8') as file: - file.write(formatted_report) # Read the local good report with open(LOCAL_REPORT, 'r', encoding='utf-8') as file: @@ -85,7 +75,6 @@ def services_module_report_all_closed_test(self): services_module = ServicesModule(module=MODULE, log_dir=OUTPUT_DIR, - conf_file=CONF_FILE, results_dir=OUTPUT_DIR, run=False, nmap_scan_results_path=OUTPUT_DIR) @@ -95,13 +84,6 @@ def services_module_report_all_closed_test(self): # Read the generated report with open(report_out_path, 'r', encoding='utf-8') as file: report_out = file.read() - formatted_report = self.add_formatting(report_out) - - # Write back the new formatted_report value - out_report_path = os.path.join( - OUTPUT_DIR, 'services_report_all_closed.html') - with open(out_report_path, 'w', encoding='utf-8') as file: - file.write(formatted_report) # Read the local good report with open(LOCAL_REPORT_ALL_CLOSED, 'r', encoding='utf-8') as file: @@ -109,17 +91,6 @@ def services_module_report_all_closed_test(self): self.assertEqual(report_out, report_local) - def add_formatting(self, body): - return f''' - - - {TestReport().generate_head()} - - {body} - -