class Ryo::CLI

Public Instance Methods

all(url) click to toggle source
# File lib/ryo/cli.rb, line 53
def all(url)
  hash = run_discovery(url, all: true)
  puts hash.to_json
end
dir(url) click to toggle source
# File lib/ryo/cli.rb, line 6
def dir(url)
  hash = run_discovery(url, dir: true)
  puts hash.to_json
end
discovery(url) click to toggle source
# File lib/ryo/cli.rb, line 47
def discovery(url)
  hash = run_discovery(url, options)
  puts hash.to_json
end
dns(url) click to toggle source
# File lib/ryo/cli.rb, line 12
def dns(url)
  hash = run_discovery(url, dns: true)
  puts hash.to_json
end
run_discovery(url, options) click to toggle source
# File lib/ryo/cli.rb, line 68
def run_discovery(url, options)
  validate_url(url)
  validate_options(options)
  Ryo.discover url, options
rescue InvalidURLError => _
  { error: "Please input a valid URL" }
rescue InvalidOptionsError => _
  { error: "Please input at least one option" }
rescue StandardError => e
  { error: "Warning: #{e}" }
end
shodan(url) click to toggle source
# File lib/ryo/cli.rb, line 18
def shodan(url)
  hash = run_discovery(url, shodan: true)
  puts hash.to_json
end
subdomain(url) click to toggle source
# File lib/ryo/cli.rb, line 24
def subdomain(url)
  hash = run_discovery(url, subdomain: true)
  puts hash.to_json
end
tech(url) click to toggle source
# File lib/ryo/cli.rb, line 30
def tech(url)
  hash = run_discovery(url, tech: true)
  puts hash.to_json
end
validate_options(options) click to toggle source
# File lib/ryo/cli.rb, line 64
def validate_options(options)
  raise InvalidOptionsError unless options.any? { |_, v| v }
end
validate_url(url) click to toggle source
# File lib/ryo/cli.rb, line 59
def validate_url(url)
  uri = URI.parse(url)
  raise InvalidURLError unless %w(http https).include?(uri.scheme)
end
whois(url) click to toggle source
# File lib/ryo/cli.rb, line 36
def whois(url)
  hash = run_discovery(url, whois: true)
  puts hash.to_json
end