diff --git a/lib/msf/core/module_manager/loading.rb b/lib/msf/core/module_manager/loading.rb index b71fa2e7ea..6b344537f9 100644 --- a/lib/msf/core/module_manager/loading.rb +++ b/lib/msf/core/module_manager/loading.rb @@ -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 diff --git a/spec/lib/msf/core/module_manager_spec.rb b/spec/lib/msf/core/module_manager_spec.rb index c39541a29b..714d545f64 100644 --- a/spec/lib/msf/core/module_manager_spec.rb +++ b/spec/lib/msf/core/module_manager_spec.rb @@ -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