Fixes #661 - Don't hash directories named like a file
This commit is contained in:
@@ -82,17 +82,19 @@ class CheckerPlugin < Plugin
|
||||
end
|
||||
|
||||
def check_local_vulnerable_files(dir_to_scan)
|
||||
if Dir::exist?(dir_to_scan)
|
||||
if Dir.exist?(dir_to_scan)
|
||||
xml_file = LOCAL_FILES_FILE
|
||||
local_hashes = {}
|
||||
file_extension_to_scan = '*.{js,php,swf,html,htm}'
|
||||
|
||||
print '[+] Generating local hashes ... '
|
||||
|
||||
Dir[File::join(dir_to_scan, '**', file_extension_to_scan)].each do |filename|
|
||||
Dir[File.join(dir_to_scan, '**', file_extension_to_scan)]
|
||||
.select { |f| File.file?(f) }
|
||||
.each do |filename|
|
||||
sha1sum = Digest::SHA1.file(filename).hexdigest
|
||||
|
||||
if local_hashes.has_key?(sha1sum)
|
||||
if local_hashes.key?(sha1sum)
|
||||
local_hashes[sha1sum] << filename
|
||||
else
|
||||
local_hashes[sha1sum] = [filename]
|
||||
|
||||
Reference in New Issue
Block a user