Skip to content

Commit 74da518

Browse files
authored
Add extra fields to Nessus STIG compliance mapper (#102)
* Fixes #101 * Adds ruleid, CCI, and stigid to Nessus mapper * Nessus-related sample updates with new fields
1 parent 9aed494 commit 74da518

6 files changed

+14
-8
lines changed

.rubocop_todo.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2021-05-18 15:11:52 UTC using RuboCop version 1.14.0.
3+
# on 2021-06-07 14:26:06 UTC using RuboCop version 1.16.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -19,12 +19,11 @@ Lint/DuplicateBranch:
1919
Exclude:
2020
- 'lib/heimdall_tools/dbprotect_mapper.rb'
2121

22-
# Offense count: 2
22+
# Offense count: 1
2323
# Configuration parameters: MaximumRangeSize.
2424
Lint/MissingCopEnableDirective:
2525
Exclude:
2626
- 'lib/heimdall_tools/nessus_mapper.rb'
27-
- 'lib/heimdall_tools/zap_mapper.rb'
2827

2928
# Offense count: 1
3029
Lint/RequireParentheses:
@@ -38,7 +37,7 @@ Lint/UnusedMethodArgument:
3837
Exclude:
3938
- 'lib/heimdall_tools/hdf.rb'
4039

41-
# Offense count: 32
40+
# Offense count: 34
4241
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
4342
Metrics/AbcSize:
4443
Max: 73
@@ -47,7 +46,7 @@ Metrics/AbcSize:
4746
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
4847
# IgnoredMethods: refine
4948
Metrics/BlockLength:
50-
Max: 49
49+
Max: 52
5150

5251
# Offense count: 2
5352
# Configuration parameters: CountBlocks.
@@ -57,7 +56,7 @@ Metrics/BlockNesting:
5756
# Offense count: 8
5857
# Configuration parameters: CountComments, CountAsOne.
5958
Metrics/ClassLength:
60-
Max: 171
59+
Max: 175
6160

6261
# Offense count: 10
6362
# Configuration parameters: IgnoredMethods.
@@ -67,7 +66,7 @@ Metrics/CyclomaticComplexity:
6766
# Offense count: 38
6867
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
6968
Metrics/MethodLength:
70-
Max: 52
69+
Max: 56
7170

7271
# Offense count: 1
7372
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.

lib/heimdall_tools/nessus_mapper.rb

+4
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,12 @@ def to_hdf
221221
end
222222
if item['compliance-reference']
223223
@item['tags']['nist'] = cci_nist_tag(parse_refs(item['compliance-reference'], 'CCI'))
224+
@item['tags']['cci'] = parse_refs(item['compliance-reference'], 'CCI')
225+
@item['tags']['rid'] = parse_refs(item['compliance-reference'], 'Rule-ID').join(',')
226+
@item['tags']['stig_id'] = parse_refs(item['compliance-reference'], 'STIG-ID').join(',')
224227
else
225228
@item['tags']['nist'] = plugin_nist_tag(item['pluginFamily'], item['pluginID'])
229+
@item['tags']['rid'] = item['pluginID'].to_s
226230
end
227231
if item['compliance-solution']
228232
@item['descriptions'] << desc_tags(item['compliance-solution'], 'check')

sample_jsons/nessus_mapper/nessus_sample_hdf.json

+1-1
Large diffs are not rendered by default.

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

+1
Large diffs are not rendered by default.

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

+1
Large diffs are not rendered by default.

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

+1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)