Sha256: a3a4e351dacb3d74847f0d8285cd5af3e84d1ae74d865e5ab27e6cc48bbeac61

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

require "thor"
require "json"

module Apullo
  class CLI < Thor
    desc "check [Target]", "Take fingerprints from a target(IP, domain or URL)"
    def check(target)
      target = Target.new(target)

      results = build_results(target)
      meta = { target: target.id }
      results = results.merge(meta: meta)

      puts JSON.pretty_generate(results)
    end

    no_commands do
      def build_results(target)
        unless target.valid?
          return {
            error: "Invalid target is given. Target should be an IP, domain or URL."
          }
        end

        Apullo.fingerprints.map do |klass|
          fingerprint = klass.new(target)
          [fingerprint.name, fingerprint.results]
        end.to_h
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apullo-0.1.1 lib/apullo/cli.rb
apullo-0.1.0 lib/apullo/cli.rb