metasploit_data_models 0.24.5 → 1.0.0.pre.rails.pre.4.0a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/.simplecov +1 -1
- data/Gemfile +8 -5
- data/app/models/mdm/api_key.rb +1 -0
- data/app/models/mdm/client.rb +2 -2
- data/app/models/mdm/cred.rb +13 -13
- data/app/models/mdm/event.rb +5 -4
- data/app/models/mdm/exploit_attempt.rb +1 -0
- data/app/models/mdm/exploited_host.rb +1 -1
- data/app/models/mdm/host.rb +37 -20
- data/app/models/mdm/host_detail.rb +2 -2
- data/app/models/mdm/host_tag.rb +1 -1
- data/app/models/mdm/listener.rb +2 -1
- data/app/models/mdm/loot.rb +1 -0
- data/app/models/mdm/macro.rb +1 -1
- data/app/models/mdm/mod_ref.rb +1 -0
- data/app/models/mdm/module/action.rb +1 -7
- data/app/models/mdm/module/arch.rb +0 -6
- data/app/models/mdm/module/author.rb +1 -8
- data/app/models/mdm/module/detail.rb +1 -1
- data/app/models/mdm/module/mixin.rb +0 -6
- data/app/models/mdm/module/platform.rb +0 -6
- data/app/models/mdm/module/ref.rb +0 -6
- data/app/models/mdm/module/target.rb +0 -7
- data/app/models/mdm/nexpose_console.rb +1 -0
- data/app/models/mdm/note.rb +3 -3
- data/app/models/mdm/ref.rb +0 -6
- data/app/models/mdm/route.rb +2 -1
- data/app/models/mdm/service.rb +1 -1
- data/app/models/mdm/session.rb +8 -7
- data/app/models/mdm/session_event.rb +2 -1
- data/app/models/mdm/tag.rb +2 -2
- data/app/models/mdm/task.rb +1 -3
- data/app/models/mdm/user.rb +4 -5
- data/app/models/mdm/vuln.rb +8 -7
- data/app/models/mdm/vuln_attempt.rb +1 -0
- data/app/models/mdm/vuln_detail.rb +3 -2
- data/app/models/mdm/vuln_ref.rb +1 -1
- data/app/models/mdm/web_form.rb +2 -1
- data/app/models/mdm/web_page.rb +3 -2
- data/app/models/mdm/web_site.rb +3 -2
- data/app/models/mdm/web_vuln.rb +1 -0
- data/app/models/mdm/wmap_request.rb +12 -0
- data/app/models/mdm/wmap_target.rb +12 -0
- data/app/models/mdm/workspace.rb +4 -3
- data/app/models/metasploit_data_models/automatic_exploitation/match.rb +0 -3
- data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +0 -12
- data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +0 -1
- data/app/models/metasploit_data_models/automatic_exploitation/run.rb +0 -2
- data/app/validators/ip_format_validator.rb +6 -1
- data/config/initializers/ipaddr.rb +35 -0
- data/db/migrate/002_add_workspaces.rb +2 -2
- data/db/migrate/007_add_loots.rb +1 -1
- data/db/migrate/008_create_users.rb +1 -1
- data/db/migrate/011_add_reports.rb +1 -1
- data/db/migrate/012_add_tasks.rb +1 -1
- data/db/migrate/026_add_creds_table.rb +2 -2
- data/db/migrate/20100824151500_add_exploited_table.rb +1 -1
- data/db/migrate/20100911122000_add_report_templates.rb +1 -1
- data/db/migrate/20100916175000_add_campaigns_and_templates.rb +1 -1
- data/db/migrate/20101001000000_add_web_tables.rb +13 -13
- data/db/migrate/20110204112800_add_host_tags.rb +1 -1
- data/db/migrate/20110527000001_add_api_keys_table.rb +1 -1
- data/db/migrate/20110606000001_add_macros_table.rb +2 -2
- data/db/migrate/20110624000001_add_listeners_table.rb +1 -1
- data/db/migrate/20110630000001_add_nexpose_consoles_table.rb +1 -1
- data/db/migrate/20110717000001_add_profiles_table.rb +1 -1
- data/db/migrate/20130522001343_create_task_creds.rb +1 -1
- data/db/migrate/20130522032517_create_task_hosts.rb +1 -1
- data/db/migrate/20130522041110_create_task_services.rb +1 -1
- data/db/migrate/20130604145732_create_task_sessions.rb +1 -1
- data/db/migrate/20131002004641_create_automatic_exploitation_matches.rb +1 -1
- data/db/migrate/20131002164449_create_automatic_exploitation_match_sets.rb +1 -1
- data/db/migrate/20131008213344_create_automatic_exploitation_runs.rb +1 -1
- data/db/migrate/20131017150735_create_automatic_exploitation_match_results.rb +1 -1
- data/db/migrate/20150219173821_create_module_runs.rb +1 -1
- data/db/migrate/20150317145455_rename_module_indices.rb +29 -0
- data/db/migrate/20150421211719_rename_automatic_exploitation_index.rb +16 -0
- data/lib/mdm/host/operating_system_normalization.rb +1 -1
- data/lib/metasploit_data_models.rb +1 -0
- data/lib/metasploit_data_models/engine.rb +1 -1
- data/lib/metasploit_data_models/version.rb +5 -3
- data/metasploit_data_models.gemspec +11 -8
- data/spec/app/models/mdm/event_spec.rb +17 -11
- data/spec/app/models/mdm/host_spec.rb +2 -2
- data/spec/app/models/mdm/module/action_spec.rb +0 -5
- data/spec/app/models/mdm/module/arch_spec.rb +0 -5
- data/spec/app/models/mdm/module/author_spec.rb +0 -6
- data/spec/app/models/mdm/module/detail_spec.rb +3 -3
- data/spec/app/models/mdm/module/mixin_spec.rb +0 -5
- data/spec/app/models/mdm/module/platform_spec.rb +0 -5
- data/spec/app/models/mdm/module/ref_spec.rb +0 -5
- data/spec/app/models/mdm/module/target_spec.rb +0 -6
- data/spec/app/models/mdm/ref_spec.rb +0 -3
- data/spec/app/models/mdm/service_spec.rb +1 -1
- data/spec/app/models/mdm/web_vuln_spec.rb +3 -3
- data/spec/app/models/mdm/wmap_request_spec.rb +2 -0
- data/spec/app/models/mdm/wmap_target_spec.rb +2 -0
- data/spec/app/models/mdm/workspace_spec.rb +2 -2
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +1 -1
- data/spec/dummy/config/application.rb +1 -7
- data/spec/dummy/config/environments/development.rb +2 -13
- data/spec/dummy/config/environments/production.rb +2 -0
- data/spec/dummy/config/environments/test.rb +2 -6
- data/spec/dummy/db/structure.sql +24 -19
- data/spec/dummy/db/structure.sql.from_rails_3 +3403 -0
- data/spec/factories/mdm/module/details.rb +1 -1
- data/spec/lib/ipaddr_spec.rb +31 -0
- data/spec/lib/metasploit_data_models/version_spec.rb +1 -3
- data/spec/support/shared/examples/coerces_inet_column_type_to_string.rb +15 -0
- metadata +63 -28
@@ -3,7 +3,7 @@ class AddWorkspaces < ActiveRecord::Migration
|
|
3
3
|
def self.up
|
4
4
|
create_table :workspaces do |t|
|
5
5
|
t.string :name
|
6
|
-
t.timestamps
|
6
|
+
t.timestamps null: false
|
7
7
|
end
|
8
8
|
|
9
9
|
change_table :hosts do |t|
|
@@ -16,7 +16,7 @@ class AddWorkspaces < ActiveRecord::Migration
|
|
16
16
|
# This was broken after 018_add_workspace_user_info was introduced
|
17
17
|
# because of the new boundary column. For some reason, the
|
18
18
|
# find_or_create_by_name that .default eventually calls here tries to
|
19
|
-
# create a record with the boundary field that doesn't exist yet.
|
19
|
+
# create a record with the boundary field that doesn't exist yet.
|
20
20
|
# See #1724
|
21
21
|
#
|
22
22
|
#w = Msf::DBManager::Workspace.default
|
data/db/migrate/007_add_loots.rb
CHANGED
data/db/migrate/012_add_tasks.rb
CHANGED
@@ -2,12 +2,12 @@ class AddCredsTable < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
3
3
|
create_table :creds do |t|
|
4
4
|
t.integer :service_id, :null => false
|
5
|
-
t.timestamps
|
5
|
+
t.timestamps null: false
|
6
6
|
t.string :user, :limit => 2048
|
7
7
|
t.string :pass, :limit => 4096
|
8
8
|
t.boolean :active, :default => true
|
9
9
|
t.string :proof, :limit => 4096
|
10
|
-
t.string :ptype, :limit => 16
|
10
|
+
t.string :ptype, :limit => 16
|
11
11
|
t.integer :source_id
|
12
12
|
t.string :source_type
|
13
13
|
end
|
@@ -1,51 +1,51 @@
|
|
1
1
|
class AddWebTables < ActiveRecord::Migration
|
2
|
-
|
2
|
+
|
3
3
|
def self.up
|
4
4
|
create_table :web_sites do |t|
|
5
5
|
t.integer :service_id, :null => false
|
6
|
-
t.timestamps
|
6
|
+
t.timestamps null: false
|
7
7
|
t.string :vhost, :limit => 2048
|
8
8
|
t.text :comments
|
9
9
|
t.text :options
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
create_table :web_pages do |t|
|
13
13
|
t.integer :web_site_id, :null => false
|
14
|
-
t.timestamps
|
14
|
+
t.timestamps null: false
|
15
15
|
t.text :path
|
16
16
|
t.text :query
|
17
17
|
t.integer :code, :null => false
|
18
18
|
t.text :cookie
|
19
19
|
t.text :auth
|
20
20
|
t.text :ctype
|
21
|
-
t.timestamp :mtime
|
21
|
+
t.timestamp :mtime
|
22
22
|
t.text :location
|
23
23
|
t.text :body
|
24
24
|
t.text :headers
|
25
|
-
end
|
25
|
+
end
|
26
26
|
|
27
27
|
create_table :web_forms do |t|
|
28
28
|
t.integer :web_site_id, :null => false
|
29
|
-
t.timestamps
|
29
|
+
t.timestamps null: false
|
30
30
|
t.text :path
|
31
31
|
t.string :method, :limit => 1024
|
32
32
|
t.text :params
|
33
|
-
end
|
33
|
+
end
|
34
34
|
|
35
35
|
create_table :web_vulns do |t|
|
36
36
|
t.integer :web_site_id, :null => false
|
37
|
-
t.timestamps
|
37
|
+
t.timestamps null: false
|
38
38
|
t.text :path
|
39
39
|
t.string :method, :limit => 1024
|
40
40
|
t.text :params
|
41
41
|
t.text :pname
|
42
42
|
t.text :proof
|
43
43
|
t.integer :risk
|
44
|
-
t.string :name, :limit => 1024
|
45
|
-
end
|
46
|
-
|
44
|
+
t.string :name, :limit => 1024
|
45
|
+
end
|
46
|
+
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def self.down
|
50
50
|
drop_table :web_sites
|
51
51
|
drop_table :web_pages
|
@@ -9,7 +9,7 @@ class AddHostTags < ActiveRecord::Migration
|
|
9
9
|
t.boolean :report_summary, :null => false, :default => false
|
10
10
|
t.boolean :report_detail, :null => false, :default => false
|
11
11
|
t.boolean :critical, :null => false, :default => false
|
12
|
-
t.timestamps
|
12
|
+
t.timestamps null: false
|
13
13
|
end
|
14
14
|
|
15
15
|
create_table :hosts_tags, :id => false do |t|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class AddMacrosTable < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
create_table :macros do |t|
|
4
|
-
t.timestamps
|
4
|
+
t.timestamps null: false
|
5
5
|
t.text :owner
|
6
6
|
t.text :name
|
7
7
|
t.text :description
|
8
8
|
t.binary :actions
|
9
|
-
t.binary :prefs
|
9
|
+
t.binary :prefs
|
10
10
|
end
|
11
11
|
end
|
12
12
|
def self.down
|
@@ -4,7 +4,7 @@ class CreateAutomaticExploitationMatchSets < ActiveRecord::Migration
|
|
4
4
|
t.integer :workspace_id
|
5
5
|
t.integer :user_id
|
6
6
|
|
7
|
-
t.timestamps
|
7
|
+
t.timestamps null: false
|
8
8
|
end
|
9
9
|
add_index :automatic_exploitation_match_sets, :user_id
|
10
10
|
add_index :automatic_exploitation_match_sets, :workspace_id
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class RenameModuleIndices < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
# This migration will only need to be run if the indices were originally
|
4
|
+
# generated before Rails 4. Fresh builds can safely skip this.
|
5
|
+
return if ActiveRecord::Base.connection.indexes(:module_actions).first.name != 'index_module_actions_on_module_detail_id'
|
6
|
+
|
7
|
+
rename_index :module_actions,
|
8
|
+
'index_module_actions_on_module_detail_id',
|
9
|
+
'index_module_actions_on_detail_id'
|
10
|
+
rename_index :module_archs,
|
11
|
+
'index_module_archs_on_module_detail_id',
|
12
|
+
'index_module_archs_on_detail_id'
|
13
|
+
rename_index :module_authors,
|
14
|
+
'index_module_authors_on_module_detail_id',
|
15
|
+
'index_module_authors_on_detail_id'
|
16
|
+
rename_index :module_mixins,
|
17
|
+
'index_module_mixins_on_module_detail_id',
|
18
|
+
'index_module_mixins_on_detail_id'
|
19
|
+
rename_index :module_platforms,
|
20
|
+
'index_module_platforms_on_module_detail_id',
|
21
|
+
'index_module_platforms_on_detail_id'
|
22
|
+
rename_index :module_refs,
|
23
|
+
'index_module_refs_on_module_detail_id',
|
24
|
+
'index_module_refs_on_detail_id'
|
25
|
+
rename_index :module_targets,
|
26
|
+
'index_module_targets_on_module_detail_id',
|
27
|
+
'index_module_targets_on_detail_id'
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class RenameAutomaticExploitationIndex < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
if index_name_exists? :automatic_exploitation_matches, :index_automatic_exploitation_matches_on_ref_id, false
|
4
|
+
rename_index :automatic_exploitation_matches,
|
5
|
+
:index_automatic_exploitation_matches_on_ref_id,
|
6
|
+
:index_automatic_exploitation_matches_on_module_detail_id
|
7
|
+
end
|
8
|
+
end
|
9
|
+
def down
|
10
|
+
if index_name_exists? :automatic_exploitation_matches, :index_automatic_exploitation_matches_on_module_detail_id, false
|
11
|
+
rename_index :automatic_exploitation_matches,
|
12
|
+
:index_automatic_exploitation_matches_on_module_detail_id,
|
13
|
+
:index_automatic_exploitation_matches_on_ref_id
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -188,7 +188,7 @@ module Mdm::Host::OperatingSystemNormalization
|
|
188
188
|
# Handle cases where the flavor contains the base name (legacy parsing, etc)
|
189
189
|
# TODO: Remove this once we are sure it is no longer needed
|
190
190
|
if host.os_name && host.os_flavor && host.os_flavor.index(host.os_name)
|
191
|
-
dlog("Host #{host.address} has os_flavor that contains os_name")
|
191
|
+
dlog("Host #{host.address.to_s} has os_flavor that contains os_name")
|
192
192
|
dlog("os_flavor: #{host.os_flavor}")
|
193
193
|
dlog("os_name: #{host.os_name}")
|
194
194
|
host.os_flavor = host.os_flavor.gsub(host.os_name, '').strip
|
@@ -11,7 +11,7 @@ class MetasploitDataModels::Engine < Rails::Engine
|
|
11
11
|
|
12
12
|
# Remove ActiveSupport::Dependencies loading paths to save time during constant resolution and to ensure that
|
13
13
|
# metasploit_data_models is properly declaring all autoloads and not falling back on ActiveSupport::Dependencies
|
14
|
-
config.paths.
|
14
|
+
config.paths.values.each do |path|
|
15
15
|
path.skip_autoload!
|
16
16
|
path.skip_autoload_once!
|
17
17
|
path.skip_eager_load!
|
@@ -2,11 +2,13 @@ module MetasploitDataModels
|
|
2
2
|
# Holds components of {VERSION} as defined by {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0}.
|
3
3
|
module Version
|
4
4
|
# The major version number.
|
5
|
-
MAJOR =
|
5
|
+
MAJOR = 1
|
6
6
|
# The minor version number, scoped to the {MAJOR} version number.
|
7
|
-
MINOR =
|
7
|
+
MINOR = 0
|
8
8
|
# The patch number, scoped to the {MAJOR} and {MINOR} version numbers.
|
9
|
-
PATCH =
|
9
|
+
PATCH = 0
|
10
|
+
# The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version numbers.
|
11
|
+
PRERELEASE = 'rails-4.0a'
|
10
12
|
|
11
13
|
# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the `PRERELEASE` in the
|
12
14
|
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
|
@@ -37,20 +37,23 @@ Gem::Specification.new do |s|
|
|
37
37
|
# debugging
|
38
38
|
s.add_development_dependency 'pry'
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
s.add_runtime_dependency 'activerecord',
|
43
|
-
s.add_runtime_dependency 'activesupport'
|
40
|
+
rails_version_constraints = ['>= 4.0.9', '< 4.1.0']
|
41
|
+
|
42
|
+
s.add_runtime_dependency 'activerecord', *rails_version_constraints
|
43
|
+
s.add_runtime_dependency 'activesupport', *rails_version_constraints
|
44
|
+
s.add_runtime_dependency 'metasploit-concern', '1.0.0.pre.rails.pre.4.0'
|
45
|
+
s.add_runtime_dependency 'metasploit-model', '1.0.0.pre.rails.pre.4.0'
|
46
|
+
s.add_runtime_dependency 'railties', *rails_version_constraints
|
47
|
+
|
44
48
|
# os fingerprinting
|
45
49
|
s.add_runtime_dependency 'recog', '~> 1.0'
|
46
50
|
|
47
|
-
s.add_runtime_dependency 'metasploit-concern', '0.4.0'
|
48
|
-
s.add_runtime_dependency 'metasploit-model', '~> 0.29.0'
|
49
|
-
s.add_runtime_dependency 'railties', '< 4.0.0'
|
50
|
-
|
51
51
|
# arel-helpers: Useful tools to help construct database queries with ActiveRecord and Arel.
|
52
52
|
s.add_runtime_dependency 'arel-helpers'
|
53
53
|
|
54
|
+
# Fixes a problem with arel not being able to visit IPAddr nodes
|
55
|
+
s.add_runtime_dependency 'postgres_ext'
|
56
|
+
|
54
57
|
if RUBY_PLATFORM =~ /java/
|
55
58
|
# markdown formatting for yard
|
56
59
|
s.add_development_dependency 'kramdown'
|