Sha256: e86e267a1bc004802bf6aa43a6f785e8e1219c12b9e948d79f74768406aa9e6f
Contents?: true
Size: 1014 Bytes
Versions: 3
Compression:
Stored size: 1014 Bytes
Contents
# frozen_string_literal: true require "json" require "parallel" require "thor" module Apullo class CLI < Thor desc "check [Target]", "Take fingerprints from a target(IP, domain or URL)" method_option :headers, type: :hash, default: {} def check(target) target = Target.new(target) headers = options["headers"] results = build_results(target, headers: headers) meta = { target: target.id } results = results.merge(meta: meta) puts JSON.pretty_generate(results) end no_commands do def build_results(target, headers: {}) unless target.valid? return { error: "Invalid target is given. Target should be an IP, domain or URL." } end Parallel.map(Apullo.fingerprints) do |klass| fingerprint = klass.new(target) fingerprint.headers = headers if fingerprint.respond_to?(:headers=) [fingerprint.name, fingerprint.results] end.to_h end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
apullo-0.2.0 | lib/apullo/cli.rb |
apullo-0.1.5 | lib/apullo/cli.rb |
apullo-0.1.4 | lib/apullo/cli.rb |