Sha256: 749998e5bd4215d1cfaf928323aaeee104f9b438f71ffcc44ec25be89a8328cb
Contents?: true
Size: 1.5 KB
Versions: 14
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true require "base64" module Mihari module Clients # # PassiveTotal API client # class PassiveTotal < Base # # @param [String] base_url # @param [String, nil] username # @param [String, nil] api_key # @param [Hash] headers # @param [Integer, nil] timeout # def initialize(base_url = "https://api.passivetotal.org", username:, api_key:, headers: {}, timeout: nil) raise(ArgumentError, "username is required") if username.nil? raise(ArgumentError, "api_key is required") if api_key.nil? headers["authorization"] = "Basic #{Base64.strict_encode64("#{username}:#{api_key}")}" super(base_url, headers: headers, timeout: timeout) end # # Passive DNS search # # @param [String] query # # @return [Hash] # def passive_dns_search(query) params = { query: query } get_json("/v2/dns/passive/unique", params: params) end # # Reverse whois search # # @param [String] query # # @return [Hash] # def reverse_whois_search(query) get_json("/v2/whois/search", params: { query: query, field: "email" }.compact) end # # Passive SSL search # # @param [String] query # # @return [Hash] # def ssl_search(query) get_json("/v2/ssl-certificate/history", params: { query: query }) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems