metasploit_data_models 4.0.1 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.github/workflows/verify.yml +75 -0
- data/app/models/mdm/nexpose_console.rb +7 -4
- data/app/models/mdm/note.rb +1 -1
- data/app/models/mdm/workspace.rb +6 -5
- data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
- data/db/migrate/20190308134512_create_async_callbacks.rb +0 -1
- data/lib/metasploit_data_models/version.rb +1 -1
- data/metasploit_data_models.gemspec +9 -18
- data/spec/app/models/mdm/host_spec.rb +27 -27
- data/spec/app/models/mdm/nexpose_console_spec.rb +15 -1
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +3 -3
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +1 -1
- data/spec/dummy/config/{database.yml.travis → database.yml.github_actions} +4 -5
- metadata +43 -42
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -22
- data/app/validators/ip_format_validator.rb +0 -22
- data/app/validators/parameters_validator.rb +0 -129
- data/app/validators/password_is_strong_validator.rb +0 -117
- data/bin/mdm_console +0 -68
- data/bin/rails +0 -14
- data/spec/app/validators/parameters_validator_spec.rb +0 -342
- data/spec/app/validators/password_is_strong_validator_spec.rb +0 -332
metadata
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metasploit_data_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Luke Imhoff
|
9
|
-
- David 'thelightcosine' Maloney
|
10
|
-
- Trevor 'burlyscudd' Rosen
|
7
|
+
- Metasploit Hackers
|
11
8
|
autorequire:
|
12
9
|
bindir: bin
|
13
10
|
cert_chain:
|
@@ -67,20 +64,20 @@ cert_chain:
|
|
67
64
|
-----END CERTIFICATE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 2021-04-08 00:00:00.000000000 Z
|
100
97
|
dependencies:
|
101
98
|
- !ruby/object:Gem::Dependency
|
102
99
|
name: metasploit-yard
|
@@ -158,16 +155,16 @@ dependencies:
|
|
158
155
|
name: yard
|
159
156
|
requirement: !ruby/object:Gem::Requirement
|
160
157
|
requirements:
|
161
|
-
- - "
|
158
|
+
- - ">="
|
162
159
|
- !ruby/object:Gem::Version
|
163
|
-
version: 0
|
160
|
+
version: '0'
|
164
161
|
type: :development
|
165
162
|
prerelease: false
|
166
163
|
version_requirements: !ruby/object:Gem::Requirement
|
167
164
|
requirements:
|
168
|
-
- - "
|
165
|
+
- - ">="
|
169
166
|
- !ruby/object:Gem::Version
|
170
|
-
version: 0
|
167
|
+
version: '0'
|
171
168
|
- !ruby/object:Gem::Dependency
|
172
169
|
name: pry
|
173
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,14 +227,14 @@ dependencies:
|
|
230
227
|
requirements:
|
231
228
|
- - ">="
|
232
229
|
- !ruby/object:Gem::Version
|
233
|
-
version: '
|
230
|
+
version: '3.1'
|
234
231
|
type: :runtime
|
235
232
|
prerelease: false
|
236
233
|
version_requirements: !ruby/object:Gem::Requirement
|
237
234
|
requirements:
|
238
235
|
- - ">="
|
239
236
|
- !ruby/object:Gem::Version
|
240
|
-
version: '
|
237
|
+
version: '3.1'
|
241
238
|
- !ruby/object:Gem::Dependency
|
242
239
|
name: railties
|
243
240
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,6 +249,20 @@ dependencies:
|
|
252
249
|
- - "~>"
|
253
250
|
- !ruby/object:Gem::Version
|
254
251
|
version: 5.2.2
|
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'
|
255
266
|
- !ruby/object:Gem::Dependency
|
256
267
|
name: recog
|
257
268
|
requirement: !ruby/object:Gem::Requirement
|
@@ -311,19 +322,16 @@ dependencies:
|
|
311
322
|
description: Implements minimal ActiveRecord models and database helper code used
|
312
323
|
in both the Metasploit Framework (MSF) and Metasploit commercial editions.
|
313
324
|
email:
|
314
|
-
-
|
315
|
-
- luke_imhoff@rapid7.com
|
316
|
-
- dmaloney@rapid7.com
|
317
|
-
- trevor_rosen@rapid7.com
|
325
|
+
- msfdev@metasploit.com
|
318
326
|
executables: []
|
319
327
|
extensions: []
|
320
328
|
extra_rdoc_files: []
|
321
329
|
files:
|
322
330
|
- ".coveralls.yml"
|
331
|
+
- ".github/workflows/verify.yml"
|
323
332
|
- ".gitignore"
|
324
333
|
- ".rspec"
|
325
334
|
- ".simplecov"
|
326
|
-
- ".travis.yml"
|
327
335
|
- ".yardopts"
|
328
336
|
- CHANGELOG.md
|
329
337
|
- CONTRIBUTING.md
|
@@ -408,11 +416,6 @@ files:
|
|
408
416
|
- app/models/metasploit_data_models/search/visitor/method.rb
|
409
417
|
- app/models/metasploit_data_models/search/visitor/relation.rb
|
410
418
|
- app/models/metasploit_data_models/search/visitor/where.rb
|
411
|
-
- app/validators/ip_format_validator.rb
|
412
|
-
- app/validators/parameters_validator.rb
|
413
|
-
- app/validators/password_is_strong_validator.rb
|
414
|
-
- bin/mdm_console
|
415
|
-
- bin/rails
|
416
419
|
- config/initializers/arel_helper.rb
|
417
420
|
- config/initializers/ipaddr.rb
|
418
421
|
- config/locales/en.yml
|
@@ -649,8 +652,6 @@ files:
|
|
649
652
|
- spec/app/models/metasploit_data_models/search/visitor/method_spec.rb
|
650
653
|
- spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb
|
651
654
|
- spec/app/models/metasploit_data_models/search/visitor/where_spec.rb
|
652
|
-
- spec/app/validators/parameters_validator_spec.rb
|
653
|
-
- spec/app/validators/password_is_strong_validator_spec.rb
|
654
655
|
- spec/dummy/Rakefile
|
655
656
|
- spec/dummy/app/assets/config/manifest.js
|
656
657
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -668,7 +669,7 @@ files:
|
|
668
669
|
- spec/dummy/config/application.rb
|
669
670
|
- spec/dummy/config/boot.rb
|
670
671
|
- spec/dummy/config/database.yml.example
|
671
|
-
- spec/dummy/config/database.yml.
|
672
|
+
- spec/dummy/config/database.yml.github_actions
|
672
673
|
- spec/dummy/config/environment.rb
|
673
674
|
- spec/dummy/config/environments/development.rb
|
674
675
|
- spec/dummy/config/environments/production.rb
|
@@ -777,7 +778,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
777
778
|
requirements:
|
778
779
|
- - ">="
|
779
780
|
- !ruby/object:Gem::Version
|
780
|
-
version: '2.
|
781
|
+
version: '2.4'
|
781
782
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
782
783
|
requirements:
|
783
784
|
- - ">="
|
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,22 +0,0 @@
|
|
1
|
-
require "ipaddr"
|
2
|
-
|
3
|
-
# Validates that attribute is a valid IPv4 or IPv6 address.
|
4
|
-
class IpFormatValidator < ActiveModel::EachValidator
|
5
|
-
# Validates that `attribute`'s `value` on `object` is a valid IPv4 or IPv6 address.
|
6
|
-
#
|
7
|
-
# @return [void]
|
8
|
-
def validate_each(object, attribute, value)
|
9
|
-
error_message_block = lambda{ object.errors.add attribute, " must be a valid IPv4 or IPv6 address" }
|
10
|
-
begin
|
11
|
-
if value.is_a? IPAddr
|
12
|
-
potential_ip = value.dup
|
13
|
-
else
|
14
|
-
potential_ip = IPAddr.new(value)
|
15
|
-
end
|
16
|
-
|
17
|
-
error_message_block.call unless potential_ip.ipv4? || potential_ip.ipv6?
|
18
|
-
rescue ArgumentError
|
19
|
-
error_message_block.call
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
# Validates that attribute's value is Array<Array(String, String)> which is the only valid type signature for serialized
|
2
|
-
# parameters.
|
3
|
-
class ParametersValidator < ActiveModel::EachValidator
|
4
|
-
#
|
5
|
-
# CONSTANTS
|
6
|
-
#
|
7
|
-
|
8
|
-
# Sentence explaining the valid type signature for parameters.
|
9
|
-
TYPE_SIGNATURE_SENTENCE = 'Valid parameters are an Array<Array(String, String)>.'
|
10
|
-
|
11
|
-
#
|
12
|
-
# Instance Methods
|
13
|
-
#
|
14
|
-
|
15
|
-
# Validates that `attribute`'s `value` on `record` is `Array<Array(String, String)>` which is the only valid type
|
16
|
-
# signature for serialized parameters.
|
17
|
-
#
|
18
|
-
# @return [void]
|
19
|
-
def validate_each(record, attribute, value)
|
20
|
-
if value.is_a? Array
|
21
|
-
value.each_with_index do |element, index|
|
22
|
-
if element.is_a? Array
|
23
|
-
if element.length != 2
|
24
|
-
extreme = :few
|
25
|
-
|
26
|
-
if element.length > 2
|
27
|
-
extreme = :many
|
28
|
-
end
|
29
|
-
|
30
|
-
length_error = length_error_at(
|
31
|
-
:extreme => extreme,
|
32
|
-
:element => element,
|
33
|
-
:index => index
|
34
|
-
)
|
35
|
-
|
36
|
-
record.errors.add attribute, length_error
|
37
|
-
else
|
38
|
-
parameter_name = element.first
|
39
|
-
|
40
|
-
if parameter_name.is_a? String
|
41
|
-
unless parameter_name.present?
|
42
|
-
error = error_at(
|
43
|
-
:element => element,
|
44
|
-
:index => index,
|
45
|
-
:prefix => "has blank parameter name"
|
46
|
-
)
|
47
|
-
record.errors.add attribute, error
|
48
|
-
end
|
49
|
-
else
|
50
|
-
error = error_at(
|
51
|
-
:element => element,
|
52
|
-
:index => index,
|
53
|
-
:prefix => "has non-String parameter name (#{parameter_name.inspect})"
|
54
|
-
)
|
55
|
-
record.errors.add attribute, error
|
56
|
-
end
|
57
|
-
|
58
|
-
parameter_value = element.second
|
59
|
-
|
60
|
-
unless parameter_value.is_a? String
|
61
|
-
error = error_at(
|
62
|
-
:element => element,
|
63
|
-
:index => index,
|
64
|
-
:prefix => "has non-String parameter value (#{parameter_value.inspect})"
|
65
|
-
)
|
66
|
-
record.errors.add attribute, error
|
67
|
-
end
|
68
|
-
end
|
69
|
-
else
|
70
|
-
error = error_at(
|
71
|
-
:element => element,
|
72
|
-
:index => index,
|
73
|
-
:prefix => 'has non-Array'
|
74
|
-
)
|
75
|
-
record.errors.add attribute, error
|
76
|
-
end
|
77
|
-
end
|
78
|
-
else
|
79
|
-
record.errors.add attribute, "is not an Array. #{TYPE_SIGNATURE_SENTENCE}"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
private
|
84
|
-
|
85
|
-
def error_at(options={})
|
86
|
-
options.assert_valid_keys(:element, :index, :prefix)
|
87
|
-
prefix = options.fetch(:prefix)
|
88
|
-
|
89
|
-
clause = location_clause(
|
90
|
-
:element => options[:element],
|
91
|
-
:index => options[:index]
|
92
|
-
)
|
93
|
-
sentence = "#{prefix} #{clause}."
|
94
|
-
|
95
|
-
sentences = [
|
96
|
-
sentence,
|
97
|
-
TYPE_SIGNATURE_SENTENCE
|
98
|
-
]
|
99
|
-
|
100
|
-
error = sentences.join(" ")
|
101
|
-
|
102
|
-
error
|
103
|
-
end
|
104
|
-
|
105
|
-
def length_error_at(options={})
|
106
|
-
options.assert_valid_keys(:element, :extreme, :index)
|
107
|
-
extreme = options.fetch(:extreme)
|
108
|
-
|
109
|
-
prefix = "has too #{extreme} elements"
|
110
|
-
error = error_at(
|
111
|
-
:element => options[:element],
|
112
|
-
:index => options[:index],
|
113
|
-
:prefix => prefix
|
114
|
-
)
|
115
|
-
|
116
|
-
error
|
117
|
-
end
|
118
|
-
|
119
|
-
def location_clause(options={})
|
120
|
-
options.assert_valid_keys(:element, :index)
|
121
|
-
|
122
|
-
element = options.fetch(:element)
|
123
|
-
index = options.fetch(:index)
|
124
|
-
|
125
|
-
clause = "at index #{index} (#{element.inspect})"
|
126
|
-
|
127
|
-
clause
|
128
|
-
end
|
129
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# Validates that
|
2
|
-
class PasswordIsStrongValidator < ActiveModel::EachValidator
|
3
|
-
#
|
4
|
-
# CONSTANTS
|
5
|
-
#
|
6
|
-
|
7
|
-
# Known passwords that should NOT be allowed and should be considered weak.
|
8
|
-
COMMON_PASSWORDS = %w{
|
9
|
-
password pass root admin metasploit
|
10
|
-
msf 123456 qwerty abc123 letmein monkey link182 demo
|
11
|
-
changeme test1234 rapid7
|
12
|
-
}
|
13
|
-
|
14
|
-
# Special characters that are considered to strength passwords and are required once in a strong password.
|
15
|
-
SPECIAL_CHARS = %q{!@"#$%&'()*+,-./:;<=>?[\\]^_`{|}~ }
|
16
|
-
|
17
|
-
# Validates that the `attribute`'s `value` on `record` contains letters, numbers, and at least one special character
|
18
|
-
# without containing the `record.username`, any {COMMON_PASSWORDS} or repetition.
|
19
|
-
def validate_each(record, attribute, value)
|
20
|
-
return if value.blank?
|
21
|
-
|
22
|
-
if is_simple?(value)
|
23
|
-
record.errors[attribute] << "must contain letters, numbers, and at least one special character"
|
24
|
-
end
|
25
|
-
|
26
|
-
if contains_username?(record.username, value)
|
27
|
-
record.errors[attribute] << "must not contain the username"
|
28
|
-
end
|
29
|
-
|
30
|
-
if is_common_password?(value)
|
31
|
-
record.errors[attribute] << "must not be a common password"
|
32
|
-
end
|
33
|
-
|
34
|
-
if contains_repetition?(value)
|
35
|
-
record.errors[attribute] << "must not be a predictable sequence of characters"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def is_simple?(password)
|
42
|
-
not (password =~ /[A-Za-z]/ and password =~ /[0-9]/ and password =~ /[#{Regexp.escape(SPECIAL_CHARS)}]/)
|
43
|
-
end
|
44
|
-
|
45
|
-
def contains_username?(username, password)
|
46
|
-
!!(password =~ /#{username}/i)
|
47
|
-
end
|
48
|
-
|
49
|
-
def is_common_password?(password)
|
50
|
-
COMMON_PASSWORDS.each do |pw|
|
51
|
-
common_pw = [pw] # pw + "!", pw + "1", pw + "12", pw + "123", pw + "1234"]
|
52
|
-
common_pw += mutate_pass(pw)
|
53
|
-
common_pw.each do |common_pass|
|
54
|
-
if password.downcase =~ /#{common_pass}[\d!]*/
|
55
|
-
return true
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
false
|
60
|
-
end
|
61
|
-
|
62
|
-
def mutate_pass(password)
|
63
|
-
mutations = {
|
64
|
-
'a' => '@',
|
65
|
-
'o' => '0',
|
66
|
-
'e' => '3',
|
67
|
-
's' => '$',
|
68
|
-
't' => '7',
|
69
|
-
'l' => '1'
|
70
|
-
}
|
71
|
-
|
72
|
-
iterations = mutations.keys.dup
|
73
|
-
results = []
|
74
|
-
|
75
|
-
# Find PowerSet of all possible mutation combinations
|
76
|
-
iterations = iterations.inject([[]]){|c,y|r=[];c.each{|i|r<<i;r<<i+[y]};r}
|
77
|
-
|
78
|
-
# Iterate through combinations to create each possible mutation
|
79
|
-
iterations.each do |iteration|
|
80
|
-
next if iteration.flatten.empty?
|
81
|
-
first = iteration.shift
|
82
|
-
intermediate = password.gsub(/#{first}/i, mutations[first])
|
83
|
-
iteration.each do |mutator|
|
84
|
-
next unless mutator.kind_of? String
|
85
|
-
intermediate.gsub!(/#{mutator}/i, mutations[mutator])
|
86
|
-
end
|
87
|
-
results << intermediate
|
88
|
-
end
|
89
|
-
|
90
|
-
return results
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
def contains_repetition?(password)
|
96
|
-
# Password repetition (quite basic) -- no "aaaaaa" or "ababab" or "abcabc" or
|
97
|
-
# "abcdabcd" (but note that the user can use "aaaaaab" or something).
|
98
|
-
|
99
|
-
if password.scan(/./).uniq.size < 2
|
100
|
-
return true
|
101
|
-
end
|
102
|
-
|
103
|
-
if (password.size % 2 == 0) and (password.scan(/../).uniq.size < 2)
|
104
|
-
return true
|
105
|
-
end
|
106
|
-
|
107
|
-
if (password.size % 3 == 0) and (password.scan(/.../).uniq.size < 2)
|
108
|
-
return true
|
109
|
-
end
|
110
|
-
|
111
|
-
if (password.size % 4 == 0) and (password.scan(/..../).uniq.size < 2)
|
112
|
-
return true
|
113
|
-
end
|
114
|
-
|
115
|
-
false
|
116
|
-
end
|
117
|
-
end
|