class Enricher::VirusTotal

Bogons ipv4 allow for both static simple checks and for dynamic full Bogon list checks provided by Team Cymru.

Constants

APT_KEY

First you need to include the correct require files

DISABLED

Public Class Methods

hash_cache() click to toggle source
# File lib/enricher/virustotal.rb, line 13
def self.hash_cache
  @@hash_cache
end
new(constructor = {}) click to toggle source
# File lib/enricher/virustotal.rb, line 17
def initialize(constructor = {})

  raise DisabledClassIncluded if DISABLED 
  #First you need to include the correct require files
  APT_KEY = "YOUR API KEY HERE"
  @@hash_cache ||= Vash.new
  @@url_cache ||= Vash.new  
  # Voliate Cache store for 43200 (12hr)
end
url_cache() click to toggle source
# File lib/enricher/virustotal.rb, line 9
def self.url_cache
  @@url_cache
end

Public Instance Methods

hash(hash) click to toggle source
# File lib/enricher/virustotal.rb, line 27
def hash(hash)
  #To query a hash(sha1/sha256/md5)
  @@hash_cache["vt_#{hash}".to_sym] ||= Uirusu::VTFile.query_report(VT_APT_KEY, hash)
  result = Uirusu::VTResult.new(hash, results)
  result.to_json
end
url(url) click to toggle source
# File lib/enricher/virustotal.rb, line 34
def url(url)

  # Use Base 36 for symbols
  #>> "joe@momma.org".hash.to_s(36)
  #=> "37zed965f04p"
  #>> "http://joe@momma.org".hash.to_s(36)
  #=> "vj36lppwievl"
      #=> Tack on.. vt_ to url converted .hash.to_s(36)

  @@url_cache["vt_#{url.hash.to_s(36)}".to_sym] ||= Uirusu::VTUrl.query_report(VT_APT_KEY, url)
   
  result = Uirusu::VTResult.new(url, results)
  result.to_json
end