@@ -37,7 +37,74 @@ def port
37
37
def severity
38
38
@severity ||= @event . at ( '@severity' ) . inner_text . to_i
39
39
end
40
+ # New matches for Baseline
40
41
42
+ def compliance_info
43
+ @event . xpath ( './/*[name()="cm:compliance-info"]' )
44
+ end
45
+ def item_id
46
+ @item_id ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /item_id: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /item_id: (.*)/ ) . nil?
47
+ end
48
+ def baseline
49
+ @baseline ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /baseline: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /baseline: (.*)/ ) . nil?
50
+ end
51
+ def item_description
52
+ @item_description ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /item_description: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /item_description: (.*)/ ) . nil?
53
+ end
54
+ def threats
55
+ @threats ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /threats: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /threats: (.*)/ ) . nil?
56
+ end
57
+ def impacts
58
+ @impacts ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /impacts: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /impacts: (.*)/ ) . nil?
59
+ end
60
+ def session
61
+ @session ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /session: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /session: (.*)/ ) . nil?
62
+ end
63
+ def manual_setup
64
+ @manual_setup ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /manual_setup: (.*\n )*/ ) . to_s . gsub ( "manual_setup: " , "" ) unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /manual_setup: (.*)/ ) . nil?
65
+ end
66
+ def threat_level
67
+ @threat_level ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /threat_level: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /threat_level: (.*)/ ) . nil?
68
+ end
69
+ def impact_level
70
+ @impact_level ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /impact_level: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /impact_level: (.*)/ ) . nil?
71
+ end
72
+ def check_type
73
+ @check_type ||= @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /expected_value: (.*)/ ) . captures . first unless @event . xpath ( './/*[name()="cm:compliance-info"]' ) . text . match ( /expected_value: (.*)/ ) . nil?
74
+ end
75
+ def compliance_uname
76
+ @compliance_uname ||= @event . xpath ( './/*[name()="cm:compliance-uname"]' ) . children . text
77
+ end
78
+
79
+ def compliance_check_name
80
+ @compliance_check_name ||= @event . xpath ( './/*[name()="cm:compliance-check-name"]' ) . children . text
81
+ end
82
+
83
+ def compliance_result
84
+ @compliance_result ||= @event . xpath ( './/*[name()="cm:compliance-result"]' ) . children . text
85
+ end
86
+
87
+ def remote_value
88
+ @remote_value ||= @event . xpath ( './/*[name()="cm:compliance-actual-value"]' ) . children . text
89
+ end
90
+
91
+ def policy_value
92
+ @policy_value ||= @event . xpath ( './/*[name()="cm:compliance-policy-value"]' ) . children . text
93
+ end
94
+
95
+ def check_name
96
+ @check_name ||= @event . xpath ( './/*[name()="cm:compliance-check-name"]' ) . children . text
97
+ end
98
+
99
+ def compliance_solution
100
+ @compliance_solution ||= @event . xpath ( './/*[name()="cm:compliance-solution"]' ) . children . text
101
+ end
102
+
103
+ def compliance_benchmark_name
104
+ @compliance_benchmark_name ||= @event . xpath ( './/*[name()="cm:compliance-benchmark-name"]' ) . children . text
105
+ end
106
+
107
+
41
108
#
42
109
# Return true if event is of informational severity.
43
110
#
@@ -130,7 +197,6 @@ def plugin_name
130
197
@plugin_name ||= @event . at ( '@pluginName' ) &.inner_text unless @event . at ( '@pluginName' ) . inner_text . empty?
131
198
end
132
199
alias name plugin_name
133
-
134
200
#
135
201
# Return the event object plugin type (plugin_type)
136
202
#
@@ -250,6 +316,9 @@ def cvss_base_score
250
316
@cvss_base_score ||= @event . at ( 'cvss_base_score' ) &.inner_text . to_f
251
317
end
252
318
319
+ def cvss3_base_score
320
+ @cvss3_base_score ||= @event . at ( 'cvss3_base_score' ) &.inner_text . to_f
321
+ end
253
322
#
254
323
# Return the event cvss temporal score.
255
324
#
@@ -260,6 +329,10 @@ def cvss_temporal_score
260
329
@cvss_temporal_score ||= @event . at ( 'cvss_temporal_score' ) &.inner_text . to_f
261
330
end
262
331
332
+ def cvss3_temporal_score
333
+ @cvss_temporal_score ||= @event . at ( 'cvss3_temporal_score' ) &.inner_text . to_f
334
+ end
335
+
263
336
#
264
337
# Return the event cve.
265
338
#
@@ -320,17 +393,29 @@ def cvss_vector
320
393
@cvss_vector ||= @event . at ( 'cvss_vector' ) &.inner_text
321
394
end
322
395
396
+ def cvss3_vector
397
+ @cvss3_vector ||= @event . at ( 'cvss3_vector' ) &.inner_text #.gsub("CVSS:3.0/","")
398
+ end
399
+
400
+ def cvss_temporal_vector
401
+ @cvss_temporal_vector ||= @event . at ( 'cvss_temporal_vector' ) &.inner_text
402
+ end
403
+
404
+ def cvss3_temporal_vector
405
+ @cvss3_temporal_vector ||= @event . at ( 'cvss3_temporal_vector' ) &.inner_text #.gsub("CVSS:3.0/","")
406
+ end
407
+
323
408
#
324
409
# Return the event cpe.
325
410
#
326
411
# @return [Array<String>]
327
412
# Return the event cpe.
328
- #
413
+ #
329
414
def cpe
330
415
unless @cpe
331
416
@cpe = [ ]
332
417
@event . xpath ( 'cpe' ) . each do |cpe |
333
- @cpe << cpe . inner_text
418
+ @cpe |= cpe . inner_text . split ( " \n " )
334
419
end
335
420
end
336
421
@cpe
0 commit comments