Sha256: 0b108c6caa9e8f52c37eb01494947a6c29af7c15f4d6c6db317977f97a86e083

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Ryo
  class CLI < Thor
    desc "dir URL", "Discover directories and files belong to a given URL"
    def dir(url)
      hash = discover(url, dir: true)
      puts hash.to_json
    end

    desc "subdomain URL", "Discover subdomains of a given URL"
    def subdomain(url)
      hash = discover(url, subdomain: true)
      puts hash.to_json
    end

    desc "tech URL", "Discover used technolgies of a given URL"
    def tech(url)
      hash = discover(url, tech: true)
      puts hash.to_json
    end

    desc "whois URL", "Discover whois information of a given URL"
    def whois(url)
      hash = discover(url, whois: true)
      puts hash.to_json
    end

    desc "all URL", "Run all discovery plugins against a given URL"
    def all(url)
      hash = discover(url, all: true)
      puts hash.to_json
    end

    no_commands do
      def discover(url, options)
        Ryo.discover url, options
      rescue StandardError => e
        { error: "Warning: #{e}" }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ryo-0.1.0 lib/ryo/cli.rb