diff --git a/pom.xml b/pom.xml index cb8ef41b..5936da5c 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ 3.2.0 - 2.1.4.RELEASE + 2.1.5.RELEASE 2.9.0 UTF-8 diff --git a/scb-scanprocesses/nmap-process/src/main/resources/forms/nmap/approve-port-scanner-results.html b/scb-scanprocesses/nmap-process/src/main/resources/forms/nmap/approve-port-scanner-results.html index f02437e0..e5a0f4c5 100644 --- a/scb-scanprocesses/nmap-process/src/main/resources/forms/nmap/approve-port-scanner-results.html +++ b/scb-scanprocesses/nmap-process/src/main/resources/forms/nmap/approve-port-scanner-results.html @@ -30,21 +30,33 @@ camForm.on('variables-restored', function () { $scope.context = camForm.variableManager.variableValue('PROCESS_CONTEXT'); $scope.targets = JSON.parse(camForm.variableManager.variableValue('PROCESS_TARGETS')); - $scope.portScannerResult = JSON.parse(camForm.variableManager.variableValue('PROCESS_FINDINGS')); + const portScannerResult = JSON.parse(camForm.variableManager.variableValue('PROCESS_FINDINGS')); $scope.portScannerId = camForm.variableManager.variableValue('PROCESS_SCANNER_ID'); $scope.firstTarget = $scope.targets[0]; $scope.otherTargetsLength = $scope.targets.length - 1; - $scope.groupedResults = $scope.portScannerResult.reduce( - function (carry, item) { - if (!carry.hasOwnProperty(item.attributes.hostname)) { - carry[item.attributes.hostname] = []; - } - carry[item.attributes.hostname].push(item); - return carry; - }, - {} + const openPorts = portScannerResult.filter((finding) => finding.category === 'Open Port'); + const hosts = portScannerResult.filter((finding) => finding.category === 'Host'); + + $scope.groupedResults = {}; + + for(const host of hosts){ + $scope.groupedResults[host.attributes.ip_address] = { hostname: host.attributes.hostname, ports: [] }; + } + + $scope.groupedResults = openPorts.reduce( + function (carry, item) { + console.log(item); + if (!carry.hasOwnProperty(item.attributes.ip_address)) { + carry[item.attributes.ip_address] = { hostname: item.attributes.hostname, ports: [] }; + } + if(item.attributes.ip_address !== null){ + carry[item.attributes.ip_address].ports.push(item); + } + return carry; + }, + $scope.groupedResults ); }); @@ -79,9 +91,16 @@

-
- Results for Host: {{ address }} - +
+ + Results for Host: + {{ ip }} + ({{host.hostname}}) + + + No ports identified for this host. + +
@@ -89,8 +108,8 @@

- - + +
Host: Port:Protocol: State:
{{ address }} ({{ port.attributes.ip_address }})
{{ port.attributes.ip_address }} {{ (port.category === 'Open Port' || port.category === 'Http Header') ? port.attributes.port : '' }} {{ (port.category === 'Open Port' && !port.name) ? port.attributes.service : port.name}} {{ (port.category === 'Open Port' || port.category === 'Http Header') ? port.attributes.protocol : '' }}