Censysx
A Censys Search v2 API wrapper for Ruby. 💎
Installation
gem install censysx
Usage
Initialize the API:
require "censys"
api = Censys::API.new(id, secret)
You can initialize the API by using $CENSYS_ID
and $CENSYS_SECRET
environment variables:
api = Censys::API.new
View:
response = api.view("1.1.1.1")
response = api.view("1.1.1.1", at_time: "2021-03-01T00:00:00.000000Z")
Search:
response = api.search(query, cursor: cursor)
Search with cursor:
cursor = nil
loop do
response = api.search(query, cursor: cursor)
links = response.dig("result", "links")
cursor = links["next"]
break if cursor == ""
end
Aggregate:
response = api.aggregate(query, field)
response = api.aggregate(query, field, num_buckets: num_buckets)
License
The gem is available as open source under the terms of the MIT License.