metasploit_data_models 4.1.1 → 5.0.1

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: 68c3f56da5b51a9ae696f0dd49c38fd5f7c2399ea7a99fa6f7805b93badbc80c
4
- data.tar.gz: 825c21042d3728a1a47f4cb98a7a01c6e40d41f5dfbfbd715c2adafaabef453e
3
+ metadata.gz: 6b3d6afb4043f6da94c943b5fbc781ae3181d50720a85dc148faaafb90342e9d
4
+ data.tar.gz: 42b7980d65c39dfafca53117d550d3bd408e845e051637b9dc2581f580c86f96
5
5
  SHA512:
6
- metadata.gz: e30b3c529d014801de2524f1c5b731d8461d87e466fc679c4283093346c60febb33fb8a731ada5e59f883ac0fb7b98a5731f88d5bbe3580354832a4aff760a27
7
- data.tar.gz: da1925e7549df28935ecc86221ba2c78c9ac9de5deb1fc89b6737c7fbead438a897f9bd8752a50c1dde5afe59a14d228ee67cf80b97fe9059dd0026f22266b22
6
+ metadata.gz: 8e868aaf68a281bfed3c28ce4bc262fdc8e33ed02ca90beb49c1136e94f78ab0c671e76d6c81d3110592b344ef463d5dc0686c3d110ff8abe3b1aed91a07e33a
7
+ data.tar.gz: 74ba74b84a2daadc73546e4b604e6c9cac36a3b1370e757848096c76f2580dc79d4d573c48833c904606fcd15535da27fb6d6a8e60fd83abd070b4bb3ba38c56
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,71 @@
1
+ name: Verify
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - '*'
7
+ pull_request:
8
+ branches:
9
+ - '*'
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-16.04
14
+ timeout-minutes: 40
15
+
16
+ services:
17
+ postgres:
18
+ image: postgres:9.6
19
+ ports: ["5432:5432"]
20
+ env:
21
+ POSTGRES_USER: postgres
22
+ POSTGRES_PASSWORD: postgres
23
+ options: >-
24
+ --health-cmd pg_isready
25
+ --health-interval 10s
26
+ --health-timeout 5s
27
+ --health-retries 5
28
+
29
+ strategy:
30
+ fail-fast: true
31
+ matrix:
32
+ ruby:
33
+ - 2.5
34
+ - 2.6
35
+ - 2.7
36
+ - 3.0
37
+
38
+ env:
39
+ RAILS_ENV: test
40
+
41
+ name: Ruby ${{ matrix.ruby }}
42
+ steps:
43
+ - name: Install system dependencies
44
+ run: sudo apt-get install libpcap-dev graphviz
45
+
46
+ - name: Checkout code
47
+ uses: actions/checkout@v2
48
+
49
+ - uses: actions/setup-ruby@v1
50
+ with:
51
+ ruby-version: ${{ matrix.ruby }}
52
+
53
+ - name: Setup bundler
54
+ run: |
55
+ gem install bundler:2.1.4
56
+
57
+ - name: Bundle install
58
+ run: |
59
+ bundle config path vendor/bundle
60
+ bundle _2.1.4_ install --jobs 4 --retry 3
61
+
62
+ - name: Test
63
+ run: |
64
+ cp spec/dummy/config/database.yml.github_actions spec/dummy/config/database.yml
65
+ bundle exec rake --version
66
+ bundle exec rake db:create db:migrate
67
+
68
+ # Disabling this check because it is proving unreliable
69
+ # git diff --exit-code spec/dummy/db/structure.sql
70
+ bundle exec rake spec
71
+ bundle exec rake yard
data/Gemfile CHANGED
@@ -27,8 +27,6 @@ group :development, :test do
27
27
  # bound to 0.20 for Activerecord 4.2.8 deprecation warnings:
28
28
  # https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
29
29
  gem 'pg'
30
-
31
- gem 'pry'
32
30
  end
33
31
 
34
32
  group :test do
data/README.md CHANGED
@@ -41,6 +41,14 @@ different `on_load` name, which is just the class name converted to an underscor
41
41
 
42
42
  require 'metasploit_data_models/engine'
43
43
 
44
+ `ArelHelper` classes must also be included in your applications `app/models/application_record.rb` class:
45
+
46
+ class ApplicationRecord < ActiveRecord::Base
47
+ self.abstract_class = true
48
+ include ArelHelpers::ArelTable
49
+ include ArelHelpers::JoinAssociation
50
+ end
51
+
44
52
  ### Metasploit Framework
45
53
 
46
54
  In Metasploit Framework, `MetasploitDataModels::Engine` is loaded, but the data models are only if the user wants to use
@@ -12,7 +12,7 @@ class MetasploitDataModels::IPAddress::V4::Segment::Nmap::List < Metasploit::Mod
12
12
  # Either an individual {MetasploitDataModels::IPAddress::V4::Segment::Single segment number} or a
13
13
  # {MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range segment range}.
14
14
  RANGE_OR_NUMBER_REGEXP = %r{
15
- (?<range>#{parent::Range.regexp})
15
+ (?<range>#{module_parent::Range.regexp})
16
16
  |
17
17
  # range first because it contains a segment and if the range isn't first only the first part of the range will
18
18
  # match.
@@ -67,7 +67,7 @@ class MetasploitDataModels::Search::Visitor::Relation < Metasploit::Model::Base
67
67
  # @return [Hash{Symbol => Class}]
68
68
  def self.visitor_class_by_relation_method
69
69
  @relation_method_by_visitor_class ||= RELATION_METHODS.each_with_object({}) { |relation_method, relation_method_by_visitor_class|
70
- visitor_class_name = "#{parent.name}::#{relation_method.to_s.camelize}"
70
+ visitor_class_name = "#{module_parent.name}::#{relation_method.to_s.camelize}"
71
71
  visitor_class = visitor_class_name.constantize
72
72
 
73
73
  relation_method_by_visitor_class[relation_method] = visitor_class
@@ -1,5 +1,5 @@
1
1
  class AddDetectedArchToHost < ActiveRecord::Migration[4.2]
2
2
  def change
3
- add_column :hosts, :detected_arch, :string, { :null => true }
3
+ add_column :hosts, :detected_arch, :string, :null => true
4
4
  end
5
5
  end
@@ -8,7 +8,6 @@ class CreateAsyncCallbacks < ActiveRecord::Migration[4.2]
8
8
  t.string :target_port
9
9
 
10
10
  t.timestamps null: false
11
- t.uuid null: false
12
11
  end
13
12
  end
14
13
  end
@@ -1,6 +1,6 @@
1
1
  module MetasploitDataModels
2
2
  # VERSION is managed by GemRelease
3
- VERSION = '4.1.1'
3
+ VERSION = '5.0.1'
4
4
 
5
5
  # @return [String]
6
6
  #
@@ -28,18 +28,17 @@ Gem::Specification.new do |s|
28
28
 
29
29
  s.add_development_dependency 'rake'
30
30
 
31
- # documentation
32
- # @note 0.8.7.4 has a bug where attribute writers show up as undocumented
33
- s.add_development_dependency 'yard', '< 0.8.7.4'
31
+ s.add_development_dependency 'yard'
34
32
  # debugging
35
33
  s.add_development_dependency 'pry'
36
34
 
37
35
 
38
- s.add_runtime_dependency 'activerecord', '~>5.2.2'
39
- s.add_runtime_dependency 'activesupport', '~>5.2.2'
36
+ s.add_runtime_dependency 'activerecord', '~>6.0'
37
+ s.add_runtime_dependency 'activesupport', '~>6.0'
40
38
  s.add_runtime_dependency 'metasploit-concern'
41
39
  s.add_runtime_dependency 'metasploit-model', '>=3.1'
42
- s.add_runtime_dependency 'railties', '~>5.2.2'
40
+ s.add_runtime_dependency 'railties', '~>6.0'
41
+ s.add_runtime_dependency 'webrick'
43
42
 
44
43
  # os fingerprinting
45
44
  s.add_runtime_dependency 'recog', '~> 2.0'
@@ -233,7 +233,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
233
233
  end
234
234
 
235
235
  context '#to_s' do
236
- subject(:to_s) {
236
+ subject(:call_to_s) {
237
237
  single.to_s
238
238
  }
239
239
 
@@ -256,7 +256,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
256
256
  it 'delegates to #value' do
257
257
  expect(value).to receive(:to_s)
258
258
 
259
- to_s
259
+ call_to_s
260
260
  end
261
261
  end
262
262
 
@@ -321,4 +321,4 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
321
321
  end
322
322
  end
323
323
  end
324
- end
324
+ end
@@ -39,7 +39,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
39
39
 
40
40
  context '#ordered' do
41
41
  let(:error) {
42
- I18n.translate!('metasploit.model.errors.models.metasploit_data_models/search/operation/range.attributes.value.order', error_attributes)
42
+ I18n.translate!('metasploit.model.errors.models.metasploit_data_models/search/operation/range.attributes.value.order', **error_attributes)
43
43
  }
44
44
 
45
45
  context 'with Range' do
@@ -230,4 +230,4 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
230
230
  end
231
231
  end
232
232
  end
233
- end
233
+ end
@@ -28,7 +28,11 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Attribute, type: :model do
28
28
  end
29
29
 
30
30
  it "should be #{node_class}#attribute" do
31
- expect(name).to eq(node.attribute)
31
+ if node.attribute.instance_of? Symbol
32
+ expect(name.to_s).to eq(node.attribute.to_s)
33
+ else
34
+ expect(name).to eq(node.attribute)
35
+ end
32
36
  end
33
37
  end
34
38
 
@@ -93,4 +97,4 @@ RSpec.describe MetasploitDataModels::Search::Visitor::Attribute, type: :model do
93
97
  }
94
98
  end
95
99
  end
96
- end
100
+ end
@@ -1,3 +1,5 @@
1
1
  class ApplicationRecord < ActiveRecord::Base
2
2
  self.abstract_class = true
3
+ include ArelHelpers::ArelTable
4
+ include ArelHelpers::JoinAssociation
3
5
  end
@@ -56,6 +56,8 @@ module Dummy
56
56
 
57
57
  # Version of your assets, change this if you want to expire all your assets
58
58
  config.assets.version = '1.0'
59
+
60
+ config.autoloader = :zeitwerk
59
61
  end
60
62
  end
61
63
 
@@ -1,18 +1,17 @@
1
- # @note This file is only for use in travis-ci. If you need to make a `spec/dummy/config/database.yml` for running
1
+ # @note This file is only for use in Github Actions. If you need to make a `spec/dummy/config/database.yml` for running
2
2
  # rake, rake spec, or rspec locally, please customize `spec/dummy/config/database.yml.example`.
3
3
  #
4
4
  # @example Customizing config/database.yml.example
5
5
  # cp spec/dummy/config/database.yml.example spec/dummy/config/database.yml
6
6
  # # update password fields for each environment's user
7
7
 
8
- # Using the postgres user locally without a host and port is the supported configuration from Travis-CI
9
- #
10
- # @see http://about.travis-ci.org/docs/user/database-setup/#PostgreSQL
11
8
  development: &pgsql
12
9
  adapter: postgresql
13
10
  database: metasploit_data_models_development
11
+ host: localhost
14
12
  username: postgres
15
- pool: 5
13
+ password: postgres
14
+ pool: 25
16
15
  timeout: 5
17
16
 
18
17
  # Warning: The database defined as "test" will be erased and re-generated from your development database when you run
@@ -0,0 +1,7 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
@@ -5,27 +5,12 @@ SET client_encoding = 'UTF8';
5
5
  SET standard_conforming_strings = on;
6
6
  SELECT pg_catalog.set_config('search_path', '', false);
7
7
  SET check_function_bodies = false;
8
+ SET xmloption = content;
8
9
  SET client_min_messages = warning;
9
10
  SET row_security = off;
10
11
 
11
- --
12
- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
13
- --
14
-
15
- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
16
-
17
-
18
- --
19
- -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
20
- --
21
-
22
- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
23
-
24
-
25
12
  SET default_tablespace = '';
26
13
 
27
- SET default_with_oids = false;
28
-
29
14
  --
30
15
  -- Name: api_keys; Type: TABLE; Schema: public; Owner: -
31
16
  --
@@ -64,8 +49,8 @@ ALTER SEQUENCE public.api_keys_id_seq OWNED BY public.api_keys.id;
64
49
  CREATE TABLE public.ar_internal_metadata (
65
50
  key character varying NOT NULL,
66
51
  value character varying,
67
- created_at timestamp without time zone NOT NULL,
68
- updated_at timestamp without time zone NOT NULL
52
+ created_at timestamp(6) without time zone NOT NULL,
53
+ updated_at timestamp(6) without time zone NOT NULL
69
54
  );
70
55
 
71
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -93,7 +93,7 @@ cert_chain:
93
93
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
94
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
95
  -----END CERTIFICATE-----
96
- date: 2020-11-30 00:00:00.000000000 Z
96
+ date: 2021-05-11 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: metasploit-yard
@@ -155,16 +155,16 @@ dependencies:
155
155
  name: yard
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - "<"
158
+ - - ">="
159
159
  - !ruby/object:Gem::Version
160
- version: 0.8.7.4
160
+ version: '0'
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - "<"
165
+ - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: 0.8.7.4
167
+ version: '0'
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: pry
170
170
  requirement: !ruby/object:Gem::Requirement
@@ -185,28 +185,28 @@ dependencies:
185
185
  requirements:
186
186
  - - "~>"
187
187
  - !ruby/object:Gem::Version
188
- version: 5.2.2
188
+ version: '6.0'
189
189
  type: :runtime
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
193
  - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: 5.2.2
195
+ version: '6.0'
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: activesupport
198
198
  requirement: !ruby/object:Gem::Requirement
199
199
  requirements:
200
200
  - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: 5.2.2
202
+ version: '6.0'
203
203
  type: :runtime
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: 5.2.2
209
+ version: '6.0'
210
210
  - !ruby/object:Gem::Dependency
211
211
  name: metasploit-concern
212
212
  requirement: !ruby/object:Gem::Requirement
@@ -241,14 +241,28 @@ dependencies:
241
241
  requirements:
242
242
  - - "~>"
243
243
  - !ruby/object:Gem::Version
244
- version: 5.2.2
244
+ version: '6.0'
245
245
  type: :runtime
246
246
  prerelease: false
247
247
  version_requirements: !ruby/object:Gem::Requirement
248
248
  requirements:
249
249
  - - "~>"
250
250
  - !ruby/object:Gem::Version
251
- version: 5.2.2
251
+ version: '6.0'
252
+ - !ruby/object:Gem::Dependency
253
+ name: webrick
254
+ requirement: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - ">="
257
+ - !ruby/object:Gem::Version
258
+ version: '0'
259
+ type: :runtime
260
+ prerelease: false
261
+ version_requirements: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - ">="
264
+ - !ruby/object:Gem::Version
265
+ version: '0'
252
266
  - !ruby/object:Gem::Dependency
253
267
  name: recog
254
268
  requirement: !ruby/object:Gem::Requirement
@@ -314,10 +328,10 @@ extensions: []
314
328
  extra_rdoc_files: []
315
329
  files:
316
330
  - ".coveralls.yml"
331
+ - ".github/workflows/verify.yml"
317
332
  - ".gitignore"
318
333
  - ".rspec"
319
334
  - ".simplecov"
320
- - ".travis.yml"
321
335
  - ".yardopts"
322
336
  - CHANGELOG.md
323
337
  - CONTRIBUTING.md
@@ -402,7 +416,6 @@ files:
402
416
  - app/models/metasploit_data_models/search/visitor/method.rb
403
417
  - app/models/metasploit_data_models/search/visitor/relation.rb
404
418
  - app/models/metasploit_data_models/search/visitor/where.rb
405
- - config/initializers/arel_helper.rb
406
419
  - config/initializers/ipaddr.rb
407
420
  - config/locales/en.yml
408
421
  - console_db.yml
@@ -655,7 +668,7 @@ files:
655
668
  - spec/dummy/config/application.rb
656
669
  - spec/dummy/config/boot.rb
657
670
  - spec/dummy/config/database.yml.example
658
- - spec/dummy/config/database.yml.travis
671
+ - spec/dummy/config/database.yml.github_actions
659
672
  - spec/dummy/config/environment.rb
660
673
  - spec/dummy/config/environments/development.rb
661
674
  - spec/dummy/config/environments/production.rb
@@ -671,6 +684,7 @@ files:
671
684
  - spec/dummy/config/initializers/wrap_parameters.rb
672
685
  - spec/dummy/config/locales/en.yml
673
686
  - spec/dummy/config/routes.rb
687
+ - spec/dummy/config/storage.yml
674
688
  - spec/dummy/db/structure.sql
675
689
  - spec/dummy/db/structure.sql.from_rails_3
676
690
  - spec/dummy/lib/assets/.gitkeep
metadata.gz.sig CHANGED
Binary file
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- dist: trusty
2
- sudo: false
3
- group: stable
4
- cache: bundler
5
- language: ruby
6
- addons:
7
- postgresql: '9.6'
8
- apt:
9
- packages:
10
- - libpcap-dev
11
- - graphviz
12
- rvm:
13
- - 2.6.5
14
- before_script:
15
- - cp spec/dummy/config/database.yml.travis spec/dummy/config/database.yml
16
- - bundle exec rake --version
17
- - bundle exec rake db:create db:migrate
18
- script:
19
- # Disabling this check because it is proving unreliable
20
- #- git diff --exit-code spec/dummy/db/structure.sql
21
- - bundle exec rake spec
22
- - bundle exec rake yard
@@ -1,5 +0,0 @@
1
- # Including arel-helpers in all active record models.
2
- # https://github.com/camertron/arel-helpers
3
-
4
- ApplicationRecord.send(:include, ArelHelpers::ArelTable)
5
- ApplicationRecord.send(:include, ArelHelpers::JoinAssociation)