metasploit_data_models 1.2.2 → 1.2.3

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
  SHA1:
3
- metadata.gz: 4025dff28108e5c8947f6b6a3cf804d1a229fc2b
4
- data.tar.gz: b628f7bfbb605dcf70be7ecf245e2398cb20f338
3
+ metadata.gz: 83f4eb115aa26dd700383c116a5ec6b375366ef1
4
+ data.tar.gz: d56bf1bdb8501bdfcd5294c04ae6095a5e4f1dfe
5
5
  SHA512:
6
- metadata.gz: b325373dd94bdde2d38d2389f9975670d8867bc9ccc922f047c5efebc054dcf3451c88bff8d2f8bf1486adc196da70c30c11121d105694448fa3ba5c0d274c70
7
- data.tar.gz: 87cd515fbfd12d241290d56941cc20983a959fd113b71b7162af6cb5d5eec2a6d9da05e89013ff70476c1d1991e29dbb15f520f951dcca04f5a965a0ac39caca
6
+ metadata.gz: fd5314538018c26d8ff05e94904968fa84a54f78c1f5156c5394f69a9b00083eb43d37398e1569576cd9dc62f3b0aac7a7ed5f44b69518b0265d773c37ceb460
7
+ data.tar.gz: ce758ea76068e7078ec25d8193ab6e1558a8f3ba4b1cb1e5f20e5f1add2e1fda516cb759b061c51d942a533be8796513bceb0f9d1543295e5eff7657d54e9029
@@ -235,15 +235,12 @@ class Mdm::Workspace < ActiveRecord::Base
235
235
  #
236
236
  # @return [ActiveRecord::Relation<Mdm::WebForm>]
237
237
  def web_forms
238
- query = <<-EOQ
239
- SELECT DISTINCT web_forms.*
240
- FROM hosts, services, web_sites, web_forms
241
- WHERE hosts.workspace_id = #{id} AND
242
- services.host_id = hosts.id AND
243
- web_sites.service_id = services.id AND
244
- web_forms.web_site_id = web_sites.id
245
- EOQ
246
- Mdm::WebForm.find_by_sql(query)
238
+ Mdm::WebForm.joins(
239
+ Mdm::WebForm.join_association(:web_site),
240
+ Mdm::WebSite.join_association(:service),
241
+ Mdm::Service.join_association(:host),
242
+ Mdm::Host.join_association(:workspace)
243
+ ).where(Mdm::Workspace[:id].eq(id)).uniq
247
244
  end
248
245
 
249
246
 
@@ -251,59 +248,43 @@ class Mdm::Workspace < ActiveRecord::Base
251
248
  #
252
249
  # @return [ActiveRecord::Relation<Mdm::WebPage>]
253
250
  def web_pages
254
- query = <<-EOQ
255
- SELECT DISTINCT web_pages.*
256
- FROM hosts, services, web_sites, web_pages
257
- WHERE hosts.workspace_id = #{id} AND
258
- services.host_id = hosts.id AND
259
- web_sites.service_id = services.id AND
260
- web_pages.web_site_id = web_sites.id
261
- EOQ
262
- Mdm::WebPage.find_by_sql(query)
251
+ Mdm::WebPage.joins(
252
+ Mdm::WebPage.join_association(:web_site),
253
+ Mdm::WebSite.join_association(:service),
254
+ Mdm::Service.join_association(:host),
255
+ Mdm::Host.join_association(:workspace)
256
+ ).where(Mdm::Workspace[:id].eq(id)).uniq
263
257
  end
264
258
 
265
259
  # Web sites running on {#services}.
266
260
  #
267
261
  # @return [ActiveRecord::Relation<Mdm::WebSite>]
268
262
  def web_sites
269
- query = <<-EOQ
270
- SELECT DISTINCT web_sites.*
271
- FROM hosts, services, web_sites
272
- WHERE hosts.workspace_id = #{id} AND
273
- services.host_id = hosts.id AND
274
- web_sites.service_id = services.id
275
- EOQ
276
- Mdm::WebSite.find_by_sql(query)
263
+ Mdm::WebSite.joins(
264
+ Mdm::WebSite.join_association(:service),
265
+ Mdm::Service.join_association(:host),
266
+ Mdm::Host.join_association(:workspace)
267
+ ).where(Mdm::Workspace[:id].eq(id)).uniq
268
+
277
269
  end
278
270
 
279
271
  # Web vulnerability found on {#web_sites}.
280
272
  #
281
273
  # @return [ActiveRecord::Relation<Mdm::WebVuln>]
282
274
  def web_vulns
283
- query = <<-EOQ
284
- SELECT DISTINCT web_vulns.*
285
- FROM hosts, services, web_sites, web_vulns
286
- WHERE hosts.workspace_id = #{id} AND
287
- services.host_id = hosts.id AND
288
- web_sites.service_id = services.id AND
289
- web_vulns.web_site_id = web_sites.id
290
- EOQ
291
- Mdm::WebVuln.find_by_sql(query)
275
+ Mdm::WebVuln.joins(
276
+ Mdm::WebVuln.join_association(:web_site),
277
+ Mdm::WebSite.join_association(:service),
278
+ Mdm::Service.join_association(:host),
279
+ Mdm::Host.join_association(:workspace)
280
+ ).where(Mdm::Workspace[:id].eq(id)).uniq
292
281
  end
293
282
 
294
283
  # Web forms on {#web_sites}.
295
284
  #
296
285
  # @return [ActiveRecord::Relation<Mdm::WebForm>]
297
286
  def unique_web_forms
298
- query = <<-EOQ
299
- SELECT DISTINCT web_forms.web_site_id, web_forms.path, web_forms.method, web_forms.query
300
- FROM hosts, services, web_sites, web_forms
301
- WHERE hosts.workspace_id = #{id} AND
302
- services.host_id = hosts.id AND
303
- web_sites.service_id = services.id AND
304
- web_forms.web_site_id = web_sites.id
305
- EOQ
306
- Mdm::WebForm.find_by_sql(query)
287
+ web_forms.select('web_forms.id, web_forms.web_site_id, web_forms.path, web_forms.method, web_forms.query')
307
288
  end
308
289
 
309
290
  # {#unique_web_forms} hosted on `addrs`.
@@ -10,7 +10,7 @@ module MetasploitDataModels
10
10
  # The minor version number, scoped to the {MAJOR} version number.
11
11
  MINOR = 2
12
12
  # The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
13
- PATCH = 2
13
+ PATCH = 3
14
14
 
15
15
  #
16
16
  # Module Methods
@@ -433,8 +433,7 @@ RSpec.describe Mdm::Workspace, type: :model do
433
433
  }
434
434
  end
435
435
 
436
- it 'should return an ActiveRecord:Relation',
437
- :pending => 'https://www.pivotaltracker.com/story/show/43219917' do
436
+ it 'should return an ActiveRecord:Relation' do
438
437
  should be_a ActiveRecord::Relation
439
438
  end
440
439
 
@@ -465,8 +464,7 @@ RSpec.describe Mdm::Workspace, type: :model do
465
464
  web_sites
466
465
  end
467
466
 
468
- it 'should return an ActiveRecord:Relation',
469
- :pending => 'https://www.pivotaltracker.com/story/show/43219917' do
467
+ it 'should return an ActiveRecord:Relation' do
470
468
  should be_a ActiveRecord::Relation
471
469
  end
472
470
 
@@ -507,8 +505,7 @@ RSpec.describe Mdm::Workspace, type: :model do
507
505
  }
508
506
  end
509
507
 
510
- it 'should return an ActiveRecord:Relation',
511
- :pending => 'https://www.pivotaltracker.com/story/show/43219917' do
508
+ it 'should return an ActiveRecord:Relation' do
512
509
  should be_a ActiveRecord::Relation
513
510
  end
514
511
 
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: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Huckins