metasploit_data_models 2.0.11 → 2.0.12

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: d804588ca2b3cf19ee1562d3c57e4cf5aef85868
4
- data.tar.gz: d75b48caa5ccec93901f13f722349c046898a79d
3
+ metadata.gz: 90ffe84c79eb486db5b44a939b2280eceb90c30e
4
+ data.tar.gz: 14715f51541a688945983570a22ee547facb1e43
5
5
  SHA512:
6
- metadata.gz: f540c5f9f847c41f3fe568be23aea49d2a7f33681d7da5b042455bf7cbd3588cbf4e67c78eaec5817ca956bcbf2b27399dde636d066d61c76c3b2b79f7e6e538
7
- data.tar.gz: de31e9840a0e9ec02749ac640bf443916f4bbaf6948f0759ce62795ece06d88f7e5bc7c85254655e5f0cb925ccfba9291b1db1d2f6e59efd9dbc00a40668ba84
6
+ metadata.gz: 5c25e6d978843923725dbc50fa64ccb8017901de4057634bae8d4ec345174d4b8319afadf560ffae74fd8d462333fb51c7fc8bd9792a77c23ee810ffce890055
7
+ data.tar.gz: db480474fa17085808961564fca2bfbc333b56f69765738683508633a3509c25c21efebf0d99385ddcfed149f6901b204c4e29dd284abae275f09af5c25c885e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -10,7 +10,7 @@ addons:
10
10
  - libpcap-dev
11
11
  - graphviz
12
12
  rvm:
13
- - 2.3.2
13
+ - 2.3.3
14
14
  before_script:
15
15
  - cp spec/dummy/config/database.yml.travis spec/dummy/config/database.yml
16
16
  - bundle exec rake --version
@@ -0,0 +1,5 @@
1
+ class AddOsFamilyToHosts < ActiveRecord::Migration
2
+ def change
3
+ add_column :hosts, :os_family, :string
4
+ end
5
+ end
@@ -342,11 +342,38 @@ module Mdm::Host::OperatingSystemNormalization
342
342
  if m['os.product'] =~ /^Windows Server/
343
343
  m['os.product'] = m['os.product'].gsub(/Windows Server/, 'Windows')
344
344
  end
345
+
346
+ # Normalize OS Family
347
+ m = normalize_match_family(m)
345
348
  end
346
349
 
347
350
  m
348
351
  end
349
352
 
353
+ # Normalize matches in order to ensure that an os.family entry exists
354
+ # if we have enough data to put one together.
355
+ def normalize_match_family(m)
356
+ # If the os.family already exists, we don't need to do anything
357
+ return m if m['os.family'].present?
358
+ case m['os.product']
359
+ when /Windows/
360
+ m['os.family'] = 'Windows'
361
+ when /Linux/
362
+ m['os.family'] = 'Linux'
363
+ when /Solaris/
364
+ m['os.family'] = 'Solaris'
365
+ when /SunOS/
366
+ m['os.family'] = 'SunOS'
367
+ when /AIX/
368
+ m['os.family'] = 'AIX'
369
+ when /HP-UX/
370
+ m['os.family'] = 'HP-UX'
371
+ when /OS X/
372
+ m['os.family'] = 'OS X'
373
+ end
374
+ m
375
+ end
376
+
350
377
  #
351
378
  # Recog assumes that the protocol version of the SSH banner has been removed
352
379
  #
@@ -417,6 +444,10 @@ module Mdm::Host::OperatingSystemNormalization
417
444
  end
418
445
  end
419
446
 
447
+ if match.has_key?('os.family')
448
+ host.os_family = sanitize(match['os.family'])
449
+ end
450
+
420
451
  # Select the flavor from os.edition if available
421
452
  if match.has_key?('os.edition') and ! host.attribute_locked?(:os_flavor)
422
453
  host.os_flavor = sanitize(match['os.edition'])
@@ -1,6 +1,6 @@
1
1
  module MetasploitDataModels
2
2
  # VERSION is managed by GemRelease
3
- VERSION = '2.0.11'
3
+ VERSION = '2.0.12'
4
4
 
5
5
  # @return [String]
6
6
  #
@@ -352,6 +352,7 @@ RSpec.describe Mdm::Host, type: :model do
352
352
  it { is_expected.to have_db_column(:info).of_type(:string).with_options(:limit => 2 ** 16) }
353
353
  it { is_expected.to have_db_column(:mac).of_type(:string) }
354
354
  it { is_expected.to have_db_column(:name).of_type(:string) }
355
+ it { is_expected.to have_db_column(:os_family).of_type(:string) }
355
356
  it { is_expected.to have_db_column(:os_flavor).of_type(:string) }
356
357
  it { is_expected.to have_db_column(:os_lang).of_type(:string) }
357
358
  it { is_expected.to have_db_column(:os_name).of_type(:string) }
@@ -864,6 +865,44 @@ RSpec.describe Mdm::Host, type: :model do
864
865
  end
865
866
  end
866
867
 
868
+ context '#normalize_match_family' do
869
+ it 'should set the family to Windows if the product contains Windows' do
870
+ match = { 'os.product' => 'Microsoft Windows 7' }
871
+ result = host.normalize_match_family(match)
872
+ expect(result['os.family']).to eq 'Windows'
873
+ end
874
+
875
+ it 'should set the family to Linux if the product contains Linux' do
876
+ match = { 'os.product' => 'Linux (Ubuntu)' }
877
+ result = host.normalize_match_family(match)
878
+ expect(result['os.family']).to eq 'Linux'
879
+ end
880
+
881
+ it 'should set the family to Solaris if the product contains Solaris' do
882
+ match = { 'os.product' => 'Solaris' }
883
+ result = host.normalize_match_family(match)
884
+ expect(result['os.family']).to eq 'Solaris'
885
+ end
886
+
887
+ it 'should set the family to SunOS if the product contains SunOS' do
888
+ match = { 'os.product' => 'SunOS' }
889
+ result = host.normalize_match_family(match)
890
+ expect(result['os.family']).to eq 'SunOS'
891
+ end
892
+
893
+ it 'should set the family to AIX if the product contains AIX' do
894
+ match = { 'os.product' => 'AIX' }
895
+ result = host.normalize_match_family(match)
896
+ expect(result['os.family']).to eq 'AIX'
897
+ end
898
+
899
+ it 'should set the family to HP-UX if the product contains HP-UX' do
900
+ match = { 'os.product' => 'HP-UX' }
901
+ result = host.normalize_match_family(match)
902
+ expect(result['os.family']).to eq 'HP-UX'
903
+ end
904
+ end
905
+
867
906
  context '#guess_purpose_from_match' do
868
907
 
869
908
  it 'should detect Windows XP as a client' do
@@ -451,7 +451,8 @@ CREATE TABLE hosts (
451
451
  host_detail_count integer DEFAULT 0,
452
452
  exploit_attempt_count integer DEFAULT 0,
453
453
  cred_count integer DEFAULT 0,
454
- detected_arch character varying
454
+ detected_arch character varying,
455
+ os_family character varying
455
456
  );
456
457
 
457
458
 
@@ -3402,6 +3403,8 @@ INSERT INTO schema_migrations (version) VALUES ('20160415153312');
3402
3403
 
3403
3404
  INSERT INTO schema_migrations (version) VALUES ('20161004165612');
3404
3405
 
3406
+ INSERT INTO schema_migrations (version) VALUES ('20161227212223');
3407
+
3405
3408
  INSERT INTO schema_migrations (version) VALUES ('21');
3406
3409
 
3407
3410
  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: 2.0.11
4
+ version: 2.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Huckins
@@ -91,7 +91,7 @@ cert_chain:
91
91
  G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
92
92
  8mVuTXnyJOKRJA==
93
93
  -----END CERTIFICATE-----
94
- date: 2016-12-28 00:00:00.000000000 Z
94
+ date: 2016-12-29 00:00:00.000000000 Z
95
95
  dependencies:
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: metasploit-yard
@@ -552,6 +552,7 @@ files:
552
552
  - db/migrate/20150514182921_add_origin_to_mdm_vuln.rb
553
553
  - db/migrate/20160415153312_remove_not_null_from_web_vuln_p_arams.rb
554
554
  - db/migrate/20161004165612_add_fingerprinted_to_workspace.rb
555
+ - db/migrate/20161227212223_add_os_family_to_hosts.rb
555
556
  - lib/mdm.rb
556
557
  - lib/mdm/host/operating_system_normalization.rb
557
558
  - lib/mdm/module.rb
metadata.gz.sig CHANGED
Binary file