metasploit_data_models 2.0.11 → 2.0.12
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +1 -1
- data/db/migrate/20161227212223_add_os_family_to_hosts.rb +5 -0
- data/lib/mdm/host/operating_system_normalization.rb +31 -0
- data/lib/metasploit_data_models/version.rb +1 -1
- data/spec/app/models/mdm/host_spec.rb +39 -0
- data/spec/dummy/db/structure.sql +4 -1
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ffe84c79eb486db5b44a939b2280eceb90c30e
|
4
|
+
data.tar.gz: 14715f51541a688945983570a22ee547facb1e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c25e6d978843923725dbc50fa64ccb8017901de4057634bae8d4ec345174d4b8319afadf560ffae74fd8d462333fb51c7fc8bd9792a77c23ee810ffce890055
|
7
|
+
data.tar.gz: db480474fa17085808961564fca2bfbc333b56f69765738683508633a3509c25c21efebf0d99385ddcfed149f6901b204c4e29dd284abae275f09af5c25c885e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
@@ -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'])
|
@@ -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
|
data/spec/dummy/db/structure.sql
CHANGED
@@ -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.
|
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-
|
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
|