Module: Tigre::CommonGetters

Included in:
Analysis, Sample, Url
Defined in:
lib/tigre-client/common/common_getters.rb

Instance Method Summary collapse

Instance Method Details

#count(options = {}) ⇒ Object

optional params

options => Hash
  :after  => Ruby DateTime object OR Integer (epoch time)
  :before => Ruby DateTime object OR Integer (epoch time)


19
20
21
22
# File 'lib/tigre-client/common/common_getters.rb', line 19

def count(options={})
  common_params(options)
  Tigre.get_connection("/#{get_klass}/count?#{before_after}")
end

#exploit_feed(options = {}) ⇒ Object

optional params

options => Hash
  :after  => Ruby DateTime object OR Integer (epoch time)
  :before => Ruby DateTime object OR Integer (epoch time)
  :page   => Integer, :default => 0
  :per    => Integer, :default => 50


30
31
32
33
# File 'lib/tigre-client/common/common_getters.rb', line 30

def exploit_feed(options={})
  common_params(options)
  Tigre.get_connection("/#{get_klass}/latest_analyses?tags=exploit&#{before_after_page_per}")
end

#index(options = {}) ⇒ Object

optional params

options => Hash
  :page   => Integer, :default => 0
  :per    => Integer, :default => 50
  :after  => Ruby DateTime object OR Integer (epoch time)
  :before => Ruby DateTime object OR Integer (epoch time)


10
11
12
13
# File 'lib/tigre-client/common/common_getters.rb', line 10

def index(options={})      
  common_params(options)
  Tigre.get_connection("/#{get_klass}?#{before_after_page_per}")
end

#latest_analyses(search_hash = {}, options = {}) ⇒ Object

optional params

search_hash => Hash
  :tags => String => I.E 'foo'
  :tags => String (comma seperated) => I.E 'foo,bar,baz'
  :tags => Array => ['foo', 'bar', 'baz']
  :file_types => String => I.E 'pdf'
  :file_types => String (comma seperated) => I.E 'pdf,exe'
  :file_types => Array => ['pdf', 'exe', 'com']
options => Hash
  :after  => Ruby DateTime object OR Integer (epoch time)
  :before => Ruby DateTime object OR Integer (epoch time)
  :page   => Integer, :default => 0
  :per    => Integer, :default => 50


57
58
59
60
61
# File 'lib/tigre-client/common/common_getters.rb', line 57

def latest_analyses(search_hash={},options={})
  tags      = package_array_list(search_hash[:tags])        if search_hash[:tags]
  file_types = package_array_list(search_hash[:file_types]) if search_hash[:file_types]
  Tigre.get_connection("/#{get_klass}/latest_analyses?tags=#{tags}&file_types=#{file_types}&#{before_after_page_per}")
end

#latest_analysis(hash) ⇒ Object

required params

hash   => Hash
  :digest => String,  The digest type
  :value  => String,  The digest value


39
40
41
42
# File 'lib/tigre-client/common/common_getters.rb', line 39

def latest_analysis(hash)
  raise 'Missing parameter :digest or :value' unless hash[:digest] && hash[:value]
  Tigre.get_connection("/#{get_klass}/#{hash[:digest]}/value/#{hash[:value]}/latest_analysis")
end