metasploit_data_models 1.2.5 → 1.2.6

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: e38dff6e185dae182d9db9f9cf68787b6e9f0e12
4
- data.tar.gz: fc9c268cb9b83102448af9eeb890c7ac893dd1b8
3
+ metadata.gz: 3a2851ff0a874979d51536d4c91b346339923d0d
4
+ data.tar.gz: 2f917872a6e4cbf0589aca13bb50ef5c3b8e453d
5
5
  SHA512:
6
- metadata.gz: 9869792d9eaf8e4c19f9ad90ee96ef75c52ef8ac92b1368265bd5befc412ffbe0b545a2d3fe76ad2a399229b87202744fd3ffb7dd4c7c6bd62c8f27e350e040f
7
- data.tar.gz: 68b1ddd8bcb0f155d7ed770e1ff17592f61257ce2ef1c69f086869836bee008b2d5d597779b1f4c6ad8af033fbfcf36ab85603cb7d0104a0a844c2252dc40c0a
6
+ metadata.gz: 991277f433519b3f5c5378ef266d2425cc8a3470f8d824b432071cf63e82e91cc6073fad54c7b313b3ee60f50f558d052379b8dde564142e417358add1c854fd
7
+ data.tar.gz: d2c14f9973c35435367ad37f0080a97b167880163045551f0042e644c1ba73ad502fa547353b400561416021c79e19d0329558b59a10af66d1907705086e57b0
@@ -204,8 +204,7 @@ module Mdm::Host::OperatingSystemNormalization
204
204
  # Mdm currently serves that role.
205
205
  #
206
206
 
207
- service_match_keys = Hash.new { [] }
208
- service_match_keys.merge({
207
+ service_match_keys = {
209
208
  # TODO: Implement smb.generic fingerprint database
210
209
  # 'smb' => [ 'smb.generic' ], # Distinct from smb.fingerprint, use os.certainty to choose best match
211
210
  # 'netbios' => [ 'smb.generic' ], # Distinct from smb.fingerprint, use os.certainty to choose best match
@@ -221,10 +220,12 @@ module Mdm::Host::OperatingSystemNormalization
221
220
  'nntp' => [ 'nntp.banner' ],
222
221
  'ftp' => [ 'ftp.banner' ],
223
222
  'ssdp' => [ 'ssdp_header.server' ]
224
- })
223
+ }
225
224
 
226
225
  matches = []
227
226
 
227
+ return matches unless service_match_keys.has_key?(s.name)
228
+
228
229
  service_match_keys[s.name].each do |rdb|
229
230
  banner = s.info
230
231
  if self.respond_to?("service_banner_recog_filter_#{s.name}")
@@ -10,7 +10,7 @@ module MetasploitDataModels
10
10
  # The minor version number, scoped to the {MAJOR} version number.
11
11
  MINOR = 2
12
12
  # The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
13
- PATCH = 5
13
+ PATCH = 6
14
14
 
15
15
 
16
16
  #
@@ -1,4 +1,6 @@
1
1
  RSpec.describe Mdm::Host, type: :model do
2
+ include_context 'Rex::Text'
3
+
2
4
  subject(:host) do
3
5
  FactoryGirl.build(:mdm_host)
4
6
  end
@@ -724,19 +726,6 @@ RSpec.describe Mdm::Host, type: :model do
724
726
 
725
727
 
726
728
  context '#apply_match_to_host' do
727
-
728
- before(:each) do
729
- stub_const(
730
- 'Rex::Text',
731
- Module.new do
732
- def self.ascii_safe_hex(unsanitized)
733
- # Pass back the sanitized value for the stub
734
- unsanitized.unpack("C*").pack("C*").gsub(/([\x00-\x08\x0b\x0c\x0e-\x1f\x80-\xFF])/n){ |x| "\\x%.2x" % x.unpack("C*")[0]}
735
- end
736
- end
737
- )
738
- end
739
-
740
729
  it 'should set host.mac when host.mac is present' do
741
730
  match = { 'host.mac' => '00:11:22:33:44:55' }
742
731
  host.send(:apply_match_to_host, match)
@@ -66,11 +66,36 @@ RSpec.describe Mdm::Service, type: :model do
66
66
 
67
67
  context 'callbacks' do
68
68
  context 'after_save' do
69
+ include_context 'Rex::Text'
70
+
69
71
  it 'should call #normalize_host_os' do
70
72
  svc = FactoryGirl.create(:mdm_service)
71
73
  expect(svc).to receive(:normalize_host_os)
72
74
  svc.run_callbacks(:save)
73
75
  end
76
+
77
+ it 'should include recog data when there is a match' do
78
+ host = FactoryGirl.create(:mdm_host)
79
+ FactoryGirl.create(
80
+ :mdm_service,
81
+ :host => host,
82
+ :name => 'ftp',
83
+ :info => 'example.com Microsoft FTP Service (Version 3.0).'
84
+ )
85
+ expect(host.name).to eq('example.com')
86
+ expect(host.os_name).to eq('Windows NT')
87
+ end
88
+
89
+ it 'should not include recog data when there is not a match' do
90
+ host = FactoryGirl.create(:mdm_host)
91
+ FactoryGirl.create(
92
+ :mdm_service,
93
+ :host => host,
94
+ :name => 'ftp',
95
+ :info => 'THISSHOULDNEVERMATCH'
96
+ )
97
+ expect(host.os_name).to eq('Unknown')
98
+ end
74
99
  end
75
100
  end
76
101
 
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: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
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-06-23 00:00:00.000000000 Z
14
+ date: 2015-07-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: metasploit-version
@@ -731,7 +731,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
731
731
  version: '0'
732
732
  requirements: []
733
733
  rubyforge_project:
734
- rubygems_version: 2.4.6
734
+ rubygems_version: 2.4.3
735
735
  signing_key:
736
736
  specification_version: 4
737
737
  summary: Database code for MSF and Metasploit Pro