Sha256: bcc1f965e25f37e1c037226ed1ec017e13e14192df962f50aa7b6db746fc3b1e
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Mihari module Clients class Crtsh < Base # # @param [String] base_url # @param [Hash] headers # @param [Integer, nil] timeout # def initialize(base_url = "https://crt.sh", headers: {}, timeout: nil) super(base_url, headers: headers, timeout: timeout) 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<Mihari::Models::Artifact>] # def search(identity, match: nil, exclude: nil) params = { identity: identity, match: match, exclude: exclude, output: "json" }.compact res = get("/", params: params) parsed = JSON.parse(res.body.to_s) parsed.map do |result| values = result["name_value"].to_s.lines.map(&:chomp) values.map { |value| Models::Artifact.new(data: value, metadata: result) } end.flatten end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mihari-5.6.2 | lib/mihari/clients/crtsh.rb |