From 6f02eecf21b912fc356d6691a660a80f3d3d12ff Mon Sep 17 00:00:00 2001
From: Jannik Hollenbach
Date: Mon, 17 Jun 2019 11:43:34 +0200
Subject: [PATCH 1/3] Fix form to properly handle hosts without identified
ports
---
.../nmap/approve-port-scanner-results.html | 36 ++++++++++++-------
1 file changed, 23 insertions(+), 13 deletions(-)
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..d54df90c 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,28 @@
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');
+
+ for(const host of hosts){
+ $scope.groupedResults[host.attributes.hostname] = [];
+ }
+
+ $scope.groupedResults = openPorts.reduce(
+ function (carry, item) {
+ if (!carry.hasOwnProperty(item.attributes.hostname)) {
+ carry[item.attributes.hostname] = [];
+ }
+ carry[item.attributes.hostname].push(item);
+ return carry;
+ },
+ {}
);
});
@@ -79,9 +86,12 @@
-
+
Results for Host: {{ address }}
-
+
+ No ports identified for this host.
+
+
| Host: |
Port: |
@@ -89,7 +99,7 @@
| Protocol: |
State: |
-
+
| {{ 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}} |
From 31e175e86c1ef251aaff4870c013d76d6e500fb7 Mon Sep 17 00:00:00 2001
From: Jannik Hollenbach
Date: Mon, 17 Jun 2019 16:01:45 +0200
Subject: [PATCH 2/3] Use ip as host id instead of hostname
---
.../nmap/approve-port-scanner-results.html | 31 ++++++++++++-------
1 file changed, 20 insertions(+), 11 deletions(-)
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 d54df90c..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
@@ -39,19 +39,24 @@
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.hostname] = [];
+ $scope.groupedResults[host.attributes.ip_address] = { hostname: host.attributes.hostname, ports: [] };
}
$scope.groupedResults = openPorts.reduce(
function (carry, item) {
- if (!carry.hasOwnProperty(item.attributes.hostname)) {
- carry[item.attributes.hostname] = [];
+ 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);
}
- carry[item.attributes.hostname].push(item);
return carry;
},
- {}
+ $scope.groupedResults
);
});
@@ -86,12 +91,16 @@
-
-
Results for Host: {{ address }}
-
+
+
+ Results for Host:
+ {{ ip }}
+ ({{host.hostname}})
+
+
No ports identified for this host.
-
+
| Host: |
Port: |
@@ -99,8 +108,8 @@
| 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 : '' }} |
From bb894468b6375023c2ed78ec2f6721b19948e9ad Mon Sep 17 00:00:00 2001
From: Jannik Hollenbach
Date: Mon, 17 Jun 2019 16:16:40 +0200
Subject: [PATCH 3/3] Update spring boot version
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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