metasploit_data_models 0.22.8-java → 0.23.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: 3971ad37e6363b3cfbbae51e6d31662d6f806a6e
4
- data.tar.gz: 75691a38b072d49ed8afdbcce841427429910fdf
3
+ metadata.gz: 40af8814f893342a2de8b24726c1b715ec48417b
4
+ data.tar.gz: 01def61e27759816405723a389ec4dd46add19cc
5
5
  SHA512:
6
- metadata.gz: 21c4b74eab36b7cedf5cfe60fdb0d9e8bc62026d99581d8004af2f9891f98b2848c27c67c042a77e77577ea32a56f772632221af6fbfafb68238d31b484592fb
7
- data.tar.gz: 7afd33ce92de7128a8f31b8fcf81fdf310a9b6564b81d89f29ec511743ecae4545bbba7dadd1898d9052f5c9140f2c51f1f5f59a6703ecc064bfd599e2809b5e
6
+ metadata.gz: f6140d7a31e8c68ebcf2623de48e4f43f5ba159a0152f96e2969adfa7bcb78222fa6254708067ef721eb8ee9a25740a940ed6f5693906c1b1f9754dc2e41c609
7
+ data.tar.gz: 8a67027055c22b9516335714e1d43985af3079c2c4f2cedb02dbd59bd67c77d4339aedc41198117e7eb64a931c8b452eff2ba77d9ea1e9e87d83117d8275dc2a
data/.travis.yml CHANGED
@@ -4,8 +4,6 @@ before_script:
4
4
  cache: bundler
5
5
  language: ruby
6
6
  rvm:
7
- - 1.9.3
8
- - 2.0
9
7
  - 2.1
10
8
  - jruby-1.7.17
11
9
  sudo: false
data/CONTRIBUTING.md CHANGED
@@ -148,7 +148,7 @@ If your changes are incompatible with the previous branch's API, then increment
148
148
  - [ ] `rake release`
149
149
 
150
150
  ## MRI Ruby
151
- - [ ] `rvm use ruby-1.9.3@metasploit_data_models`
151
+ - [ ] `rvm use ruby-2.1@metasploit_data_models`
152
152
  - [ ] `rm Gemfile.lock`
153
153
  - [ ] `bundle install`
154
154
  - [ ] `rake release`
@@ -217,6 +217,14 @@ class Mdm::Service < ActiveRecord::Base
217
217
  numericality: {
218
218
  only_integer: true
219
219
  }
220
+ validates :port,
221
+ uniqueness: {
222
+ message: 'already exists on this host and protocol',
223
+ scope: [
224
+ :host_id,
225
+ :proto
226
+ ]
227
+ }
220
228
  validates :proto,
221
229
  inclusion: {
222
230
  in: PROTOS
@@ -0,0 +1,12 @@
1
+ class RemoveDuplicateServices2 < ActiveRecord::Migration
2
+ def change
3
+ duplicate_keys = Mdm::Service.count(group: [:host_id, :port, :proto]).select { |k,v| v >1 }.keys
4
+ duplicate_keys.each do |keys|
5
+ duplicate_services = Mdm::Service.where(host_id: keys[0], port: keys[1], proto: keys[2]).order(:created_at)
6
+ duplicate_services.pop
7
+ duplicate_services.each(&:destroy)
8
+ end
9
+
10
+ add_index :services, [:host_id, :port, :proto], unique: true
11
+ end
12
+ end
@@ -4,9 +4,9 @@ module MetasploitDataModels
4
4
  # The major version number.
5
5
  MAJOR = 0
6
6
  # The minor version number, scoped to the {MAJOR} version number.
7
- MINOR = 22
7
+ MINOR = 23
8
8
  # The patch number, scoped to the {MINOR} version number.
9
- PATCH = 8
9
+ PATCH = 0
10
10
 
11
11
  # The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the `PRERELEASE` in the
12
12
  # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
@@ -26,6 +26,8 @@ Gem::Specification.new do |s|
26
26
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
27
  s.require_paths = ['lib']
28
28
 
29
+ s.required_ruby_version = '>= 2.1'
30
+
29
31
  # ---- Dependencies ----
30
32
  s.add_development_dependency 'rake'
31
33
 
@@ -154,5 +154,13 @@ describe Mdm::Service do
154
154
  it { should validate_numericality_of(:port).only_integer }
155
155
  it { should ensure_inclusion_of(:proto).in_array(described_class::PROTOS) }
156
156
 
157
+ context 'when a duplicate service already exists' do
158
+ let(:service1) { FactoryGirl.create(:mdm_service)}
159
+ let(:service2) { FactoryGirl.build(:mdm_service, :host => service1.host, :port => service1.port, :proto => service1.proto )}
160
+ it 'is not valid' do
161
+ expect(service2).to_not be_valid
162
+ end
163
+ end
164
+
157
165
  end
158
166
  end
@@ -2686,6 +2686,13 @@ CREATE INDEX index_notes_on_ntype ON notes USING btree (ntype);
2686
2686
  CREATE INDEX index_refs_on_name ON refs USING btree (name);
2687
2687
 
2688
2688
 
2689
+ --
2690
+ -- Name: index_services_on_host_id_and_port_and_proto; Type: INDEX; Schema: public; Owner: -; Tablespace:
2691
+ --
2692
+
2693
+ CREATE UNIQUE INDEX index_services_on_host_id_and_port_and_proto ON services USING btree (host_id, port, proto);
2694
+
2695
+
2689
2696
  --
2690
2697
  -- Name: index_services_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
2691
2698
  --
@@ -2991,6 +2998,8 @@ INSERT INTO schema_migrations (version) VALUES ('20150112203945');
2991
2998
 
2992
2999
  INSERT INTO schema_migrations (version) VALUES ('20150205192745');
2993
3000
 
3001
+ INSERT INTO schema_migrations (version) VALUES ('20150212214222');
3002
+
2994
3003
  INSERT INTO schema_migrations (version) VALUES ('21');
2995
3004
 
2996
3005
  INSERT INTO schema_migrations (version) VALUES ('22');
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.22.8
4
+ version: 0.23.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: 2015-02-09 00:00:00.000000000 Z
14
+ date: 2015-02-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -408,6 +408,7 @@ files:
408
408
  - db/migrate/20140905031549_add_detected_arch_to_host.rb
409
409
  - db/migrate/20150112203945_remove_duplicate_services.rb
410
410
  - db/migrate/20150205192745_drop_service_uniqueness_index.rb
411
+ - db/migrate/20150212214222_remove_duplicate_services2.rb
411
412
  - lib/mdm.rb
412
413
  - lib/mdm/host/operating_system_normalization.rb
413
414
  - lib/mdm/module.rb
@@ -608,7 +609,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
608
609
  requirements:
609
610
  - - '>='
610
611
  - !ruby/object:Gem::Version
611
- version: '0'
612
+ version: '2.1'
612
613
  required_rubygems_version: !ruby/object:Gem::Requirement
613
614
  requirements:
614
615
  - - '>='