Check for payload in :type instead of :modification_time
Just had a brain fart when converting the hash key names and translated :mtype to :modification_time instead of the correct :type. Correct key names are in Msf::ModuleManager::Cache#module_info_by_path_from_database!.
This commit is contained in:
@@ -30,7 +30,7 @@ module Msf::ModuleManager::Loading
|
||||
|
||||
# if uncached then it counts as changed
|
||||
# Payloads can't be cached due to stage/stager matching
|
||||
if module_info.nil? or module_info[:modification_time] == Msf::MODULE_PAYLOAD
|
||||
if module_info.nil? or module_info[:type] == Msf::MODULE_PAYLOAD
|
||||
changed = true
|
||||
else
|
||||
begin
|
||||
|
||||
@@ -122,12 +122,16 @@ describe Msf::ModuleManager do
|
||||
end
|
||||
end
|
||||
|
||||
it 'should return true if the cached modification time is Msf::MODULE_PAYLOAD' do
|
||||
it 'should return true if the cached type is Msf::MODULE_PAYLOAD' do
|
||||
Tempfile.open(module_basename) do |tempfile|
|
||||
module_path = tempfile.path
|
||||
modification_time = File.mtime(module_path)
|
||||
|
||||
subject.send(:module_info_by_path)[module_path] = {
|
||||
:modification_time => Msf::MODULE_PAYLOAD
|
||||
# :modification_time must match so that it is the :type that is causing the `true` and not the
|
||||
# :modification_time causing the `true`.
|
||||
:modification_time => modification_time,
|
||||
:type => Msf::MODULE_PAYLOAD
|
||||
}
|
||||
|
||||
subject.file_changed?(module_path).should be_true
|
||||
|
||||
Reference in New Issue
Block a user