metasploit_data_models 6.0.7 → 6.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74538eeddece124d46bfbc8b75ed8cfbdff4e3817d2d043ce378277085a84be4
|
4
|
+
data.tar.gz: 8bdb64d936ab097ed960eafb3e6a4681d8e456ed87a6aa1c6bde7054754590ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3155ae51fcf684a115ca902c96987ee867bde52f0017cf790f92e352039e5ab4bceefb300af00c79b068871542527e153ded49699b93493d3ca92d23e8f725c1
|
7
|
+
data.tar.gz: '0678de3dff2f00feb24b6b3a0be2adeaa89e716bdcad744a62efb6bca4a521e16767058fc4e14e7b5851c60c5eedf50e6410887d672ed93234d20149a15de7f9'
|
@@ -50,8 +50,11 @@ jobs:
|
|
50
50
|
- '3.0'
|
51
51
|
- '3.1'
|
52
52
|
- '3.2'
|
53
|
+
rails:
|
54
|
+
- '~> 7.0.0'
|
55
|
+
- '~> 7.1.0'
|
53
56
|
os:
|
54
|
-
- ubuntu-
|
57
|
+
- ubuntu-22.04
|
55
58
|
- ubuntu-latest
|
56
59
|
exclude:
|
57
60
|
- { os: ubuntu-latest, ruby: '2.7' }
|
@@ -60,7 +63,7 @@ jobs:
|
|
60
63
|
env:
|
61
64
|
RAILS_ENV: test
|
62
65
|
|
63
|
-
name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
|
66
|
+
name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }} - Rails ${{ matrix.rails }}
|
64
67
|
steps:
|
65
68
|
- name: Install system dependencies
|
66
69
|
run: sudo apt-get install libpcap-dev graphviz
|
@@ -74,6 +77,12 @@ jobs:
|
|
74
77
|
ruby-version: ${{ matrix.ruby }}
|
75
78
|
bundler-cache: true
|
76
79
|
|
80
|
+
- name: Update Rails version
|
81
|
+
run: |
|
82
|
+
ruby -pi.bak -e "gsub(/gem ['\"]rails['\"],\s*['\"].+['\"]?/, \"gem 'rails', '${{ matrix.rails }}'\")" Gemfile
|
83
|
+
bundle update
|
84
|
+
bundle install
|
85
|
+
|
77
86
|
- name: Test
|
78
87
|
run: |
|
79
88
|
cp spec/dummy/config/database.yml.github_actions spec/dummy/config/database.yml
|
@@ -49,6 +49,25 @@ class MetasploitDataModels::Search::Visitor::Where
|
|
49
49
|
attribute.matches(match_value)
|
50
50
|
end
|
51
51
|
|
52
|
+
visit 'Metasploit::Model::Search::Operation::Jsonb' do |operation|
|
53
|
+
attribute = attribute_visitor.visit operation.operator
|
54
|
+
|
55
|
+
begin
|
56
|
+
operation_hash = JSON.parse(operation.value)
|
57
|
+
left = Arel::Nodes::InfixOperation.new(
|
58
|
+
'->>',
|
59
|
+
Arel::Nodes.build_quoted(attribute),
|
60
|
+
Arel::Nodes.build_quoted(operation_hash.keys[0])
|
61
|
+
)
|
62
|
+
right ="%#{operation_hash.values[0]}%"
|
63
|
+
rescue JSON::ParserError
|
64
|
+
left = Arel::Nodes::NamedFunction.new("cast", [attribute.as('text')])
|
65
|
+
right ="%#{operation.value}%"
|
66
|
+
end
|
67
|
+
|
68
|
+
left.matches(right)
|
69
|
+
end
|
70
|
+
|
52
71
|
visit 'MetasploitDataModels::IPAddress::CIDR' do |cidr|
|
53
72
|
cast_to_inet "#{cidr.address}/#{cidr.prefix_length}"
|
54
73
|
end
|
@@ -183,5 +183,49 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Where, type: :model do
|
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
186
|
+
|
187
|
+
context 'with MetasploitDataModels::Search::Operation::Jsonb' do
|
188
|
+
let(:klass) do
|
189
|
+
klass = Class.new(ApplicationRecord)
|
190
|
+
Object.const_set('Jsonb', klass)
|
191
|
+
klass
|
192
|
+
end
|
193
|
+
|
194
|
+
let(:node) do
|
195
|
+
Metasploit::Model::Search::Operation::Jsonb.new(
|
196
|
+
:operator => operator,
|
197
|
+
:value => value
|
198
|
+
)
|
199
|
+
end
|
200
|
+
|
201
|
+
let(:operator) do
|
202
|
+
Metasploit::Model::Search::Operator::Attribute.new(
|
203
|
+
:klass => klass,
|
204
|
+
:attribute => :metadata
|
205
|
+
)
|
206
|
+
end
|
207
|
+
|
208
|
+
let(:value) do
|
209
|
+
'adcs_ca:myCA'
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'should visit operation.operator with attribute_visitor' do
|
213
|
+
expect(visitor.attribute_visitor).to receive(:visit).with(operator).and_call_original
|
214
|
+
|
215
|
+
visit
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'should return the expected Arel::Nodes::Matches' do
|
219
|
+
attribute = Arel::Attributes::Attribute.new(
|
220
|
+
Arel::Table.new(:metasploit_credential_privates),
|
221
|
+
'metadata'
|
222
|
+
)
|
223
|
+
allow(visitor.attribute_visitor).to receive(:visit).with(operator).and_return(attribute)
|
224
|
+
|
225
|
+
results = visit
|
226
|
+
expect(results).to be_a(Arel::Nodes::Matches)
|
227
|
+
expect(results.to_sql).to eq("\"metasploit_credential_privates\".\"metadata\" ->> 'adcs_ca' ILIKE '%myCA%'")
|
228
|
+
end
|
229
|
+
end
|
186
230
|
end
|
187
231
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metasploit_data_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Metasploit Hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metasploit-yard
|