Module | Lookup |
In: |
extensions/lookup/lookup.rb
|
2007-11-12
john [at] tinternet org uk
Module to identfy hashes in a lookup table Well really it just searches a file for the given string, so you can use it for whatever your needs, be it searching MD5‘s or anything else
search a directory of files for the given string
# File extensions/lookup/lookup.rb, line 15 def Lookup.search(hash, path) begin file = File.open(path.to_s,'r') rescue return "ERROR: There was a problem reading the file specified" end file.each_line do |line| if line.scan(hash).length != 0 return line.chomp end end return "Not Found!" end