sanity check that external modules start with #! before executing
parent
07524f3829
commit
28ebe9d102
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue