class Apullo::CLI

Public Instance Methods

build_results(target, headers: {}) click to toggle source
# File lib/apullo/cli.rb, line 23
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
check(target) click to toggle source
# File lib/apullo/cli.rb, line 11
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