Skip to content

Commit

Permalink
Merge pull request #3677 from levihackerman-102/Issue#7022
Browse files Browse the repository at this point in the history
  • Loading branch information
kingthorin authored Apr 22, 2024
2 parents 2a1de50 + 694fce3 commit bd576c8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion addOns/automation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ All notable changes to this add-on will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added
- Allow reports to know the number of Sites tree nodes actively scanned (Issue 7022).

## [0.38.0] - 2024-04-11
### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ public class ActiveScanJobResultData extends JobResultData {

private Map<Integer, RuleData> ruleDataMap = new HashMap<>();
private Map<Integer, Alert> alertDataMap = new HashMap<>();
private int numberScannedNodes;

public ActiveScanJobResultData(String jobName, ActiveScan activeScan) {
super(jobName);

RuleData data;
for (HostProcess hp : activeScan.getHostProcesses()) {
numberScannedNodes += hp.getTestTotalCount();

for (Plugin plugin : hp.getCompleted()) {
data =
ruleDataMap.computeIfAbsent(
Expand All @@ -71,6 +74,10 @@ public ActiveScanJobResultData(String jobName, ActiveScan activeScan) {
}
}

public int getNumberScannedNodes() {
return numberScannedNodes;
}

public RuleData getRuleData(int ruleId) {
return ruleDataMap.get(ruleId);
}
Expand Down
4 changes: 3 additions & 1 deletion addOns/reports/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ All notable changes to this add-on will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Changed
- The following reports now include the number of Sites tree nodes actively scanned:
- Traditional HTML with Requests and Responses

## [0.31.0] - 2024-03-25
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ <h3 th:text="#{report.template.pass.list}">Passing Rules</h3>
</th:block>

<h2 th:text="#{report.sites.title}">Sites</h2>

<strong>Number of Sites tree nodes actively scanned:</strong>
<th:block
th:text="${reportData.reportObjects.get('activeScanData') != null ? reportData.reportObjects.get('activeScanData').numberScannedNodes : 0}">42</th:block>

<th:block th:each="site: ${reportData.sites}">
<h3 th:text="${site}">Site</h3>
<th:block th:if="${reportData.isIncludeSection('statistics')}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ <h3>Passing Rules</h3>


<h2>!reports.report.sites.title!</h2>


<strong>Number of Sites tree nodes actively scanned:</strong>0

<h3>http://example.com</h3>

<table class="summary">
Expand Down

0 comments on commit bd576c8

Please sign in to comment.