Skip to content

Commit 6c11b87

Browse files
committed
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!.
1 parent 5709ffc commit 6c11b87

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/msf/core/module_manager/loading.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def file_changed?(path)
3030

3131
# if uncached then it counts as changed
3232
# Payloads can't be cached due to stage/stager matching
33-
if module_info.nil? or module_info[:modification_time] == Msf::MODULE_PAYLOAD
33+
if module_info.nil? or module_info[:type] == Msf::MODULE_PAYLOAD
3434
changed = true
3535
else
3636
begin

spec/lib/msf/core/module_manager_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,16 @@
122122
end
123123
end
124124

125-
it 'should return true if the cached modification time is Msf::MODULE_PAYLOAD' do
125+
it 'should return true if the cached type is Msf::MODULE_PAYLOAD' do
126126
Tempfile.open(module_basename) do |tempfile|
127127
module_path = tempfile.path
128+
modification_time = File.mtime(module_path)
128129

129130
subject.send(:module_info_by_path)[module_path] = {
130-
:modification_time => Msf::MODULE_PAYLOAD
131+
# :modification_time must match so that it is the :type that is causing the `true` and not the
132+
# :modification_time causing the `true`.
133+
:modification_time => modification_time,
134+
:type => Msf::MODULE_PAYLOAD
131135
}
132136

133137
subject.file_changed?(module_path).should be_true

0 commit comments

Comments
 (0)