Class: Mihari::Clients::PassiveTotal
- Defined in:
- lib/mihari/clients/passivetotal.rb
Overview
PassiveTotal API client
Instance Attribute Summary
Attributes inherited from Base
#base_url, #headers, #pagination_interval, #timeout
Instance Method Summary collapse
-
#initialize(base_url = "https://api.passivetotal.org", username:, api_key:, headers: {}, timeout: nil) ⇒ PassiveTotal
constructor
A new instance of PassiveTotal.
-
#passive_dns_search(query) ⇒ Hash
Passive DNS search.
-
#reverse_whois_search(query) ⇒ Hash
Reverse whois search.
-
#ssl_search(query) ⇒ Hash
Passive SSL search.
Constructor Details
#initialize(base_url = "https://api.passivetotal.org", username:, api_key:, headers: {}, timeout: nil) ⇒ PassiveTotal
Returns a new instance of PassiveTotal.
18 19 20 21 22 23 24 25 |
# File 'lib/mihari/clients/passivetotal.rb', line 18 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:, timeout:) end |
Instance Method Details
#passive_dns_search(query) ⇒ Hash
Passive DNS search
34 35 36 37 |
# File 'lib/mihari/clients/passivetotal.rb', line 34 def passive_dns_search(query) params = {query:} get_json("/v2/dns/passive/unique", params:) end |
#reverse_whois_search(query) ⇒ Hash
Reverse whois search
46 47 48 49 50 51 |
# File 'lib/mihari/clients/passivetotal.rb', line 46 def reverse_whois_search(query) get_json("/v2/whois/search", params: { query:, field: "email" }.compact) end |
#ssl_search(query) ⇒ Hash
Passive SSL search
60 61 62 |
# File 'lib/mihari/clients/passivetotal.rb', line 60 def ssl_search(query) get_json("/v2/ssl-certificate/history", params: {query:}) end |