Sha256: b65d14353c650f629d75e0541a0a9041c7be9745064378988f23653c15a5c7bf

Contents?: true

Size: 766 Bytes

Versions: 14

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

require "crtsh"

module Mihari
  module Analyzers
    class Crtsh < Base
      attr_reader :title
      attr_reader :description
      attr_reader :query
      attr_reader :tags

      def initialize(query, title: nil, description: nil, tags: [])
        super()

        @query = query
        @title = title || "crt.sh lookup"
        @description = description || "query = #{query}"
        @tags = tags
      end

      def artifacts
        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
        []
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mihari-0.17.3 lib/mihari/analyzers/crtsh.rb
mihari-0.17.2 lib/mihari/analyzers/crtsh.rb
mihari-0.17.1 lib/mihari/analyzers/crtsh.rb
mihari-0.17.0 lib/mihari/analyzers/crtsh.rb
mihari-0.16.0 lib/mihari/analyzers/crtsh.rb
mihari-0.15.0 lib/mihari/analyzers/crtsh.rb
mihari-0.14.0 lib/mihari/analyzers/crtsh.rb
mihari-0.13.2 lib/mihari/analyzers/crtsh.rb
mihari-0.13.1 lib/mihari/analyzers/crtsh.rb
mihari-0.13.0 lib/mihari/analyzers/crtsh.rb
mihari-0.12.0 lib/mihari/analyzers/crtsh.rb
mihari-0.11.0 lib/mihari/analyzers/crtsh.rb
mihari-0.10.0 lib/mihari/analyzers/crtsh.rb
mihari-0.9.1 lib/mihari/analyzers/crtsh.rb