From 7d688ba34a082c7cccc3a137a73c952ebb24e99b Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Thu, 4 Apr 2024 12:34:14 -0600 Subject: [PATCH 1/2] Rename nmap module to services --- modules/test/{nmap => services}/README.md | 0 .../{nmap => services}/bin/start_test_module | 0 .../{nmap => services}/conf/module_config.json | 4 ++-- .../{nmap => services}/python/requirements.txt | 0 .../test/{nmap => services}/python/src/run.py | 16 ++++++++-------- .../python/src/services_module.py} | 14 +++++++------- .../services.Dockerfile} | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) rename modules/test/{nmap => services}/README.md (100%) rename modules/test/{nmap => services}/bin/start_test_module (100%) rename modules/test/{nmap => services}/conf/module_config.json (95%) rename modules/test/{nmap => services}/python/requirements.txt (100%) rename modules/test/{nmap => services}/python/src/run.py (82%) rename modules/test/{nmap/python/src/nmap_module.py => services/python/src/services_module.py} (95%) rename modules/test/{nmap/nmap.Dockerfile => services/services.Dockerfile} (91%) diff --git a/modules/test/nmap/README.md b/modules/test/services/README.md similarity index 100% rename from modules/test/nmap/README.md rename to modules/test/services/README.md diff --git a/modules/test/nmap/bin/start_test_module b/modules/test/services/bin/start_test_module similarity index 100% rename from modules/test/nmap/bin/start_test_module rename to modules/test/services/bin/start_test_module diff --git a/modules/test/nmap/conf/module_config.json b/modules/test/services/conf/module_config.json similarity index 95% rename from modules/test/nmap/conf/module_config.json rename to modules/test/services/conf/module_config.json index 1c1115afe..efd07d74b 100644 --- a/modules/test/nmap/conf/module_config.json +++ b/modules/test/services/conf/module_config.json @@ -1,8 +1,8 @@ { "config": { "meta": { - "name": "nmap", - "display_name": "nmap", + "name": "services", + "display_name": "Services", "description": "Scan for open ports using nmap" }, "network": true, diff --git a/modules/test/nmap/python/requirements.txt b/modules/test/services/python/requirements.txt similarity index 100% rename from modules/test/nmap/python/requirements.txt rename to modules/test/services/python/requirements.txt diff --git a/modules/test/nmap/python/src/run.py b/modules/test/services/python/src/run.py similarity index 82% rename from modules/test/nmap/python/src/run.py rename to modules/test/services/python/src/run.py index 2a85bb074..1d528ddf3 100644 --- a/modules/test/nmap/python/src/run.py +++ b/modules/test/services/python/src/run.py @@ -17,12 +17,12 @@ import signal import sys import logger -from nmap_module import NmapModule +from services_module import ServicesModule -LOG_NAME = 'nmap_runner' +LOG_NAME = 'services_runner' LOGGER = logger.get_logger(LOG_NAME) -class NmapModuleRunner: +class ServicesModuleRunner: """Run the NMAP module tests.""" def __init__(self, module): @@ -33,13 +33,13 @@ def __init__(self, module): signal.signal(signal.SIGQUIT, self._handler) self.add_logger(module) - LOGGER.info('Starting nmap module') + LOGGER.info('Starting services module') - self._test_module = NmapModule(module) + self._test_module = ServicesModule(module) self._test_module.run_tests() self._test_module.generate_module_report() - LOGGER.info('nmap test module finished') + LOGGER.info('services test module finished') def add_logger(self, module): global LOGGER @@ -56,7 +56,7 @@ def _handler(self, signum): def run(): parser = argparse.ArgumentParser( - description='Nmap Module Help', + description='Services Module Help', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( @@ -68,7 +68,7 @@ def run(): # For some reason passing in the args from bash adds an extra # space before the argument so we'll just strip out extra space - NmapModuleRunner(args.module.strip()) + ServicesModuleRunner(args.module.strip()) if __name__ == '__main__': diff --git a/modules/test/nmap/python/src/nmap_module.py b/modules/test/services/python/src/services_module.py similarity index 95% rename from modules/test/nmap/python/src/nmap_module.py rename to modules/test/services/python/src/services_module.py index 06613c023..bfa232c87 100644 --- a/modules/test/nmap/python/src/nmap_module.py +++ b/modules/test/services/python/src/services_module.py @@ -11,7 +11,7 @@ # 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. -"""NMAP test module""" +"""Services test module""" import time import util import json @@ -20,14 +20,14 @@ from test_module import TestModule import os -LOG_NAME = 'test_nmap' -MODULE_REPORT_FILE_NAME = 'nmap_report.html' -NMAP_SCAN_RESULTS_SCAN_FILE = 'nmap_scan_results.json' +LOG_NAME = 'test_services' +MODULE_REPORT_FILE_NAME = 'services_report.html' +NMAP_SCAN_RESULTS_SCAN_FILE = 'services_scan_results.json' LOGGER = None -class NmapModule(TestModule): - """NMAP Test module""" +class ServicesModule(TestModule): + """Services Test module""" def __init__(self, module, @@ -157,7 +157,7 @@ def generate_module_report(self): return report_path def _run_nmap(self): - LOGGER.info('Running nmap module') + LOGGER.info('Running nmap') # Run the monitor method asynchronously to keep this method non-blocking self._tcp_scan_thread = threading.Thread(target=self._scan_tcp_ports) diff --git a/modules/test/nmap/nmap.Dockerfile b/modules/test/services/services.Dockerfile similarity index 91% rename from modules/test/nmap/nmap.Dockerfile rename to modules/test/services/services.Dockerfile index ea90ee06f..3a89fc33c 100644 --- a/modules/test/nmap/nmap.Dockerfile +++ b/modules/test/services/services.Dockerfile @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Image name: test-run/nmap-test +# Image name: test-run/services-test FROM test-run/base-test:latest -ARG MODULE_NAME=nmap +ARG MODULE_NAME=services ARG MODULE_DIR=modules/test/$MODULE_NAME # Load the requirements file From 33ed43168f7831f779b779cf3ce901d348b49390 Mon Sep 17 00:00:00 2001 From: Volha Mardvilka Date: Mon, 8 Apr 2024 08:37:26 +0000 Subject: [PATCH 2/2] rename nmap module to services in ui service --- modules/ui/src/app/services/test-run.service.spec.ts | 2 +- modules/ui/src/app/services/test-run.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ui/src/app/services/test-run.service.spec.ts b/modules/ui/src/app/services/test-run.service.spec.ts index f6a6294cf..c1d2930d2 100644 --- a/modules/ui/src/app/services/test-run.service.spec.ts +++ b/modules/ui/src/app/services/test-run.service.spec.ts @@ -79,7 +79,7 @@ describe('TestRunService', () => { }, { displayName: 'Services', - name: 'nmap', + name: 'services', enabled: true, }, { diff --git a/modules/ui/src/app/services/test-run.service.ts b/modules/ui/src/app/services/test-run.service.ts index 0ee0a03e9..0fcb584fe 100644 --- a/modules/ui/src/app/services/test-run.service.ts +++ b/modules/ui/src/app/services/test-run.service.ts @@ -60,7 +60,7 @@ export class TestRunService { }, { displayName: 'Services', - name: 'nmap', + name: 'services', enabled: true, }, {