Sha256: 9f1ff071023377421c7a4c3f1eb7dfc4e03e2627c03a8fec9c6e5f60619e091c
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true module Mihari module Analyzers class VirusTotalIntelligence < Base # @return [String, nil] attr_reader :api_key # # @param [String] query # @param [Hash, nll] options # @param [String, nil] api_key # def initialize(query, options: nil, api_key: nil) super(query, options: options) @api_key = api_key || Mihari.config.virustotal_api_key end def artifacts search_with_cursor.map(&:to_artifacts).flatten end def configuration_keys %w[virustotal_api_key] end private # # VT API # # @return [::VirusTotal::API] # def client @client = Clients::VirusTotal.new(api_key: api_key) end # # Search with cursor # # @return [Array<Structs::VirusTotalIntelligence::Response>] # def search_with_cursor cursor = nil responses = [] pagination_limit.times do response = Structs::VirusTotalIntelligence::Response.from_dynamic!(client.intel_search(query, cursor: cursor)) responses << response break if response.meta.cursor.nil? cursor = response.meta.cursor # sleep #{interval} seconds to avoid the rate limitation (if it is set) sleep_interval end responses end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.4.2 | lib/mihari/analyzers/virustotal_intelligence.rb |
mihari-5.4.1 | lib/mihari/analyzers/virustotal_intelligence.rb |