module Uirusu::Scanner
Public Class Methods
process_file(file)
click to toggle source
Processes a file, hashing it with MD5
# File lib/uirusu/scanner.rb, line 47 def Scanner.process_file file begin digest = Digest::MD5.hexdigest(File.read(file)) @hash_list << digest rescue Exception puts "[!] Cannot read #{file}" end end
recurse(file_name)
click to toggle source
Recursively lists all files in a directory calling process_file
on each file
# File lib/uirusu/scanner.rb, line 32 def Scanner.recurse file_name Dir.new("#{file_name}").each do |file| next if file.match(/^\.+/) path = "#{file_name}/#{file}" if FileTest.directory?("#{path}") recurse("#{path}") else process_file(path) end end end
scan(directory)
click to toggle source
Enumerates a directory recursively then returns the hash list
@return [Array] Hash List
# File lib/uirusu/scanner.rb, line 60 def Scanner.scan directory recurse(directory) return @hash_list end