commit
171f3b3e7d
|
@ -38,7 +38,7 @@ module Msf
|
||||||
# @return [Msf::Module::Target] the Target that our automatic routine selected
|
# @return [Msf::Module::Target] the Target that our automatic routine selected
|
||||||
def select_target
|
def select_target
|
||||||
return nil unless auto_target?
|
return nil unless auto_target?
|
||||||
host_record = target_host
|
host_record = auto_target_host
|
||||||
return nil if host_record.nil?
|
return nil if host_record.nil?
|
||||||
filtered_targets = filter_by_os(host_record)
|
filtered_targets = filter_by_os(host_record)
|
||||||
filtered_targets.first
|
filtered_targets.first
|
||||||
|
@ -48,7 +48,7 @@ module Msf
|
||||||
#
|
#
|
||||||
# @return [Mdm:Host] the Host record if one exists
|
# @return [Mdm:Host] the Host record if one exists
|
||||||
# @return [nil] if no Host record is present, or the DB is not active
|
# @return [nil] if no Host record is present, or the DB is not active
|
||||||
def target_host
|
def auto_target_host
|
||||||
return nil unless self.respond_to?(:rhost)
|
return nil unless self.respond_to?(:rhost)
|
||||||
return nil unless framework.db.active
|
return nil unless framework.db.active
|
||||||
current_workspace = framework.db.find_workspace(self.workspace)
|
current_workspace = framework.db.find_workspace(self.workspace)
|
||||||
|
|
|
@ -69,12 +69,12 @@ RSpec.describe Msf::Exploit::AutoTarget do
|
||||||
host_obj = FactoryGirl.create(:mdm_host, address: host_addr )
|
host_obj = FactoryGirl.create(:mdm_host, address: host_addr )
|
||||||
windows_exploit.datastore['WORKSPACE'] = host_obj.workspace.name
|
windows_exploit.datastore['WORKSPACE'] = host_obj.workspace.name
|
||||||
windows_exploit.datastore['RHOST'] = host_addr
|
windows_exploit.datastore['RHOST'] = host_addr
|
||||||
expect(windows_exploit.target_host).to eq host_obj
|
expect(windows_exploit.auto_target_host).to eq host_obj
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return nil if there is not one' do
|
it 'should return nil if there is not one' do
|
||||||
windows_exploit.datastore['RHOST'] = '192.168.111.115'
|
windows_exploit.datastore['RHOST'] = '192.168.111.115'
|
||||||
expect(windows_exploit.target_host).to be_nil
|
expect(windows_exploit.auto_target_host).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue