Remove executable Ruby files from classic loading
This commit is contained in:
parent
133f982f7c
commit
71149e9c68
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue