Sha256: 9670a56cea5182cf7a527e0cc021aef313bb252cb6708cca1c73e49a3be630af

Contents?: true

Size: 585 Bytes

Versions: 6

Compression:

Stored size: 585 Bytes

Contents

# frozen_string_literal: true

require "censys"

module Osakana
  class Censys
    def initialize
      @censys = ::Censys::API.new
    end

    def lookup(query)
      res = @censys.ipv4.search(query: query)

      websites = []
      res.each_page do |page|
        page.each do |result|
          ipv4 = result.ip
          view = @censys.ipv4[ipv4]
          updated_at = view.dig("updated_at")
          websites << Website.new(ipv4: result.to_s, date: updated_at)
        end
      end
      websites
    end

    def self.lookup(query)
      new.lookup(query)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
osakana-0.4.0 lib/osakana/censys.rb
osakana-0.3.0 lib/osakana/censys.rb
osakana-0.2.1 lib/osakana/censys.rb
osakana-0.2.0 lib/osakana/censys.rb
osakana-0.1.1 lib/osakana/censys.rb
osakana-0.1.0 lib/osakana/censys.rb