Sha256: 69b9d846e2e741118668b64be0e3511b41562a5accb8a72c85170eed07d3c581

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

require "thor"

require "json"

module Tansaku
  class CLI < Thor
    desc "crawl URL", "Crawl a given URL"
    method_option :additional_list, desc: "Path to the file which includes additonal paths to crawl"
    method_option :host, type: :string, desc: "Host header to use"
    method_option :threads, type: :numeric, desc: "Number of threads to use"
    method_option :type, desc: "Type of a list to crawl (admin, backup, database, etc, log or all)", default: "all"
    method_option :user_agent, type: :string, desc: "User-Agent header to use"
    def crawl(url)
      params = options.compact.map { |k, v| [k.to_sym, v] }.to_h
      begin
        crawler = Crawler.new(url, **params)
        results = crawler.crawl
        puts results.to_json
      rescue ArgumentError => e
        puts e
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tansaku-0.3.0 lib/tansaku/cli.rb