CensysEx.Hosts (censys_ex v1.2.0) View Source
CensysEx wrapper for the search.censys.io v2 API for the "hosts" resource
Link to this section Summary
Types
Values that determine how to query Virtual Hosts. :exclude
will ignore any virtual hosts
entries, :include
virtual hosts will be present in the returned list of hits, :only
will
return only virtual hosts
Functions
Hits the Censys Hosts aggregate API. Optionally control number of buckets returned
Hits the Censys Hosts diff API.
Hits the Censys Hosts view names API. Returning a stream of names for that IP.
Hits the Censys Hosts search API. Returns a stream of results for your query
Hits the Censys Hosts view API. Returning full information about an IP at a given time
Link to this section Types
Specs
v_hosts() :: :exclude | :include | :only
Values that determine how to query Virtual Hosts. :exclude
will ignore any virtual hosts
entries, :include
virtual hosts will be present in the returned list of hits, :only
will
return only virtual hosts
Link to this section Functions
Specs
aggregate(String.t(), String.t() | nil, integer()) :: CensysEx.result()
Hits the Censys Hosts aggregate API. Optionally control number of buckets returned
Examples
CensysEx.Hosts.aggregate("location.country_code", "services.service_name: MEMCACHED")
CensysEx.Hosts.aggregate("location.country_code", "services.service_name: MEMCACHED", 1000)
Specs
diff(String.t(), String.t() | nil, DateTime.t() | nil, DateTime.t() | nil) :: CensysEx.result()
Hits the Censys Hosts diff API.
Examples
# diff the current host with it self 🤷
CensysEx.Hosts.diff("8.8.8.8")
# diff two hosts
CensysEx.Hosts.diff("8.8.8.8", "1.1.1.1")
# diff a host with itself at a time in the past
CensysEx.Hosts.diff("8.8.8.8", nil, ~U[2021-06-07 12:53:27.450073Z])
# diff two hosts in the past
CensysEx.Hosts.diff("8.8.8.8", "8.8.4.4" ~U[2021-06-07 12:53:27.450073Z], ~U[2021-06-07 12:53:27.450073Z])
Specs
names(String.t()) :: CensysEx.result_stream(String.t())
Hits the Censys Hosts view names API. Returning a stream of names for that IP.
Examples
CensysEx.Hosts.names("127.0.0.1")
Specs
search(String.t(), integer(), v_hosts()) :: CensysEx.result_stream(map())
Hits the Censys Hosts search API. Returns a stream of results for your query
- API docs: https://search.censys.io/api#/hosts/searchHosts
- Syntax: https://search.censys.io/search/language?resource=hosts
Examples
CensysEx.Hosts.search("same_service(service_name: SSH and not port: 22)")
|> Stream.take(25)
|> Stream.map(&Map.get(&1, "ip"))
|> Enum.to_list()
["10.0.0.6", "10.2.0.1", ...]
Specs
view(String.t(), DateTime.t() | nil) :: CensysEx.result()
Hits the Censys Hosts view API. Returning full information about an IP at a given time
Examples
CensysEx.Hosts.view("127.0.0.1")
# View "127.0.0.1" at a certain time
CensysEx.Hosts.view("127.0.0.1", ~U[2021-06-07 12:53:27.450073Z])