Sha256: 53fddfb8c97b3c0d3a7868262b1a5986d6c9bca3179b1fbfc09488b94c811dac

Contents?: true

Size: 802 Bytes

Versions: 15

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Clients
    class Crtsh < Base
      #
      # @param [String] base_url
      # @param [Hash] headers
      #
      def initialize(base_url = "https://crt.sh", headers: {})
        super(base_url, headers: headers)
      end

      #
      # Search crt.sh by a given identity
      #
      # @param [String] identity
      # @param [String, nil] match "=", "ILIKE", "LIKE", "single", "any" or nil
      # @param [String, nil] exclude "expired" or nil
      #
      # @return [Array<Hash>]
      #
      def search(identity, match: nil, exclude: nil)
        params = { identity: identity, match: match, exclude: exclude, output: "json" }.compact

        res = get("/", params: params)
        JSON.parse(res.body.to_s)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mihari-5.4.2 lib/mihari/clients/crtsh.rb
mihari-5.4.1 lib/mihari/clients/crtsh.rb
mihari-5.4.0 lib/mihari/clients/crtsh.rb
mihari-5.3.2 lib/mihari/clients/crtsh.rb
mihari-5.3.1 lib/mihari/clients/crtsh.rb
mihari-5.3.0 lib/mihari/clients/crtsh.rb
mihari-5.2.4 lib/mihari/clients/crtsh.rb
mihari-5.2.3 lib/mihari/clients/crtsh.rb
mihari-5.2.2 lib/mihari/clients/crtsh.rb
mihari-5.2.1 lib/mihari/clients/crtsh.rb
mihari-5.2.0 lib/mihari/clients/crtsh.rb
mihari-5.1.4 lib/mihari/clients/crtsh.rb
mihari-5.1.3 lib/mihari/clients/crtsh.rb
mihari-5.1.2 lib/mihari/clients/crtsh.rb
mihari-5.1.1 lib/mihari/clients/crtsh.rb