Skip to content

Commit 5da2c79

Browse files
authored
Merge pull request #110 from mitre/mapNessusWarningsAndErrors
2 parents 4d00608 + a710ae3 commit 5da2c79

10 files changed

+25
-11
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@ jobs:
7777
- name: Test nessus_mapper
7878
run: |
7979
heimdall_tools nessus_mapper -x ./sample_jsons/nessus_mapper/sample_input_report/nessus_sample.nessus -o nessus.json
80-
jq 'del(.version, .platform.release)' nessus.json-ip-10-10-23-102.json > nessus_jq.json
81-
jq 'del(.version, .platform.release)' ./sample_jsons/nessus_mapper/nessus_sample_hdf.json > nessus_sample_hdf.json
82-
diff nessus_sample_hdf.json nessus_jq.json
80+
jq 'del(.version, .platform.release)' nessus.json-ip-10-10-23-102.json > nessus-jq.json-ip-10-10-23-102.json
81+
jq 'del(.version, .platform.release)' ./sample_jsons/nessus_mapper/nessus.json-ip-10-10-23-102.json > nessus-sample-jq.json-ip-10-10-23-102.json
82+
diff nessus-sample-jq.json-ip-10-10-23-102.json nessus-jq.json-ip-10-10-23-102.json
83+
jq 'del(.version, .platform.release)' nessus.json-ip-10-10-24-231.json > nessus-jq.json-ip-10-10-24-231.json
84+
jq 'del(.version, .platform.release)' ./sample_jsons/nessus_mapper/nessus.json-ip-10-10-24-231.json > nessus-sample-jq.json-ip-10-10-24-231.json
85+
diff nessus-sample-jq.json-ip-10-10-24-231.json nessus-jq.json-ip-10-10-24-231.json
86+
jq 'del(.version, .platform.release)' nessus.json-ip-10-10-37-43.json > nessus-jq.json-ip-10-10-37-43.json
87+
jq 'del(.version, .platform.release)' ./sample_jsons/nessus_mapper/nessus.json-ip-10-10-37-43.json > nessus-sample-jq.json-ip-10-10-37-43.json
88+
diff nessus-sample-jq.json-ip-10-10-37-43.json nessus-jq.json-ip-10-10-37-43.json
8389
- name: Test scoutsuite mapper
8490
run: |
8591
heimdall_tools scoutsuite_mapper -i ./sample_jsons/scoutsuite_mapper/sample_input_jsons/scoutsuite_sample.js -o scoutsuite_output.json

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ AllCops:
1010
- 'test/**/*'
1111
- 'examples/plugins/train-*/test/**/*'
1212
- 'vendor/**/*'
13+
- 'sample_jsons/**/*'
1314
Style/Documentation:
1415
Enabled: false
1516
Layout/ParameterAlignment:
@@ -26,6 +27,8 @@ Style/NumericLiterals:
2627
MinDigits: 10
2728
Metrics/ModuleLength:
2829
Enabled: false
30+
Metrics/ClassLength:
31+
Enabled: false
2932
Style/PercentLiteralDelimiters:
3033
PreferredDelimiters:
3134
'%': '{}'

lib/heimdall_tools/nessus_mapper.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,17 @@ def format_desc(issue)
9292

9393
def finding(issue, timestamp)
9494
finding = {}
95-
# if compliance-result field, this is a policy compliance result entry
96-
# nessus policy compliance result provides a pass/fail data
97-
# For non policy compliance results are defaulted to failed
9895
if issue['compliance-result']
99-
finding['status'] = issue['compliance-result'].eql?('PASSED') ? 'passed' : 'failed'
96+
case issue['compliance-result']
97+
when 'PASSED'
98+
finding['status'] = 'passed'
99+
when 'ERROR'
100+
finding['status'] = 'error'
101+
when 'WARNING'
102+
finding['status'] = 'skipped'
103+
else
104+
finding['status'] = 'failed'
105+
end
100106
else
101107
finding['status'] = 'failed'
102108
end

sample_jsons/nessus_mapper/nessus.json-ip-10-10-23-102.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

sample_jsons/nessus_mapper/nessus.json-ip-10-10-24-231.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

sample_jsons/nessus_mapper/nessus.json-ip-10-10-37-43.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

sample_jsons/nessus_mapper/nessus_sample_hdf.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

sample_jsons/nessus_mapper/nessus_sample_hdf.json-ip-10-10-23-102.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

sample_jsons/nessus_mapper/nessus_sample_hdf.json-ip-10-10-24-231.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

sample_jsons/nessus_mapper/nessus_sample_hdf.json-ip-10-10-37-43.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)