diff --git a/lib/msf/core/modules/loader/directory.rb b/lib/msf/core/modules/loader/directory.rb index e78d371f7d..82e5e5a198 100644 --- a/lib/msf/core/modules/loader/directory.rb +++ b/lib/msf/core/modules/loader/directory.rb @@ -43,6 +43,7 @@ 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) # The module_reference_name doesn't have a file extension module_reference_name = module_reference_name_from_path(relative_entry_descendant_path) diff --git a/lib/msf/core/modules/loader/executable.rb b/lib/msf/core/modules/loader/executable.rb index ec9a00d458..a609a29f96 100644 --- a/lib/msf/core/modules/loader/executable.rb +++ b/lib/msf/core/modules/loader/executable.rb @@ -85,7 +85,7 @@ class Msf::Modules::Loader::Executable < Msf::Modules::Loader::Base begin Msf::Modules::External::Shim.generate(full_path) rescue ::Exception => e - elog "Unable to load module #{full_path} #{e.class} #{e}" + elog "Unable to load module #{full_path} #{e.class} #{e} #{e.backtrace.join "\n"}" # XXX migrate this to a full load_error when we can tell the user why the # module did not load and/or how to resolve it. # load_error(full_path, e) diff --git a/tools/dev/msftidy.rb b/tools/dev/msftidy.rb index 6faf2a536c..6daf0aaa93 100755 --- a/tools/dev/msftidy.rb +++ b/tools/dev/msftidy.rb @@ -107,12 +107,6 @@ class Msftidy # ## - def check_mode - unless (@stat.mode & 0111).zero? - warn("Module should not be marked executable") - end - end - def check_shebang if @lines.first =~ /^#!/ warn("Module should not have a #! line") @@ -681,7 +675,6 @@ class Msftidy # Run all the msftidy checks. # def run_checks - check_mode check_shebang check_nokogiri check_rubygems @@ -755,6 +748,8 @@ if __FILE__ == $PROGRAM_NAME next if full_filepath =~ /\.git[\x5c\x2f]/ next unless File.file? full_filepath next unless full_filepath =~ /\.rb$/ + # Executable files are now assumed to be external modules + next if File.executable?(full_filepath) msftidy = Msftidy.new(full_filepath) msftidy.run_checks @exit_status = msftidy.status if (msftidy.status > @exit_status.to_i)