Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<camunda.spring.boot.starter.version>3.2.0</camunda.spring.boot.starter.version>
<!-- END IMPORTANT -->

<spring-boot.version>2.1.4.RELEASE</spring-boot.version>
<spring-boot.version>2.1.5.RELEASE</spring-boot.version>
<swagger-version>2.9.0</swagger-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
});
</script>
Expand Down Expand Up @@ -79,18 +91,25 @@ <h2>
</p>
</div>

<div class="well well-sm" style="color: inherit;" ng-repeat="(address, host) in groupedResults">
<strong>Results for Host: {{ address }}</strong>
<table class="table table-striped">
<div class="well well-sm" style="color: inherit;" ng-repeat="(ip, host) in groupedResults">
<strong>
Results for Host:
<span>{{ ip }}</span>
<span ng-if="host.hostname">({{host.hostname}})</span>
</strong>
<span class="table table-striped" ng-if="host.ports.length === 0">
No ports identified for this host.
</span>
<table class="table table-striped" ng-if="host.ports.length > 0">
<tr>
<th>Host:</th>
<th>Port:</th>
<th>Name:</th>
<th>Protocol:</th>
<th>State:</th>
</tr>
<tr class="danger" ng-repeat="port in host">
<td>{{ address }} ({{ port.attributes.ip_address }})</td></td>
<tr class="danger" ng-repeat="port in host.ports">
<td>{{ port.attributes.ip_address }}</td></td>
<td>{{ (port.category === 'Open Port' || port.category === 'Http Header') ? port.attributes.port : '' }}</td>
<td>{{ (port.category === 'Open Port' && !port.name) ? port.attributes.service : port.name}}</td>
<td>{{ (port.category === 'Open Port' || port.category === 'Http Header') ? port.attributes.protocol : '' }}</td>
Expand Down