Class: Tinfoil::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/tinfoil/cli.rb

Constant Summary collapse

DEFAULT_OUTPUT_FILE =
'results.txt'

Class Method Summary collapse

Class Method Details

.run(args, stdout = $stdout, stderr = $stderr) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tinfoil/cli.rb', line 8

def self.run (args, stdout=$stdout, stderr=$stderr)
  @@options = default_options
  parse(args, @@options)

  if @@server.nil?
    $stderr.puts banner
    raise AbnormalProgramExitError
  end

  scanner = Tinfoil::Scanner.new
  result = scanner.scan(@@server, @@options)

  result.each_pair do |protocol, headers|
    $stdout.puts "protocol: #{protocol}"

    $stdout.puts "headers:"
    headers.each do |header|
      $stdout.puts "\t#{header}"
    end
  end
end