metasploit_data_models 0.7.0 → 0.11.2

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.
Files changed (70) hide show
  1. data/.gitignore +3 -0
  2. data/.travis.yml +1 -0
  3. data/app/models/mdm/host.rb +352 -26
  4. data/app/models/mdm/loot.rb +72 -7
  5. data/app/models/mdm/{module_action.rb → module/action.rb} +3 -3
  6. data/app/models/mdm/{module_arch.rb → module/arch.rb} +3 -3
  7. data/app/models/mdm/{module_author.rb → module/author.rb} +3 -3
  8. data/app/models/mdm/module/detail.rb +280 -0
  9. data/app/models/mdm/{module_mixin.rb → module/mixin.rb} +3 -3
  10. data/app/models/mdm/{module_platform.rb → module/platform.rb} +3 -3
  11. data/app/models/mdm/module/ref.rb +48 -0
  12. data/app/models/mdm/{module_target.rb → module/target.rb} +3 -3
  13. data/app/models/mdm/note.rb +61 -6
  14. data/app/models/mdm/ref.rb +39 -1
  15. data/app/models/mdm/service.rb +85 -7
  16. data/app/models/mdm/session.rb +100 -6
  17. data/app/models/mdm/vuln.rb +104 -24
  18. data/db/migrate/20130228214900_change_required_columns_to_null_false_in_web_vulns.rb +1 -17
  19. data/db/migrate/20130412154159_change_foreign_key_in_module_actions.rb +25 -0
  20. data/db/migrate/20130412171844_change_foreign_key_in_module_archs.rb +25 -0
  21. data/db/migrate/20130412173121_change_foreign_key_in_module_authors.rb +25 -0
  22. data/db/migrate/20130412173640_change_foreign_key_in_module_mixins.rb +25 -0
  23. data/db/migrate/20130412174254_change_foreign_key_in_module_platforms.rb +25 -0
  24. data/db/migrate/20130412174719_change_foreign_key_in_module_refs.rb +25 -0
  25. data/db/migrate/20130412175040_change_foreign_key_in_module_targets.rb +25 -0
  26. data/db/migrate/20130430151353_change_required_columns_to_null_false_in_hosts.rb +11 -0
  27. data/db/migrate/20130430162145_enforce_address_uniqueness_in_workspace_in_hosts.rb +23 -0
  28. data/lib/mdm/module.rb +4 -0
  29. data/lib/metasploit_data_models.rb +1 -0
  30. data/lib/metasploit_data_models/change_required_columns_to_null_false.rb +23 -0
  31. data/lib/metasploit_data_models/version.rb +1 -1
  32. data/spec/app/models/mdm/host_spec.rb +411 -0
  33. data/spec/app/models/mdm/host_tag_spec.rb +13 -0
  34. data/spec/app/models/mdm/{module_action_spec.rb → module/action_spec.rb} +6 -6
  35. data/spec/app/models/mdm/{module_arch_spec.rb → module/arch_spec.rb} +6 -6
  36. data/spec/app/models/mdm/{module_author_spec.rb → module/author_spec.rb} +6 -6
  37. data/spec/app/models/mdm/{module_detail_spec.rb → module/detail_spec.rb} +101 -11
  38. data/spec/app/models/mdm/{module_mixin_spec.rb → module/mixin_spec.rb} +6 -6
  39. data/spec/app/models/mdm/{module_platform_spec.rb → module/platform_spec.rb} +6 -6
  40. data/spec/app/models/mdm/module/ref_spec.rb +62 -0
  41. data/spec/app/models/mdm/{module_target_spec.rb → module/target_spec.rb} +6 -6
  42. data/spec/app/models/mdm/ref_spec.rb +62 -0
  43. data/spec/app/models/mdm/tag_spec.rb +13 -0
  44. data/spec/app/models/mdm/vuln_ref_spec.rb +13 -0
  45. data/spec/app/models/mdm/vuln_spec.rb +231 -0
  46. data/spec/dummy/db/schema.rb +20 -20
  47. data/spec/factories/mdm/host_tags.rb +9 -0
  48. data/spec/factories/mdm/hosts.rb +65 -0
  49. data/spec/factories/mdm/module/actions.rb +14 -0
  50. data/spec/factories/mdm/module/archs.rb +14 -0
  51. data/spec/factories/mdm/{module_authors.rb → module/authors.rb} +4 -4
  52. data/spec/factories/mdm/module/details.rb +66 -0
  53. data/spec/factories/mdm/module/mixins.rb +14 -0
  54. data/spec/factories/mdm/module/platforms.rb +14 -0
  55. data/spec/factories/mdm/module/refs.rb +14 -0
  56. data/spec/factories/mdm/{module_targets.rb → module/targets.rb} +3 -3
  57. data/spec/factories/mdm/refs.rb +9 -0
  58. data/spec/factories/mdm/tags.rb +14 -0
  59. data/spec/factories/mdm/vuln_refs.rb +4 -0
  60. data/spec/factories/mdm/vulns.rb +20 -0
  61. metadata +78 -45
  62. data/app/models/mdm/module_detail.rb +0 -59
  63. data/app/models/mdm/module_ref.rb +0 -24
  64. data/spec/app/models/mdm/module_ref_spec.rb +0 -38
  65. data/spec/factories/mdm/module_actions.rb +0 -14
  66. data/spec/factories/mdm/module_archs.rb +0 -14
  67. data/spec/factories/mdm/module_details.rb +0 -9
  68. data/spec/factories/mdm/module_mixins.rb +0 -14
  69. data/spec/factories/mdm/module_platforms.rb +0 -14
  70. data/spec/factories/mdm/module_refs.rb +0 -14
@@ -1,59 +0,0 @@
1
- class Mdm::ModuleDetail < ActiveRecord::Base
2
- self.table_name = 'module_details'
3
-
4
- #
5
- # Associations
6
- #
7
-
8
- has_many :actions, :class_name => 'Mdm::ModuleAction', :dependent => :destroy, :source => :module_action
9
- has_many :archs, :class_name => 'Mdm::ModuleArch', :dependent => :destroy, :source => :module_arch
10
- has_many :authors, :class_name => 'Mdm::ModuleAuthor', :dependent => :destroy, :source => :module_author
11
- has_many :mixins, :class_name => 'Mdm::ModuleMixin', :dependent => :destroy, :source => :module_mixin
12
- has_many :platforms, :class_name => 'Mdm::ModulePlatform', :dependent => :destroy, :source => :module_platform
13
- has_many :refs, :class_name => 'Mdm::ModuleRef', :dependent => :destroy, :source => :module_ref
14
- has_many :targets, :class_name => 'Mdm::ModuleTarget', :dependent => :destroy, :source => :module_target
15
-
16
- #
17
- # Validations
18
- #
19
-
20
- validates :refname, :presence => true
21
-
22
- validates_associated :actions
23
- validates_associated :archs
24
- validates_associated :authors
25
- validates_associated :mixins
26
- validates_associated :platforms
27
- validates_associated :refs
28
- validates_associated :targets
29
-
30
- def add_action(name)
31
- self.actions.build(:name => name).save
32
- end
33
-
34
- def add_arch(name)
35
- self.archs.build(:name => name).save
36
- end
37
-
38
- def add_author(name, email=nil)
39
- self.authors.build(:name => name, :email => email).save
40
- end
41
-
42
- def add_mixin(name)
43
- self.mixins.build(:name => name).save
44
- end
45
-
46
- def add_platform(name)
47
- self.platforms.build(:name => name).save
48
- end
49
-
50
- def add_ref(name)
51
- self.refs.build(:name => name).save
52
- end
53
-
54
- def add_target(index, name)
55
- self.targets.build(:index => index, :name => name).save
56
- end
57
-
58
- ActiveSupport.run_load_hooks(:mdm_module_detail, self)
59
- end
@@ -1,24 +0,0 @@
1
- class Mdm::ModuleRef < ActiveRecord::Base
2
- self.table_name = 'module_refs'
3
-
4
- #
5
- # Associations
6
- #
7
-
8
- belongs_to :module_detail, :class_name => 'Mdm::ModuleDetail'
9
-
10
- #
11
- # Mass Assignment Security
12
- #
13
-
14
- attr_accessible :name
15
-
16
- #
17
- # Validations
18
- #
19
-
20
- validates :module_detail, :presence => true
21
- validates :name, :presence => true
22
-
23
- ActiveSupport.run_load_hooks(:mdm_module_ref, self)
24
- end
@@ -1,38 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::ModuleRef do
4
- context 'associations' do
5
- it { should belong_to(:module_detail) }
6
- end
7
-
8
- context 'database' do
9
- context 'columns' do
10
- it { should have_db_column(:module_detail_id).of_type(:integer) }
11
- it { should have_db_column(:name) }
12
- end
13
-
14
- context 'indices' do
15
- it { should have_db_column(:module_detail_id) }
16
- end
17
- end
18
-
19
- context 'factories' do
20
- context 'mdm_module_ref' do
21
- subject(:mdm_module_ref) do
22
- FactoryGirl.build :mdm_module_ref
23
- end
24
-
25
- it { should be_valid }
26
- end
27
- end
28
-
29
- context 'mass assignment security' do
30
- it { should_not allow_mass_assignment_of(:module_detail_id) }
31
- it { should allow_mass_assignment_of(:name) }
32
- end
33
-
34
- context 'validations' do
35
- it { should validate_presence_of(:module_detail) }
36
- it { should validate_presence_of(:name) }
37
- end
38
- end
@@ -1,14 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_module_action, :class => Mdm::ModuleAction do
3
- name { generate :mdm_module_action_name }
4
-
5
- #
6
- # Associations
7
- #
8
- association :module_detail, :factory => :mdm_module_detail
9
- end
10
-
11
- sequence :mdm_module_action_name do |n|
12
- "Mdm::ModuleAction#name #{n}"
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_module_arch, :class => Mdm::ModuleArch do
3
- name { generate :mdm_module_arch_name }
4
-
5
- #
6
- # Associations
7
- #
8
- association :module_detail, :factory => :mdm_module_detail
9
- end
10
-
11
- sequence :mdm_module_arch_name do |n|
12
- "Mdm::ModuleArch#name #{n}"
13
- end
14
- end
@@ -1,9 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_module_detail, :class => Mdm::ModuleDetail do
3
- refname { generate :mdm_module_detail_refname }
4
- end
5
-
6
- sequence :mdm_module_detail_refname do |n|
7
- "module/ref/name#{n}"
8
- end
9
- end
@@ -1,14 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_module_mixin, :class => Mdm::ModuleMixin do
3
- name { generate :mdm_module_mixin_name }
4
-
5
- #
6
- # Associations
7
- #
8
- association :module_detail, :factory => :mdm_module_detail
9
- end
10
-
11
- sequence :mdm_module_mixin_name do |n|
12
- "Mdm::ModuleMixin#name #{n}"
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_module_platform, :class => Mdm::ModulePlatform do
3
- name { generate :mdm_module_platform_name }
4
-
5
- #
6
- # Associations
7
- #
8
- association :module_detail, :factory => :mdm_module_detail
9
- end
10
-
11
- sequence :mdm_module_platform_name do |n|
12
- "Mdm::ModulePlatform#name #{n}"
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_module_ref, :class => Mdm::ModuleRef do
3
- name { generate :mdm_module_ref_name }
4
-
5
- #
6
- # Associations
7
- #
8
- association :module_detail, :factory => :mdm_module_detail
9
- end
10
-
11
- sequence :mdm_module_ref_name do |n|
12
- "Mdm::ModuleRef#name #{n}"
13
- end
14
- end