Class: Tigre::Analysis
- Inherits:
-
Object
- Object
- Tigre::Analysis
- Extended by:
- CommonGetters, CommonParams
- Defined in:
- lib/tigre-client/analysis.rb
Class Method Summary collapse
-
.add_file(analysis_id, file_location, file_type) ⇒ Object
required analysis_id => String file_location => String path to the file file_type => String, the type of the file.
-
.get_samples_with_dbts(dbts_name_list, options = {}) ⇒ Object
required dbts_name_list => Hash => I.E => 1, ‘key2 => 0 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).
-
.get_samples_with_mutex(mutex_name_list, options = {}) ⇒ Object
required mutex_name_list => String (comma seperated) => I.E ‘foo,bar,baz’ mutex_name_list => Array => [‘foo’, ‘bar’, ‘baz’] 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).
-
.get_urls_with_dbts(dbts_name_list, options = {}) ⇒ Object
required dbts_name_list => Hash => I.E => 1, ‘key2 => 0 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).
-
.get_urls_with_mutex(mutex_name_list, options = {}) ⇒ Object
required mutex_name_list => String (comma seperated) => I.E ‘foo,bar,baz’ mutex_name_list => Array => [‘foo’, ‘bar’, ‘baz’] 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).
-
.update(analysis_id, params_hash) ⇒ Object
required analysis_id => String params_hash => Hash :dbts => Hash => value, :key2 => value where the key is what the name of the attribute is and the value should be a boolean :mutex_name_list => String (comma seperated) => I.E ‘foo,bar,baz’ :mutex_name_list => Array => [‘foo’, ‘bar’, ‘baz’].
Instance Method Summary collapse
-
#get(analysis_id) ⇒ Object
required analysis_id => String.
Methods included from CommonParams
before_after, before_after_page_per, common_params, get_klass, get_logic_param, package_array_list, page_per
Methods included from CommonGetters
count, exploit_feed, index, latest_analyses, latest_analysis
Class Method Details
.add_file(analysis_id, file_location, file_type) ⇒ Object
required
analysis_id => String
file_location => String path to the file
file_type => String, the type of the file
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/tigre-client/analysis.rb', line 42 def self.add_file(analysis_id, file_location, file_type) if analysis_id == '' || file_location.empty? || file_type.empty? raise "Missing analysis_id, file_location, or file_type parameter" end if Tigre.s3_analysis_enabled? Tigre.logger.info 'Uploading file directly to S3' if Tigre.logger bucket = S3Bucket.new(Tigre.s3_analysis_bucket) bucket.send_file(file_location, "analysis/#{id.to_s}/#{file[:filename]}") f = File.new(file, 'r') update_data = {:file_hash => {'name' => File.basename(f), 'size' => File.size(f), 'file_type' => file_type}} Tigre.put_connection("/analyses/#{analysis_id}", update_data) else update_data = {:file => File.new(file_location), :file_type => file_type} Tigre.put_connection("/analyses/#{analysis_id}/upload", update_data) end end |
.get_samples_with_dbts(dbts_name_list, options = {}) ⇒ Object
required
dbts_name_list => Hash => I.E {'key1' => 1, 'key2 => 0}
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)
118 119 120 121 122 123 124 125 |
# File 'lib/tigre-client/analysis.rb', line 118 def self.get_samples_with_dbts(dbts_name_list, ={}) raise 'Missing dbts_name_list' if dbts_name_list == '' common_params() search = {:dbts_name_list => dbts_name_list, :before => @before, :after => @after, :page => @page, :per => @per} Tigre.post_connection("/analyses/samples/dbts_name", search) end |
.get_samples_with_mutex(mutex_name_list, options = {}) ⇒ Object
required
mutex_name_list => String (comma seperated) => I.E 'foo,bar,baz'
mutex_name_list => Array => ['foo', 'bar', 'baz']
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)
87 88 89 90 91 |
# File 'lib/tigre-client/analysis.rb', line 87 def self.get_samples_with_mutex(mutex_name_list, ={}) raise 'Missing mutex_name_list' if mutex_name_list == '' common_params() Tigre.get_connection("/analyses/samples/mutex_name?mutex_name_list=#{package_array_list(mutex_name_list)}&#{before_after_page_per}") end |
.get_urls_with_dbts(dbts_name_list, options = {}) ⇒ Object
required
dbts_name_list => Hash => I.E {'key1' => 1, 'key2 => 0}
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)
101 102 103 104 105 106 107 108 |
# File 'lib/tigre-client/analysis.rb', line 101 def self.get_urls_with_dbts(dbts_name_list, ={}) raise 'Missing dbts_name_list' if dbts_name_list == '' common_params() search = {:dbts_name_list => dbts_name_list, :before => @before, :after => @after, :page => @page, :per => @per} Tigre.post_connection("/analyses/urls/dbts_name", search) end |
.get_urls_with_mutex(mutex_name_list, options = {}) ⇒ Object
required
mutex_name_list => String (comma seperated) => I.E 'foo,bar,baz'
mutex_name_list => Array => ['foo', 'bar', 'baz']
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)
72 73 74 75 76 |
# File 'lib/tigre-client/analysis.rb', line 72 def self.get_urls_with_mutex(mutex_name_list, ={}) raise 'Missing mutex_name_list' if mutex_name_list == '' common_params() Tigre.get_connection("/analyses/urls/mutex_name?mutex_name_list=#{package_array_list(mutex_name_list)}&#{before_after_page_per}") end |
.update(analysis_id, params_hash) ⇒ Object
required
analysis_id => String
params_hash => Hash
:dbts => Hash {:key1 => value, :key2 => value} where the key is what the name of the
attribute is and the value should be a boolean
:mutex_name_list => String (comma seperated) => I.E 'foo,bar,baz'
:mutex_name_list => Array => ['foo', 'bar', 'baz']
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tigre-client/analysis.rb', line 24 def self.update(analysis_id, params_hash) if analysis_id == '' || params_hash.empty? raise "Missing analysis_id parameter or params_hash is empty" end if params_hash[:mutex_name_list] params_hash[:mutex_name_list] = package_array_list(params_hash[:mutex_name_list]) end update_data = {:metadatas => params_hash} Tigre.put_connection("/analyses/#{analysis_id}", update_data) end |
Instance Method Details
#get(analysis_id) ⇒ Object
required
analysis_id => String
9 10 11 12 13 14 15 |
# File 'lib/tigre-client/analysis.rb', line 9 def get(analysis_id) if analysis_id == '' raise "Missing analysis_id parameter" end Tigre.get_connection("analyses/#{analysis_id}") end |