From 6c8ea2d8833478eaec7273a6034792721e72f828 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sat, 7 Apr 2018 21:15:51 -0500 Subject: [PATCH] also be sure to load executable modules if they don't have #! --- lib/msf/core/modules/loader/directory.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/msf/core/modules/loader/directory.rb b/lib/msf/core/modules/loader/directory.rb index 82e5e5a198..243a75e5dc 100644 --- a/lib/msf/core/modules/loader/directory.rb +++ b/lib/msf/core/modules/loader/directory.rb @@ -43,8 +43,9 @@ class Msf::Modules::Loader::Directory < Msf::Modules::Loader::Base relative_entry_descendant_pathname = entry_descendant_pathname.relative_path_from(full_entry_pathname) relative_entry_descendant_path = relative_entry_descendant_pathname.to_s next if File::basename(relative_entry_descendant_path) == "example.rb" - next if File.executable?(entry_descendant_path) && !File.directory?(entry_descendant_path) - + next if File.executable?(entry_descendant_path) && + !File.directory?(entry_descendant_path) && + File.read(entry_descendant_path, 2) == "#!" # The module_reference_name doesn't have a file extension module_reference_name = module_reference_name_from_path(relative_entry_descendant_path)