lib/mihari/analyzers/crtsh.rb in mihari-0.9.0 vs lib/mihari/analyzers/crtsh.rb in mihari-0.9.1

- old
+ new

@@ -3,20 +3,18 @@ require "crtsh" module Mihari module Analyzers class Crtsh < Base - attr_reader :api attr_reader :title attr_reader :description attr_reader :query attr_reader :tags def initialize(query, title: nil, description: nil, tags: []) super() - @api = ::Crtsh::API.new @query = query @title = title || "crt.sh lookup" @description = description || "query = #{query}" @tags = tags end @@ -25,9 +23,13 @@ results = search results.map { |result| result.dig("name_value") }.compact.uniq end private + + def api + @api ||= ::Crtsh::API.new + end def search api.search(query) rescue ::Crtsh::Error => _e []