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 +4 -4
- data/app/models/mdm/workspace.rb +25 -44
- data/lib/metasploit_data_models/version.rb +1 -1
- data/spec/app/models/mdm/workspace_spec.rb +3 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83f4eb115aa26dd700383c116a5ec6b375366ef1
|
4
|
+
data.tar.gz: d56bf1bdb8501bdfcd5294c04ae6095a5e4f1dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd5314538018c26d8ff05e94904968fa84a54f78c1f5156c5394f69a9b00083eb43d37398e1569576cd9dc62f3b0aac7a7ed5f44b69518b0265d773c37ceb460
|
7
|
+
data.tar.gz: ce758ea76068e7078ec25d8193ab6e1558a8f3ba4b1cb1e5f20e5f1add2e1fda516cb759b061c51d942a533be8796513bceb0f9d1543295e5eff7657d54e9029
|
data/app/models/mdm/workspace.rb
CHANGED
@@ -235,15 +235,12 @@ class Mdm::Workspace < ActiveRecord::Base
|
|
235
235
|
#
|
236
236
|
# @return [ActiveRecord::Relation<Mdm::WebForm>]
|
237
237
|
def web_forms
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
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
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
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
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
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
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
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
|
-
|
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`.
|
@@ -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
|
|