metasploit_data_models 0.6.14 → 0.6.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzJhNmVjNmY1YjY0YzFjMjYzZmUwN2QyZDFhYjI2YWFlODE4YTZkMQ==
5
+ data.tar.gz: !binary |-
6
+ ZWQ0MGQ2OGUwODEyNDE0NzU3NGJiZDMxOTVhMjlmM2NkNzNjOWVlYw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ODY2YzljMzI4N2RhZjg2M2FhMDBlMWNkZjY0ZjBjMjkxMzUxNTVmMDkyNzdi
10
+ NzE1Y2MzNjAzNGM4OTA3YjNlY2ExZmYzYWY4ODZkNWU2YzU5ZTJhMTYyNzg5
11
+ NjhiMjRhZDlhMjc3OGFhMGZhYjNiYjViOGE0NjljMmFjOTJmZTI=
12
+ data.tar.gz: !binary |-
13
+ MDUwZmZhY2NhZGVlMzk2NTRmM2MyOTgxZGJmNTJlN2Q4NDc0MWQ0MWYwZGZm
14
+ MGFkZjY4ZmUxNTE5NmQ0N2Q2Y2JlOGQ2NjdmZDk0Y2FiYzAxOGZmYmFlODUz
15
+ MWVlZDdmMzhlOTczNGEzNDE2MzI2ZGY5MjUzZGI0ZTg1ODYxMGE=
@@ -16,6 +16,9 @@ class Mdm::Cred < ActiveRecord::Base
16
16
  #
17
17
  belongs_to :service, :class_name => "Mdm::Service"
18
18
 
19
+ after_create :increment_host_counter_cache
20
+ after_destroy :decrement_host_counter_cache
21
+
19
22
  def ptype_human
20
23
  humanized = PTYPES.select do |k, v|
21
24
  v == ptype
@@ -77,4 +80,14 @@ class Mdm::Cred < ActiveRecord::Base
77
80
  end
78
81
 
79
82
  ActiveSupport.run_load_hooks(:mdm_cred, self)
83
+
84
+ private
85
+
86
+ def decrement_host_counter_cache
87
+ Mdm::Host.decrement_counter("cred_count", self.service.host_id)
88
+ end
89
+
90
+ def increment_host_counter_cache
91
+ Mdm::Host.increment_counter("cred_count", self.service.host_id)
92
+ end
80
93
  end
@@ -0,0 +1,19 @@
1
+ class AddCredsCounterCache < ActiveRecord::Migration
2
+ def up
3
+ add_column :hosts, :cred_count, :integer, :default => 0
4
+ Mdm::Host.reset_column_information
5
+ # Set initial counts
6
+ cred_service_ids = Set.new
7
+ Mdm::Cred.all.each {|c| cred_service_ids << c.service_id}
8
+ cred_service_ids.each do |service_id|
9
+ #Mdm::Host.reset_counters(Mdm::Service.find(service_id).host.id, :creds)
10
+ host = Mdm::Service.find(service_id).host
11
+ host.cred_count = host.creds.count
12
+ host.save
13
+ end
14
+ end
15
+
16
+ def down
17
+ remove_column :hosts, :cred_count
18
+ end
19
+ end
@@ -4,5 +4,5 @@ module MetasploitDataModels
4
4
  # metasploit-framework/data/sql/migrate to db/migrate in this project, not all models have specs that verify the
5
5
  # migrations (with have_db_column and have_db_index) and certain models may not be shared between metasploit-framework
6
6
  # and pro, so models may be removed in the future. Because of the unstable API the version should remain below 1.0.0
7
- VERSION = '0.6.14'
7
+ VERSION = '0.6.16'
8
8
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.14
5
- prerelease:
4
+ version: 0.6.16
6
5
  platform: ruby
7
6
  authors:
8
7
  - Luke Imhoff
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-04-11 00:00:00.000000000 Z
12
+ date: 2013-04-26 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rake
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :development
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: redcarpet
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: yard
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ! '>='
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ! '>='
61
54
  - !ruby/object:Gem::Version
@@ -63,7 +56,6 @@ dependencies:
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: pry
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
60
  - - ! '>='
69
61
  - !ruby/object:Gem::Version
@@ -71,7 +63,6 @@ dependencies:
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
67
  - - ! '>='
77
68
  - !ruby/object:Gem::Version
@@ -79,7 +70,6 @@ dependencies:
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: activerecord
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
74
  - - ! '>='
85
75
  - !ruby/object:Gem::Version
@@ -87,7 +77,6 @@ dependencies:
87
77
  type: :runtime
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
81
  - - ! '>='
93
82
  - !ruby/object:Gem::Version
@@ -95,7 +84,6 @@ dependencies:
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: activesupport
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
88
  - - ! '>='
101
89
  - !ruby/object:Gem::Version
@@ -103,7 +91,6 @@ dependencies:
103
91
  type: :runtime
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
95
  - - ! '>='
109
96
  - !ruby/object:Gem::Version
@@ -111,7 +98,6 @@ dependencies:
111
98
  - !ruby/object:Gem::Dependency
112
99
  name: pg
113
100
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
101
  requirements:
116
102
  - - ! '>='
117
103
  - !ruby/object:Gem::Version
@@ -119,7 +105,6 @@ dependencies:
119
105
  type: :runtime
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
108
  requirements:
124
109
  - - ! '>='
125
110
  - !ruby/object:Gem::Version
@@ -275,6 +260,7 @@ files:
275
260
  - db/migrate/20120625000008_add_fail_message.rb
276
261
  - db/migrate/20120718202805_add_owner_and_payload_to_web_vulns.rb
277
262
  - db/migrate/20130228214900_change_required_columns_to_null_false_in_web_vulns.rb
263
+ - db/migrate/20130423211152_add_creds_counter_cache.rb
278
264
  - lib/mdm.rb
279
265
  - lib/mdm/host/operating_system_normalization.rb
280
266
  - lib/metasploit_data_models.rb
@@ -346,33 +332,26 @@ files:
346
332
  - spec/spec_helper.rb
347
333
  homepage: ''
348
334
  licenses: []
335
+ metadata: {}
349
336
  post_install_message:
350
337
  rdoc_options: []
351
338
  require_paths:
352
339
  - lib
353
340
  required_ruby_version: !ruby/object:Gem::Requirement
354
- none: false
355
341
  requirements:
356
342
  - - ! '>='
357
343
  - !ruby/object:Gem::Version
358
344
  version: '0'
359
- segments:
360
- - 0
361
- hash: 1872587986820574553
362
345
  required_rubygems_version: !ruby/object:Gem::Requirement
363
- none: false
364
346
  requirements:
365
347
  - - ! '>='
366
348
  - !ruby/object:Gem::Version
367
349
  version: '0'
368
- segments:
369
- - 0
370
- hash: 1872587986820574553
371
350
  requirements: []
372
351
  rubyforge_project:
373
- rubygems_version: 1.8.24
352
+ rubygems_version: 2.0.3
374
353
  signing_key:
375
- specification_version: 3
354
+ specification_version: 4
376
355
  summary: Database code for MSF and Metasploit Pro
377
356
  test_files:
378
357
  - spec/app/models/mdm/module_action_spec.rb