class Ryo::Plugin::Shodan
Attributes
client[R]
Public Class Methods
discover(ip)
click to toggle source
# File lib/ryo/plugin/shodan.rb, line 18 def self.discover(ip) new.discover(ip) rescue ArgumentError => e { error: e.to_s } rescue StandardError => e { error: e.to_s } end
new()
click to toggle source
# File lib/ryo/plugin/shodan.rb, line 9 def initialize raise ArgumentError, "Please set your Shodan API key via ENV['SHODAN_API_KEY']" unless ENV["SHODAN_API_KEY"] @client = Shodanz.client.new end
Public Instance Methods
discover(ip)
click to toggle source
# File lib/ryo/plugin/shodan.rb, line 14 def discover(ip) ip == "N/A" ? { error: "Invalid IP" } : client.rest_api.host(ip) end