diff --git a/lib/msf/core/modules/loader/executable.rb b/lib/msf/core/modules/loader/executable.rb index a609a29f96..1f0d3672f9 100644 --- a/lib/msf/core/modules/loader/executable.rb +++ b/lib/msf/core/modules/loader/executable.rb @@ -40,7 +40,11 @@ class Msf::Modules::Loader::Executable < Msf::Modules::Loader::Base # Try to load modules from all the files in the supplied path Rex::Find.find(full_entry_path) do |entry_descendant_path| - if File.executable?(entry_descendant_path) && !File.directory?(entry_descendant_path) + if File.executable?(entry_descendant_path) && + !File.directory?(entry_descendant_path) && + # Assume that all modules are scripts for now, workaround + # filesystems where all files are labeled as executable. + File.read(entry_descendant_path, 2) == "#!" entry_descendant_pathname = Pathname.new(entry_descendant_path) relative_entry_descendant_pathname = entry_descendant_pathname.relative_path_from(full_entry_pathname) relative_entry_descendant_path = relative_entry_descendant_pathname.to_s