metasploit_data_models 0.16.9-java → 0.17.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b731ba1f43bb6169b05a20a13fddfb8586e62d6b
4
- data.tar.gz: d13f90eb96eafeabf6f126d179fa4ab26c1b7e6f
3
+ metadata.gz: 4f4621672c11b8b3879c2e357d8cb6d58bbed881
4
+ data.tar.gz: 98cfa49f629de2306a3fcb0ff56418f20cbf0905
5
5
  SHA512:
6
- metadata.gz: 8389ece1faa0ad00529d58f59128fcffbb61bff3abef409dc83151bd23dcbe93db068ba406e1aff43bc8cbfe5eb86fda147968be87bf05f3d65710df0b9db674
7
- data.tar.gz: ad0da45acc8baa77cb1a89497bef350ca78301211a4685cdc1be9de709d2676523d77c432ffb9336eff4f1db1375488bfaa8c935ff0fa54bc743cc465e6ce323
6
+ metadata.gz: bc546d304ea93aca26a4bcd8a4d4f66d4c4089f5ed5699e32a39988a4e90e29c186e46774d3cea29f1f5ab3470fe4a935fa1797f2347b5c3ed9f191122bd0d5c
7
+ data.tar.gz: ac654d836d39728947e6a4fb02fe6914e8f404a58b9070db06eeb55369ddcfb9436ab9d9e9942df43b7744a9556a6e434b31ce8186b5ff22ca9b6939d89f86f8
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.travis.yml CHANGED
@@ -4,4 +4,7 @@ before_script:
4
4
  language: ruby
5
5
  rvm:
6
6
  - '1.9.3'
7
+ - '2.0'
8
+ - '2.1'
7
9
  - 'jruby-19mode'
10
+ - 'rbx-2.2'
data/Gemfile CHANGED
@@ -19,6 +19,8 @@ group :development, :test do
19
19
  end
20
20
 
21
21
  group :test do
22
+ # Upload coverage reports to coveralls.io
23
+ gem 'coveralls', require: false
22
24
  # In a full rails project, factory_girl_rails would be in both the :development, and :test group, but since we only
23
25
  # want rails in :test, factory_girl_rails must also only be in :test.
24
26
  # add matchers from shoulda, such as validates_presence_of, which are useful for testing validations
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #MetasploitDataModels [![Build Status](https://travis-ci.org/rapid7/metasploit_data_models.png)](https://travis-ci.org/rapid7/metasploit_data_models)
1
+ #MetasploitDataModels [![Build Status](https://travis-ci.org/rapid7/metasploit_data_models.png)](https://travis-ci.org/rapid7/metasploit_data_models)[![Code Climate](https://codeclimate.com/github/rapid7/metasploit_data_models.png)](https://codeclimate.com/github/rapid7/metasploit_data_models)[![Coverage Status](https://coveralls.io/repos/rapid7/metasploit_data_models/badge.png)](https://coveralls.io/r/rapid7/metasploit_data_models)[![Dependency Status](https://gemnasium.com/rapid7/metasploit_data_models.png)](https://gemnasium.com/rapid7/metasploit_data_models)[![Gem Version](https://badge.fury.io/rb/metasploit_data_models.png)](http://badge.fury.io/rb/metasploit_data_models)
2
2
 
3
3
  The database layer for Metasploit
4
4
 
@@ -64,8 +64,6 @@ class Mdm::Task < ActiveRecord::Base
64
64
  has_many :sessions, :through => :task_sessions, :class_name => 'Mdm::Session'
65
65
 
66
66
 
67
- has_many :reports, :class_name => 'Mdm::Report'
68
-
69
67
  #
70
68
  # Scopes
71
69
  #
@@ -21,8 +21,6 @@ class Mdm::Workspace < ActiveRecord::Base
21
21
  has_many :listeners, :dependent => :destroy, :class_name => 'Mdm::Listener'
22
22
  has_many :notes, :class_name => 'Mdm::Note'
23
23
  belongs_to :owner, :class_name => 'Mdm::User', :foreign_key => 'owner_id'
24
- has_many :report_templates, :dependent => :destroy, :class_name => 'Mdm::ReportTemplate'
25
- has_many :reports, :dependent => :destroy, :class_name => 'Mdm::Report'
26
24
  has_many :tasks, :dependent => :destroy, :class_name => 'Mdm::Task', :order => 'created_at DESC'
27
25
  has_and_belongs_to_many :users, :join_table => 'workspace_members', :uniq => true, :class_name => 'Mdm::User'
28
26
 
@@ -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.16.9'
7
+ VERSION = '0.17.0'
8
8
  end
@@ -55,7 +55,6 @@ describe Mdm::Task do
55
55
  it { should have_many(:task_services).class_name('Mdm::TaskService').dependent(:destroy) }
56
56
  it { should have_many(:services).class_name('Mdm::Service').through(:task_services) }
57
57
  it { should belong_to(:workspace).class_name('Mdm::Workspace') }
58
- it { should have_many(:reports).class_name('Mdm::Report')}
59
58
 
60
59
  end
61
60
 
@@ -20,8 +20,6 @@ describe Mdm::Workspace do
20
20
  it 'should successfully destroy the object and dependent objects' do
21
21
  workspace = FactoryGirl.create(:mdm_workspace)
22
22
  listener = FactoryGirl.create(:mdm_listener, :workspace => workspace)
23
- report_template = FactoryGirl.create(:mdm_report_template, :workspace => workspace)
24
- report = FactoryGirl.create(:mdm_report, :workspace => workspace)
25
23
  task = FactoryGirl.create(:mdm_task, :workspace => workspace)
26
24
 
27
25
  expect {
@@ -33,12 +31,6 @@ describe Mdm::Workspace do
33
31
  expect {
34
32
  listener.reload
35
33
  }.to raise_error(ActiveRecord::RecordNotFound)
36
- expect {
37
- report_template.reload
38
- }.to raise_error(ActiveRecord::RecordNotFound)
39
- expect {
40
- report.reload
41
- }.to raise_error(ActiveRecord::RecordNotFound)
42
34
  expect {
43
35
  task.reload
44
36
  }.to raise_error(ActiveRecord::RecordNotFound)
@@ -55,8 +47,6 @@ describe Mdm::Workspace do
55
47
  it { should have_many(:loots).class_name('Mdm::Loot').through(:hosts) }
56
48
  it { should have_many(:notes).class_name('Mdm::Note') }
57
49
  it { should belong_to(:owner).class_name('Mdm::User').with_foreign_key('owner_id') }
58
- it { should have_many(:report_templates).class_name('Mdm::ReportTemplate').dependent(:destroy) }
59
- it { should have_many(:reports).class_name('Mdm::Report').dependent(:destroy) }
60
50
  it { should have_many(:services).class_name('Mdm::Service').through(:hosts).with_foreign_key('service_id') }
61
51
  it { should have_many(:sessions).class_name('Mdm::Session').through(:hosts) }
62
52
  it { should have_many(:tasks).class_name('Mdm::Task').dependent(:destroy).order('created_at DESC') }
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,17 @@ Bundler.setup(:default, :test)
8
8
  # Require simplecov before loading ..dummy/config/environment.rb because it will cause metasploit_data_models/lib to
9
9
  # be loaded, which would result in Coverage not recording hits for any of the files.
10
10
  require 'simplecov'
11
+ require 'coveralls'
12
+
13
+ if ENV['TRAVIS'] == 'true'
14
+ # don't generate local report as it is inaccessible on travis-ci, which is why coveralls is being used.
15
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
16
+ else
17
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
18
+ # either generate the local report
19
+ SimpleCov::Formatter::HTMLFormatter
20
+ ]
21
+ end
11
22
 
12
23
  require File.expand_path('../dummy/config/environment.rb', __FILE__)
13
24
  require 'rspec/rails'
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: 0.16.9
4
+ version: 0.17.0
5
5
  platform: java
6
6
  authors:
7
7
  - Samuel Huckins
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-12-23 00:00:00.000000000 Z
14
+ date: 2014-03-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -136,6 +136,7 @@ executables:
136
136
  extensions: []
137
137
  extra_rdoc_files: []
138
138
  files:
139
+ - .coveralls.yml
139
140
  - .gitignore
140
141
  - .rspec
141
142
  - .simplecov
@@ -170,8 +171,6 @@ files:
170
171
  - app/models/mdm/note.rb
171
172
  - app/models/mdm/profile.rb
172
173
  - app/models/mdm/ref.rb
173
- - app/models/mdm/report.rb
174
- - app/models/mdm/report_template.rb
175
174
  - app/models/mdm/route.rb
176
175
  - app/models/mdm/service.rb
177
176
  - app/models/mdm/session.rb
@@ -341,8 +340,6 @@ files:
341
340
  - spec/app/models/mdm/nexpose_console_spec.rb
342
341
  - spec/app/models/mdm/note_spec.rb
343
342
  - spec/app/models/mdm/ref_spec.rb
344
- - spec/app/models/mdm/report_spec.rb
345
- - spec/app/models/mdm/report_template_spec.rb
346
343
  - spec/app/models/mdm/route_spec.rb
347
344
  - spec/app/models/mdm/service_spec.rb
348
345
  - spec/app/models/mdm/session_event_spec.rb
@@ -424,8 +421,6 @@ files:
424
421
  - spec/factories/mdm/nexpose_consoles.rb
425
422
  - spec/factories/mdm/notes.rb
426
423
  - spec/factories/mdm/refs.rb
427
- - spec/factories/mdm/report_templates.rb
428
- - spec/factories/mdm/reports.rb
429
424
  - spec/factories/mdm/routes.rb
430
425
  - spec/factories/mdm/services.rb
431
426
  - spec/factories/mdm/session_events.rb
@@ -495,8 +490,6 @@ test_files:
495
490
  - spec/app/models/mdm/nexpose_console_spec.rb
496
491
  - spec/app/models/mdm/note_spec.rb
497
492
  - spec/app/models/mdm/ref_spec.rb
498
- - spec/app/models/mdm/report_spec.rb
499
- - spec/app/models/mdm/report_template_spec.rb
500
493
  - spec/app/models/mdm/route_spec.rb
501
494
  - spec/app/models/mdm/service_spec.rb
502
495
  - spec/app/models/mdm/session_event_spec.rb
@@ -578,8 +571,6 @@ test_files:
578
571
  - spec/factories/mdm/nexpose_consoles.rb
579
572
  - spec/factories/mdm/notes.rb
580
573
  - spec/factories/mdm/refs.rb
581
- - spec/factories/mdm/report_templates.rb
582
- - spec/factories/mdm/reports.rb
583
574
  - spec/factories/mdm/routes.rb
584
575
  - spec/factories/mdm/services.rb
585
576
  - spec/factories/mdm/session_events.rb
@@ -1,50 +0,0 @@
1
- class Mdm::Report < ActiveRecord::Base
2
- #
3
- # Callbacks
4
- #
5
-
6
- before_destroy :delete_file
7
-
8
- #
9
- # Relations
10
- #
11
-
12
- belongs_to :workspace, :class_name => 'Mdm::Workspace'
13
- belongs_to :task, :class_name => 'Mdm::Task'
14
- #
15
- # Scopes
16
- #
17
-
18
- scope :flagged, where('reports.downloaded_at is NULL')
19
-
20
- #
21
- # Serializations
22
- #
23
-
24
- serialize :options, MetasploitDataModels::Base64Serializer.new
25
-
26
- #
27
- # Validations
28
- #
29
-
30
- validates :name,
31
- :format => {
32
- :allow_blank => true,
33
- :message => "name must consist of A-Z, 0-9, space, dot, underscore, or dash",
34
- :with => /^[A-Za-z0-9\x20\x2e\x2d\x5f\x5c]+$/
35
- }
36
-
37
- private
38
-
39
- def delete_file
40
- c = Pro::Client.get rescue nil
41
- if c
42
- c.report_delete_file(self[:id])
43
- else
44
- ::File.unlink(self.path) rescue nil
45
- end
46
- end
47
-
48
- ActiveSupport.run_load_hooks(:mdm_report, self)
49
- end
50
-
@@ -1,27 +0,0 @@
1
- class Mdm::ReportTemplate < ActiveRecord::Base
2
- #
3
- # Callbacks
4
- #
5
-
6
- before_destroy :delete_file
7
-
8
- #
9
- # Relations
10
- #
11
-
12
- belongs_to :workspace, :class_name => 'Mdm::Workspace'
13
-
14
- private
15
-
16
- def delete_file
17
- c = Pro::Client.get rescue nil
18
- if c
19
- c.report_template_delete_file(self[:id])
20
- else
21
- ::File.unlink(self.path) rescue nil
22
- end
23
- end
24
-
25
- ActiveSupport.run_load_hooks(:mdm_report_template, self)
26
- end
27
-
@@ -1,104 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::Report do
4
-
5
- context 'associations' do
6
- it { should belong_to(:workspace).class_name('Mdm::Workspace') }
7
- it { should belong_to(:task).class_name('Mdm::Task') }
8
- end
9
-
10
- context 'validations' do
11
- context 'name' do
12
- it 'may be blank' do
13
- blank_name = FactoryGirl.build(:mdm_report, :name => '')
14
- blank_name.should be_valid
15
- end
16
-
17
- it 'may contain A-Z, 0-9, space, dot, underscore, or dash' do
18
- named_report = FactoryGirl.build(:mdm_report, :name => 'A1 B2.C_3-D')
19
- named_report.should be_valid
20
- end
21
-
22
- it 'may not contain other characters' do
23
- invalid_name = FactoryGirl.build(:mdm_report, :name => 'A/1')
24
- invalid_name.should_not be_valid
25
- invalid_name.errors[:name].should include('name must consist of A-Z, 0-9, space, dot, underscore, or dash')
26
- invalid_name = FactoryGirl.build(:mdm_report, :name => '#A1')
27
- invalid_name.should_not be_valid
28
- invalid_name.errors[:name].should include('name must consist of A-Z, 0-9, space, dot, underscore, or dash')
29
- invalid_name = FactoryGirl.build(:mdm_report, :name => 'A,1')
30
- invalid_name.should_not be_valid
31
- invalid_name.errors[:name].should include('name must consist of A-Z, 0-9, space, dot, underscore, or dash')
32
- invalid_name = FactoryGirl.build(:mdm_report, :name => 'A;1')
33
- invalid_name.should_not be_valid
34
- invalid_name.errors[:name].should include('name must consist of A-Z, 0-9, space, dot, underscore, or dash')
35
- invalid_name = FactoryGirl.build(:mdm_report, :name => "A' or '1'='1'")
36
- invalid_name.should_not be_valid
37
- invalid_name.errors[:name].should include('name must consist of A-Z, 0-9, space, dot, underscore, or dash')
38
- end
39
- end
40
- end
41
-
42
- context 'scopes' do
43
- context 'flagged' do
44
- it 'should return un-downlaoded reports' do
45
- flagged_report = FactoryGirl.create(:mdm_report)
46
- Mdm::Report.flagged.should include(flagged_report)
47
- end
48
-
49
- it 'should not return reports that have been downloaded' do
50
- downlaoded_report = FactoryGirl.create(:mdm_report, :downloaded_at => Time.now)
51
- Mdm::Report.flagged.should_not include(downlaoded_report)
52
- end
53
- end
54
- end
55
-
56
- context 'callbacks' do
57
- context 'before_destroy' do
58
- it 'should call #delete_file' do
59
- myreport = FactoryGirl.create(:mdm_report)
60
- myreport.should_receive(:delete_file)
61
- myreport.destroy
62
- end
63
- end
64
- end
65
-
66
- context 'factory' do
67
- it 'should be valid' do
68
- report = FactoryGirl.build(:mdm_report)
69
- report.should be_valid
70
- end
71
- end
72
-
73
- context '#destroy' do
74
- it 'should successfully destroy the object' do
75
- report = FactoryGirl.create(:mdm_report)
76
- expect {
77
- report.destroy
78
- }.to_not raise_error
79
- expect {
80
- report.reload
81
- }.to raise_error(ActiveRecord::RecordNotFound)
82
- end
83
- end
84
-
85
- context 'database' do
86
-
87
- context 'timestamps'do
88
- it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
89
- it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
90
- it { should have_db_column(:downloaded_at).of_type(:datetime) }
91
- end
92
-
93
- context 'columns' do
94
- it { should have_db_column(:workspace_id).of_type(:integer).with_options(:null => false, :default =>1) }
95
- it { should have_db_column(:created_by).of_type(:string) }
96
- it { should have_db_column(:rtype).of_type(:string) }
97
- it { should have_db_column(:path).of_type(:string) }
98
- it { should have_db_column(:options).of_type(:text) }
99
- it { should have_db_column(:name).of_type(:string) }
100
-
101
- end
102
- end
103
-
104
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::ReportTemplate do
4
-
5
- context 'associations' do
6
- it { should belong_to(:workspace).class_name('Mdm::Workspace') }
7
- end
8
-
9
- context 'callbacks' do
10
- context 'before_destroy' do
11
- it 'should call #delete_file' do
12
- report_template = FactoryGirl.create(:mdm_report_template)
13
- report_template.should_receive(:delete_file)
14
- report_template.destroy
15
- end
16
- end
17
- end
18
-
19
- context 'factory' do
20
- it 'should be valid' do
21
- report_template = FactoryGirl.build(:mdm_report_template)
22
- report_template.should be_valid
23
- end
24
- end
25
-
26
- context '#destroy' do
27
- it 'should successfully destroy the object' do
28
- report_template = FactoryGirl.create(:mdm_report_template)
29
- expect {
30
- report_template.destroy
31
- }.to_not raise_error
32
- expect {
33
- report_template.reload
34
- }.to raise_error(ActiveRecord::RecordNotFound)
35
- end
36
- end
37
-
38
- context 'database' do
39
-
40
- context 'timestamps'do
41
- it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
42
- it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
43
- end
44
-
45
- context 'columns' do
46
- it { should have_db_column(:workspace_id).of_type(:integer).with_options(:null => false, :default =>1) }
47
- it { should have_db_column(:created_by).of_type(:string) }
48
- it { should have_db_column(:path).of_type(:string) }
49
- it { should have_db_column(:name).of_type(:text) }
50
- end
51
- end
52
- end
@@ -1,8 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_report_template, :aliases => [:report_template], :class => Mdm::ReportTemplate do
3
- #
4
- # Associations
5
- #
6
- association :workspace, :factory => :mdm_workspace
7
- end
8
- end
@@ -1,13 +0,0 @@
1
- FactoryGirl.define do
2
- factory :mdm_report, :aliases => [:report], :class => Mdm::Report do
3
- #
4
- # Associations
5
- #
6
- association :workspace, :factory => :mdm_workspace
7
- name{generate :report_name}
8
- end
9
-
10
- sequence :report_name do |n|
11
- "Some Report#{n}"
12
- end
13
- end