openscap_parser 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openscap_parser/profile.rb +23 -1
- data/lib/openscap_parser/regex_handler.rb +9 -0
- data/lib/openscap_parser/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5c95f01a6f86db68b3d0561858c9d39af294872d3d0e6689f0bc6d37d39e660
|
4
|
+
data.tar.gz: c14ce4fb133683267862decac1f6db27e84f8f504026b135a04e642d849bad52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ed3d7a867fe0b5b230943068be977ce2d4aadc5edc0df79df5b4ce2e7c817420a3251569c70155a7f4c9626d5c0b2f51e35883770f0aeb848b23d3e345adab
|
7
|
+
data.tar.gz: b0d13aabf1dd555a7a376ea74a7092815c91e591f5cb40457ff06ac6f195e379246d31a7a1a0d5bd650c087bf654d26de6ef2cf6002d2a3163ca51626f863221
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'openscap_parser/regex_handler'
|
2
|
+
|
1
3
|
module OpenscapParser
|
2
4
|
class Profile < XmlNode
|
3
5
|
def id
|
@@ -20,7 +22,27 @@ module OpenscapParser
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def selected_rule_ids
|
23
|
-
|
25
|
+
# Look for selected rule ids where the idref contains '_rule_' that is not preceded by 'group'
|
26
|
+
@selected_rule_ids ||= @parsed_xml.xpath("select[@selected='true']
|
27
|
+
[regex(@idref, '^((?!_group_).)*?(_rule_).*$')]
|
28
|
+
/@idref", RegexHandler) &&
|
29
|
+
@parsed_xml.xpath("select[@selected='true']
|
30
|
+
[regex(@idref, '^((?!_group_).)*?(_rule_).*$')]
|
31
|
+
/@idref", RegexHandler).map(&:text)
|
32
|
+
end
|
33
|
+
|
34
|
+
def selected_group_ids
|
35
|
+
# Look for selected group ids where the idref contains '_group_' that is not preceded by 'rule'
|
36
|
+
@selected_group_ids ||= @parsed_xml.xpath("select[@selected='true']
|
37
|
+
[regex(@idref, '^((?!_rule_).)*?(_group_).*$')]
|
38
|
+
/@idref", RegexHandler) &&
|
39
|
+
@parsed_xml.xpath("select[@selected='true']
|
40
|
+
[regex(@idref, '^((?!_rule_).)*?(_group_).*$')]
|
41
|
+
/@idref", RegexHandler).map(&:text)
|
42
|
+
end
|
43
|
+
|
44
|
+
def selected_entity_ids
|
45
|
+
@selected_entity_ids ||= @parsed_xml.xpath("select[@selected='true']/@idref") &&
|
24
46
|
@parsed_xml.xpath("select[@selected='true']/@idref").map(&:text)
|
25
47
|
end
|
26
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openscap_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lobato Garcia
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-03-
|
12
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/openscap_parser/oval_report.rb
|
157
157
|
- lib/openscap_parser/profile.rb
|
158
158
|
- lib/openscap_parser/profiles.rb
|
159
|
+
- lib/openscap_parser/regex_handler.rb
|
159
160
|
- lib/openscap_parser/rule.rb
|
160
161
|
- lib/openscap_parser/rule_identifier.rb
|
161
162
|
- lib/openscap_parser/rule_reference.rb
|