Project

censysx

0.0
No release in over 3 years
Low commit activity in last 3 years
Censys Search v2 API wrapper for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.7
~> 13.0
~> 3.10
~> 1.16
~> 6.0
~> 3.13
 Project Readme

Censysx

Gem Version

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:

# in this case, it tries to load ID and secret from ENV
# - ENV["CENSYS_ID"] for the ID
# - ENV["CENSYS_SECRET"] for the secret
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.