Patches from solar to add symlink support to mod dirs and prevent caching of broken modules
git-svn-id: file:///home/svn/framework3/trunk@4384 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
2473071564
commit
a1c6dda462
|
@ -1,4 +1,3 @@
|
||||||
require 'find'
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
|
@ -745,7 +744,7 @@ protected
|
||||||
ks = true
|
ks = true
|
||||||
|
|
||||||
# Try to load modules from all the files in the supplied path
|
# Try to load modules from all the files in the supplied path
|
||||||
Find.find(path) { |file|
|
Rex::Find.find(path) { |file|
|
||||||
# Skip unit test files
|
# Skip unit test files
|
||||||
next if (file =~ /rb\.ut\.rb$/)
|
next if (file =~ /rb\.ut\.rb$/)
|
||||||
|
|
||||||
|
@ -861,12 +860,6 @@ protected
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Synchronize the modification time for this file.
|
|
||||||
update_module_cache_info(nil, {
|
|
||||||
'paths' => [ path ],
|
|
||||||
'files' => [ file ],
|
|
||||||
'type' => type}) if (!using_cache)
|
|
||||||
|
|
||||||
# Get the module and grab the current number of constants
|
# Get the module and grab the current number of constants
|
||||||
old_constants = mod.constants
|
old_constants = mod.constants
|
||||||
|
|
||||||
|
@ -927,6 +920,12 @@ protected
|
||||||
elog("Exception caught during is_usable check: #{$!}")
|
elog("Exception caught during is_usable check: #{$!}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Synchronize the modification time for this file.
|
||||||
|
update_module_cache_info(nil, {
|
||||||
|
'paths' => [ path ],
|
||||||
|
'files' => [ file ],
|
||||||
|
'type' => type}) if (!using_cache)
|
||||||
|
|
||||||
if (usable == false)
|
if (usable == false)
|
||||||
ilog("Skipping module in #{file} because is_usable returned false.",
|
ilog("Skipping module in #{file} because is_usable returned false.",
|
||||||
'core', LEV_1)
|
'core', LEV_1)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'Find'
|
||||||
|
|
||||||
module Rex
|
module Rex
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -30,4 +32,46 @@ module FileUtils
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Find
|
||||||
|
#
|
||||||
|
# Identical to Find.find from Ruby, but follows symlinks to directories.
|
||||||
|
# See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/68671
|
||||||
|
#
|
||||||
|
def self.find(*paths)
|
||||||
|
paths.collect!{|d| d.dup}
|
||||||
|
while file = paths.shift
|
||||||
|
catch(:prune) do
|
||||||
|
yield file.dup.taint
|
||||||
|
next unless File.exist? file
|
||||||
|
begin
|
||||||
|
if File.stat(file).directory? then
|
||||||
|
d = Dir.open(file)
|
||||||
|
begin
|
||||||
|
for f in d
|
||||||
|
next if f == "." or f == ".."
|
||||||
|
if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
|
||||||
|
f = file + f
|
||||||
|
elsif file == "/" then
|
||||||
|
f = "/" + f
|
||||||
|
else
|
||||||
|
f = File.join(file, f)
|
||||||
|
end
|
||||||
|
paths.unshift f.untaint
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
d.close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue Errno::ENOENT, Errno::EACCES
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.prune
|
||||||
|
throw :prune
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue