metasploit-model 0.24.1-java → 0.25.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/metasploit/model/search/operation/{union.rb → group/base.rb} +2 -2
  3. data/app/models/metasploit/model/search/operation/group/intersection.rb +4 -0
  4. data/app/models/metasploit/model/search/operation/group/union.rb +4 -0
  5. data/app/models/metasploit/model/search/operator/deprecated/author.rb +2 -2
  6. data/app/models/metasploit/model/search/operator/deprecated/platform.rb +1 -1
  7. data/app/models/metasploit/model/search/operator/deprecated/ref.rb +1 -1
  8. data/app/models/metasploit/model/search/operator/deprecated/text.rb +2 -2
  9. data/app/models/metasploit/model/search/operator/group/base.rb +77 -0
  10. data/app/models/metasploit/model/search/operator/group/intersection.rb +5 -0
  11. data/app/models/metasploit/model/search/operator/group/union.rb +5 -0
  12. data/config/locales/en.yml +1 -1
  13. data/lib/metasploit/model/version.rb +1 -1
  14. data/metasploit-model.gemspec +2 -1
  15. data/spec/app/models/metasploit/model/search/operation/{union_spec.rb → group/base_spec.rb} +12 -12
  16. data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +5 -0
  17. data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +5 -0
  18. data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +1 -1
  19. data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +2 -2
  20. data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +1 -1
  21. data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +1 -1
  22. data/spec/app/models/metasploit/model/search/operator/{union_spec.rb → group/base_spec.rb} +2 -2
  23. data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +13 -0
  24. data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +13 -0
  25. data/spec/lib/metasploit/model/version_spec.rb +3 -3
  26. data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
  27. metadata +24 -12
  28. data/app/models/metasploit/model/search/operator/union.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b02a264fea95cb85cabad47899c3a07308079b3
4
- data.tar.gz: 54a8c9b6dd823df1104eccddd8de431f51085601
3
+ metadata.gz: 0c9ee83d35b13e904d19650a93caaa6890bb4b18
4
+ data.tar.gz: 7b22b1f3f095cff9199c03d106163da658a06158
5
5
  SHA512:
6
- metadata.gz: 2585a9450b854aeaeb06bf3c28a72f472b0cf39b65502377f637a1925168cd176ebe029611481307460b4738ce843bd2498a8541954e88aeb07e07febbf84314
7
- data.tar.gz: 09d48c197168678d9507a13ae9ecfa8837132cf031de14489eb25583e5ed2f35d9175682d75c2276586ca200bc158c125549a713e0f67d454bcbe6261596796a
6
+ metadata.gz: b999c1969b2a32bd793e0fb2ce3fe3f41930b1ebdd06337db45a05a0079d139bd160ff4baac33622e9f63af1ab6a4d23c3c545c56419f3c739560d413196a8c4
7
+ data.tar.gz: db14003b69c3c68e9e3d09806624a7403c35693ced9c49e04ac31256e4ff9ffa781ff8d4e6ab70f0765d10b6eb73a6492d52bacfc79b6519818dac47e99de0c9
@@ -1,6 +1,6 @@
1
- # A union of one or more {#children child operations} from an operator's `#operate_on`, should be visited the same as
1
+ # A group of one or more {#children child operations} from an operator's `#operate_on`, should be visited the same as
2
2
  # {Metasploit::Model::Search::Group::Base}.
3
- class Metasploit::Model::Search::Operation::Union < Metasploit::Model::Search::Operation::Base
3
+ class Metasploit::Model::Search::Operation::Group::Base < Metasploit::Model::Search::Operation::Base
4
4
  #
5
5
  # Attributes
6
6
  #
@@ -0,0 +1,4 @@
1
+ # An intersection of one or more {Metasploit::Model::Search::Operation::Group::Base#children child operations} from an
2
+ # operator's `#operate_on`, should be visited the same as {Metasploit::Model::Search::Group::Base}.
3
+ class Metasploit::Model::Search::Operation::Group::Intersection < Metasploit::Model::Search::Operation::Group::Base
4
+ end
@@ -0,0 +1,4 @@
1
+ # A union of one or more {Metasploit::Model::Search::Operation::Group::Base#children child operations} from an
2
+ # operator's `#operate_on`, should be visited the same as {Metasploit::Model::Search::Group::Base}.
3
+ class Metasploit::Model::Search::Operation::Group::Union < Metasploit::Model::Search::Operation::Group::Base
4
+ end
@@ -1,7 +1,7 @@
1
1
  # Operator that emulates the behavior of 'author' operator that could search `Mdm::Module::Detail` by making
2
- # {Metasploit::Model::Search::Operation::Union} between `authors.name`, `email_addresss.domain`, and
2
+ # {Metasploit::Model::Search::Operation::Group::Union} between `authors.name`, `email_addresss.domain`, and
3
3
  # `email_addresses.local`.
4
- class Metasploit::Model::Search::Operator::Deprecated::Author < Metasploit::Model::Search::Operator::Union
4
+ class Metasploit::Model::Search::Operator::Deprecated::Author < Metasploit::Model::Search::Operator::Group::Union
5
5
  # Turns author:<formatted_value> into Array of authors.name:<formatted_value>,
6
6
  # email_addresses.domain:<formatted_value>, and email_addresses.local:<formatted_value> operations. If there is an
7
7
  # '@' in `formatted_value`, then the portion of `formatted_value` before the '@' is used for `email_addresses.local`
@@ -1,6 +1,6 @@
1
1
  # Translates `<name>:<value>` to the union of `platforms.name:<value>` and `targets.name:<value>` in order to support
2
2
  # the `os` and `platform` operators.
3
- class Metasploit::Model::Search::Operator::Deprecated::Platform < Metasploit::Model::Search::Operator::Union
3
+ class Metasploit::Model::Search::Operator::Deprecated::Platform < Metasploit::Model::Search::Operator::Group::Union
4
4
  #
5
5
  # CONSTANTS
6
6
  #
@@ -1,6 +1,6 @@
1
1
  # Translates `ref:<value>` to union of `authorities.abbreviation:<value>`, `references.designation:<value>`, and
2
2
  # `references.designation:<value>`.
3
- class Metasploit::Model::Search::Operator::Deprecated::Ref < Metasploit::Model::Search::Operator::Union
3
+ class Metasploit::Model::Search::Operator::Deprecated::Ref < Metasploit::Model::Search::Operator::Group::Union
4
4
  # Array of `authorities.abbreviation:<formatted_value>`, `references.designation:<formatted_value>`, and
5
5
  # `references.url:<formatted_value>`. If `formatted_value` contains a '-' then the portion of `formatted_value`
6
6
  # before '-' is treated is passed to `authorities.abbreviation` and the portion of `formatted_value` after '-' is
@@ -1,11 +1,11 @@
1
1
  # Search the equivalent of the text fields from `Mdm::Module::Detail` and its associations, making a union of
2
2
  # `description`, `name`, `actions.name`, `architectures.abbreviation`, `platform`, and `ref`.
3
- class Metasploit::Model::Search::Operator::Deprecated::Text < Metasploit::Model::Search::Operator::Union
3
+ class Metasploit::Model::Search::Operator::Deprecated::Text < Metasploit::Model::Search::Operator::Group::Union
4
4
  #
5
5
  # CONSTANTS
6
6
  #
7
7
 
8
- # Names of operators that are unioned together for {Metasploit::Model::Search::Operator::Union#operate_on}.
8
+ # Names of operators that are unioned together for {Metasploit::Model::Search::Operator::Group::Union#operate_on}.
9
9
  OPERATOR_NAMES = [
10
10
  'description',
11
11
  'name',
@@ -0,0 +1,77 @@
1
+ # Operator that {#operate_on produces} {Metasploit::Model::Search::Operation::Group::Base group operations}.
2
+ class Metasploit::Model::Search::Operator::Group::Base < Metasploit::Model::Search::Operator::Delegation
3
+ #
4
+ # Class Attributes
5
+ #
6
+
7
+ # @!method self.operation_class_name()
8
+ # The name of the {operation_class}.
9
+ #
10
+ # @return [String]
11
+ #
12
+ # @!method self.operation_class_name=(operation_class_name)
13
+ # Set the name of the {operation_class}.
14
+ #
15
+ # @param operation_class_name [String]
16
+ # @return [void]
17
+ class_attribute :operation_class_name
18
+
19
+ #
20
+ # Class Methods
21
+ #
22
+
23
+ # {Metasploit::Model::Search::Operation::Group::Base Group operation class} to wrap {#children} in and return from
24
+ # {#operate_on}.
25
+ #
26
+ # @return [Class<Metasploit::Model::Search::Operation::Group::Base>]
27
+ def self.operation_class
28
+ @operation_class ||= operation_class_name.constantize
29
+ end
30
+
31
+ # Sets the {operation_class_name} to the operation with same name as this operator, but with 'Operation' substituted
32
+ # for 'Operator'.
33
+ #
34
+ # @return (see operation_class_name=)
35
+ def self.operation_class_name!
36
+ self.operation_class_name = name.gsub('Operator', 'Operation')
37
+ end
38
+
39
+ operation_class_name!
40
+
41
+ #
42
+ # Instance Methods
43
+ #
44
+
45
+ # {Metasploit::Model::Search::Operation::Group::Base#children}.
46
+ #
47
+ # @param formatted_value [String] value parsed from formatted operation
48
+ # @return [Array<Metasploit::Model::Search::Operation::Base>]
49
+ def children(formatted_value)
50
+ raise NotImplementedError
51
+ end
52
+
53
+ # (see operation_class)
54
+ def operation_class
55
+ self.class.operation_class
56
+ end
57
+
58
+ # Group's children operating on `formatted_value`.
59
+ #
60
+ # @param formatted_value [String] value parsed from formatted operation.
61
+ # @return [Metasploit::Model::Search::Operation::Group::Base] {#operation_class} instance will not contain {#children}
62
+ # that are invalid.
63
+ def operate_on(formatted_value)
64
+ children = self.children(formatted_value)
65
+
66
+ # filter children for validity as valid values for one child won't necessarily be valid values for another child.
67
+ # this is specifically a problem with Metasploit::Model::Search::Operation::Set as no partial matching is allowed,
68
+ # but can also be a problem with string vs integer operations.
69
+ valid_children = children.select(&:valid?)
70
+
71
+ operation_class.new(
72
+ :children => valid_children,
73
+ :operator => self,
74
+ :value => formatted_value
75
+ )
76
+ end
77
+ end
@@ -0,0 +1,5 @@
1
+ # Operator that {Metasploit::Model::Search::Operator::Group::Base#operate_on produces}
2
+ # {Metasploit::Model::Search::Operation::Group::Intersection intersection operations}.
3
+ class Metasploit::Model::Search::Operator::Group::Intersection < Metasploit::Model::Search::Operator::Group::Base
4
+ operation_class_name!
5
+ end
@@ -0,0 +1,5 @@
1
+ # Operator that {Metasploit::Model::Search::Operator::Group::Base#operate_on produces}
2
+ # {Metasploit::Model::Search::Operation::Group::Union union operations}.
3
+ class Metasploit::Model::Search::Operator::Group::Union < Metasploit::Model::Search::Operator::Group::Base
4
+ operation_class_name!
5
+ end
@@ -186,7 +186,7 @@ en:
186
186
  value:
187
187
  inclusion: "is not part of the set (%{set})"
188
188
 
189
- metasploit/model/search/operation/union:
189
+ metasploit/model/search/operation/group/base:
190
190
  attributes:
191
191
  children:
192
192
  too_short: "is too short (minimum is %{count} child)"
@@ -5,7 +5,7 @@ module Metasploit
5
5
  # The major version number.
6
6
  MAJOR = 0
7
7
  # The minor version number, scoped to the {MAJOR} version number.
8
- MINOR = 24
8
+ MINOR = 25
9
9
  # The patch number, scoped to the {MINOR} version number.
10
10
  PATCH = 1
11
11
 
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency 'rake'
21
21
 
22
22
  # documentation
23
- spec.add_development_dependency 'yard'
23
+ # 0.8.7.4 has a bug where attribute setters show up as undocumented
24
+ spec.add_development_dependency 'yard', '< 0.8.7.4'
24
25
 
25
26
  # Dependency loading
26
27
  spec.add_runtime_dependency 'activesupport'
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Metasploit::Model::Search::Operation::Union do
4
- subject(:union) do
3
+ describe Metasploit::Model::Search::Operation::Group::Base do
4
+ subject(:group) do
5
5
  described_class.new
6
6
  end
7
7
 
@@ -13,7 +13,7 @@ describe Metasploit::Model::Search::Operation::Union do
13
13
 
14
14
  context '#children_valid' do
15
15
  subject(:children_valid) do
16
- union.send(:children_valid)
16
+ group.send(:children_valid)
17
17
  end
18
18
 
19
19
  #
@@ -24,7 +24,7 @@ describe Metasploit::Model::Search::Operation::Union do
24
24
  I18n.translate!(:'errors.messages.invalid')
25
25
  end
26
26
 
27
- let(:union) do
27
+ let(:group) do
28
28
  described_class.new(
29
29
  children: children
30
30
  )
@@ -53,9 +53,9 @@ describe Metasploit::Model::Search::Operation::Union do
53
53
  end
54
54
 
55
55
  it 'does not add error on :children' do
56
- union.valid?
56
+ group.valid?
57
57
 
58
- union.errors[:children].should_not include(error)
58
+ group.errors[:children].should_not include(error)
59
59
  end
60
60
  end
61
61
 
@@ -72,9 +72,9 @@ describe Metasploit::Model::Search::Operation::Union do
72
72
  end
73
73
 
74
74
  it 'should add error on :children' do
75
- union.valid?
75
+ group.valid?
76
76
 
77
- union.errors[:children].should include(error)
77
+ group.errors[:children].should include(error)
78
78
  end
79
79
  end
80
80
  end
@@ -85,9 +85,9 @@ describe Metasploit::Model::Search::Operation::Union do
85
85
  end
86
86
 
87
87
  it 'does not add error on :children' do
88
- union.valid?
88
+ group.valid?
89
89
 
90
- union.errors[:children].should_not include(error)
90
+ group.errors[:children].should_not include(error)
91
91
  end
92
92
  end
93
93
  end
@@ -96,7 +96,7 @@ describe Metasploit::Model::Search::Operation::Union do
96
96
 
97
97
  context '#children' do
98
98
  subject(:children) do
99
- union.children
99
+ group.children
100
100
  end
101
101
 
102
102
  context 'default' do
@@ -110,7 +110,7 @@ describe Metasploit::Model::Search::Operation::Union do
110
110
  ]
111
111
  end
112
112
 
113
- let(:union) do
113
+ let(:group) do
114
114
  described_class.new(
115
115
  children: expected_children
116
116
  )
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operation::Group::Intersection do
4
+ it { should be_a Metasploit::Model::Search::Operation::Group::Base }
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operation::Group::Union do
4
+ it { should be_a Metasploit::Model::Search::Operation::Group::Base }
5
+ end
@@ -14,7 +14,7 @@ describe Metasploit::Model::Search::Operator::Deprecated::Author do
14
14
  it { should be_a Metasploit::Model::Search::Operator::Delegation }
15
15
 
16
16
  context '#children' do
17
- include_context 'Metasploit::Model::Search::Operator::Union#children'
17
+ include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
18
18
 
19
19
  let(:author_class) do
20
20
  Class.new
@@ -16,7 +16,7 @@ describe Metasploit::Model::Search::Operator::Deprecated::Platform do
16
16
  ['os', 'platform'].sample
17
17
  end
18
18
 
19
- it { should be_a Metasploit::Model::Search::Operator::Union }
19
+ it { should be_a Metasploit::Model::Search::Operator::Group::Union }
20
20
 
21
21
  context 'CONSTANTS' do
22
22
  context 'FORMATTED_OPERATORS' do
@@ -34,7 +34,7 @@ describe Metasploit::Model::Search::Operator::Deprecated::Platform do
34
34
  end
35
35
 
36
36
  context '#children' do
37
- include_context 'Metasploit::Model::Search::Operator::Union#children'
37
+ include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
38
38
 
39
39
  let(:formatted_value) do
40
40
  'platform_or_target'
@@ -12,7 +12,7 @@ describe Metasploit::Model::Search::Operator::Deprecated::Ref do
12
12
  end
13
13
 
14
14
  context '#children' do
15
- include_context 'Metasploit::Model::Search::Operator::Union#children'
15
+ include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
16
16
 
17
17
  let(:abbreviation_operator) do
18
18
  Metasploit::Model::Search::Operator::Attribute.new(
@@ -37,7 +37,7 @@ describe Metasploit::Model::Search::Operator::Deprecated::Text do
37
37
  end
38
38
 
39
39
  context '#children' do
40
- include_context 'Metasploit::Model::Search::Operator::Union#children'
40
+ include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
41
41
 
42
42
  let(:action_name_operator) do
43
43
  Metasploit::Model::Search::Operator::Attribute.new(
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Metasploit::Model::Search::Operator::Union do
3
+ describe Metasploit::Model::Search::Operator::Group::Base do
4
4
  subject(:operator) do
5
5
  described_class.new
6
6
  end
@@ -53,7 +53,7 @@ describe Metasploit::Model::Search::Operator::Union do
53
53
  operator.stub(:children => children)
54
54
  end
55
55
 
56
- it { should be_a Metasploit::Model::Search::Operation::Union }
56
+ it { should be_a Metasploit::Model::Search::Operation::Group::Base }
57
57
 
58
58
  context 'children' do
59
59
  subject(:operation_children) do
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operator::Group::Intersection do
4
+ it { should be_a Metasploit::Model::Search::Operator::Group::Base }
5
+
6
+ context 'operation_class_name' do
7
+ subject(:operation_class_name) {
8
+ described_class.operation_class_name
9
+ }
10
+
11
+ it { should == 'Metasploit::Model::Search::Operation::Group::Intersection' }
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operator::Group::Union do
4
+ it { should be_a Metasploit::Model::Search::Operator::Group::Base }
5
+
6
+ context 'operation_class_name' do
7
+ subject(:operation_class_name) {
8
+ described_class.operation_class_name
9
+ }
10
+
11
+ it { should == 'Metasploit::Model::Search::Operation::Group::Union' }
12
+ end
13
+ end
@@ -60,7 +60,7 @@ describe Metasploit::Model::Version do
60
60
  expect(prerelease).to eq(match[:prerelease])
61
61
  end
62
62
  else
63
- tag_regex = /\Av(?<major>\d+).(?<minor>\d+).(?<patch>\d+)(-(?<prerelease>.*))?\z/
63
+ tag_regex = /\Av(?<major>\d+).(?<minor>\d+).(?<patch>\d+)(\.pre\.(?<prerelease>.*))?\z/
64
64
  # travis-ci sets TRAVIS_BRANCH to the tag name for tag builds
65
65
  match = branch.match(tag_regex)
66
66
 
@@ -68,8 +68,8 @@ describe Metasploit::Model::Version do
68
68
  tag_prerelease = match[:prerelease]
69
69
 
70
70
  if tag_prerelease
71
- it 'matches the tag prerelease' do
72
- expect(prerelease).to eq(tag_prerelease)
71
+ it 'matches the tag prerelease converted from a gem version to a VERSION' do
72
+ expect(prerelease).to eq(tag_prerelease.gsub('.pre.', '-'))
73
73
  end
74
74
  else
75
75
  it 'does not have a PRERELEASE' do
@@ -1,4 +1,4 @@
1
- shared_context 'Metasploit::Model::Search::Operator::Union#children' do
1
+ shared_context 'Metasploit::Model::Search::Operator::Group::Union#children' do
2
2
  subject(:children) do
3
3
  operator.children(formatted_value)
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.1
4
+ version: 0.25.1
5
5
  platform: java
6
6
  authors:
7
7
  - Luke Imhoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-18 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: yard
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - <
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.8.7.4
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - '>='
50
+ - - <
51
51
  - !ruby/object:Gem::Version
52
- version: '0'
52
+ version: 0.8.7.4
53
53
  prerelease: false
54
54
  type: :development
55
55
  - !ruby/object:Gem::Dependency
@@ -107,13 +107,15 @@ files:
107
107
  - app/models/metasploit/model/search/operation/base.rb
108
108
  - app/models/metasploit/model/search/operation/boolean.rb
109
109
  - app/models/metasploit/model/search/operation/date.rb
110
+ - app/models/metasploit/model/search/operation/group/base.rb
111
+ - app/models/metasploit/model/search/operation/group/intersection.rb
112
+ - app/models/metasploit/model/search/operation/group/union.rb
110
113
  - app/models/metasploit/model/search/operation/integer.rb
111
114
  - app/models/metasploit/model/search/operation/null.rb
112
115
  - app/models/metasploit/model/search/operation/set.rb
113
116
  - app/models/metasploit/model/search/operation/set/integer.rb
114
117
  - app/models/metasploit/model/search/operation/set/string.rb
115
118
  - app/models/metasploit/model/search/operation/string.rb
116
- - app/models/metasploit/model/search/operation/union.rb
117
119
  - app/models/metasploit/model/search/operator/association.rb
118
120
  - app/models/metasploit/model/search/operator/attribute.rb
119
121
  - app/models/metasploit/model/search/operator/base.rb
@@ -124,9 +126,11 @@ files:
124
126
  - app/models/metasploit/model/search/operator/deprecated/platform.rb
125
127
  - app/models/metasploit/model/search/operator/deprecated/ref.rb
126
128
  - app/models/metasploit/model/search/operator/deprecated/text.rb
129
+ - app/models/metasploit/model/search/operator/group/base.rb
130
+ - app/models/metasploit/model/search/operator/group/intersection.rb
131
+ - app/models/metasploit/model/search/operator/group/union.rb
127
132
  - app/models/metasploit/model/search/operator/null.rb
128
133
  - app/models/metasploit/model/search/operator/single.rb
129
- - app/models/metasploit/model/search/operator/union.rb
130
134
  - app/models/metasploit/model/search/query.rb
131
135
  - app/models/metasploit/model/spec/template.rb
132
136
  - app/models/metasploit/model/visitation/visitor.rb
@@ -220,13 +224,15 @@ files:
220
224
  - spec/app/models/metasploit/model/search/operation/base_spec.rb
221
225
  - spec/app/models/metasploit/model/search/operation/boolean_spec.rb
222
226
  - spec/app/models/metasploit/model/search/operation/date_spec.rb
227
+ - spec/app/models/metasploit/model/search/operation/group/base_spec.rb
228
+ - spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb
229
+ - spec/app/models/metasploit/model/search/operation/group/union_spec.rb
223
230
  - spec/app/models/metasploit/model/search/operation/integer_spec.rb
224
231
  - spec/app/models/metasploit/model/search/operation/null_spec.rb
225
232
  - spec/app/models/metasploit/model/search/operation/set/integer_spec.rb
226
233
  - spec/app/models/metasploit/model/search/operation/set/string_spec.rb
227
234
  - spec/app/models/metasploit/model/search/operation/set_spec.rb
228
235
  - spec/app/models/metasploit/model/search/operation/string_spec.rb
229
- - spec/app/models/metasploit/model/search/operation/union_spec.rb
230
236
  - spec/app/models/metasploit/model/search/operator/association_spec.rb
231
237
  - spec/app/models/metasploit/model/search/operator/attribute_spec.rb
232
238
  - spec/app/models/metasploit/model/search/operator/base_spec.rb
@@ -237,9 +243,11 @@ files:
237
243
  - spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb
238
244
  - spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb
239
245
  - spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb
246
+ - spec/app/models/metasploit/model/search/operator/group/base_spec.rb
247
+ - spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb
248
+ - spec/app/models/metasploit/model/search/operator/group/union_spec.rb
240
249
  - spec/app/models/metasploit/model/search/operator/null_spec.rb
241
250
  - spec/app/models/metasploit/model/search/operator/single_spec.rb
242
- - spec/app/models/metasploit/model/search/operator/union_spec.rb
243
251
  - spec/app/models/metasploit/model/search/query_spec.rb
244
252
  - spec/app/models/metasploit/model/spec/template_spec.rb
245
253
  - spec/app/models/metasploit/model/visitation/visitor_spec.rb
@@ -499,13 +507,15 @@ test_files:
499
507
  - spec/app/models/metasploit/model/search/operation/base_spec.rb
500
508
  - spec/app/models/metasploit/model/search/operation/boolean_spec.rb
501
509
  - spec/app/models/metasploit/model/search/operation/date_spec.rb
510
+ - spec/app/models/metasploit/model/search/operation/group/base_spec.rb
511
+ - spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb
512
+ - spec/app/models/metasploit/model/search/operation/group/union_spec.rb
502
513
  - spec/app/models/metasploit/model/search/operation/integer_spec.rb
503
514
  - spec/app/models/metasploit/model/search/operation/null_spec.rb
504
515
  - spec/app/models/metasploit/model/search/operation/set/integer_spec.rb
505
516
  - spec/app/models/metasploit/model/search/operation/set/string_spec.rb
506
517
  - spec/app/models/metasploit/model/search/operation/set_spec.rb
507
518
  - spec/app/models/metasploit/model/search/operation/string_spec.rb
508
- - spec/app/models/metasploit/model/search/operation/union_spec.rb
509
519
  - spec/app/models/metasploit/model/search/operator/association_spec.rb
510
520
  - spec/app/models/metasploit/model/search/operator/attribute_spec.rb
511
521
  - spec/app/models/metasploit/model/search/operator/base_spec.rb
@@ -516,9 +526,11 @@ test_files:
516
526
  - spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb
517
527
  - spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb
518
528
  - spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb
529
+ - spec/app/models/metasploit/model/search/operator/group/base_spec.rb
530
+ - spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb
531
+ - spec/app/models/metasploit/model/search/operator/group/union_spec.rb
519
532
  - spec/app/models/metasploit/model/search/operator/null_spec.rb
520
533
  - spec/app/models/metasploit/model/search/operator/single_spec.rb
521
- - spec/app/models/metasploit/model/search/operator/union_spec.rb
522
534
  - spec/app/models/metasploit/model/search/query_spec.rb
523
535
  - spec/app/models/metasploit/model/spec/template_spec.rb
524
536
  - spec/app/models/metasploit/model/visitation/visitor_spec.rb
@@ -1,33 +0,0 @@
1
- # Operator that {#operate_on produces} {Metasploit::Model::Search::Operation::Union union operations}.
2
- class Metasploit::Model::Search::Operator::Union < Metasploit::Model::Search::Operator::Delegation
3
- #
4
- # Methods
5
- #
6
-
7
- # {Metasploit::Model::Search::Operation::Union#children}.
8
- #
9
- # @param formatted_value [String] value parsed from formatted operation
10
- # @return [Array<Metasploit::Model::Search::Operation::Base>]
11
- def children(formatted_value)
12
- raise NotImplementedError
13
- end
14
-
15
- # Unions children operating on `formatted_value`.
16
- #
17
- # @param formatted_value [String] value parsed from formatted operation.
18
- # @return [Metasploit::Model::Search::Operation::Union] Union will not contain {#children} that are invalid.
19
- def operate_on(formatted_value)
20
- children = self.children(formatted_value)
21
-
22
- # filter children for validity as valid values for one child won't necessarily be valid values for another child.
23
- # this is specifically a problem with Metasploit::Model::Search::Operation::Set as no partial matching is allowed,
24
- # but can also be a problem with string vs integer operations.
25
- valid_children = children.select(&:valid?)
26
-
27
- Metasploit::Model::Search::Operation::Union.new(
28
- :children => valid_children,
29
- :operator => self,
30
- :value => formatted_value
31
- )
32
- end
33
- end