class Pentest::Commandline

Implements Command-Line Interface of Pentest

Public Class Methods

create_option_parser(options) click to toggle source
# File lib/pentest/commandline.rb, line 34
def create_option_parser options
  OptionParser.new do |opts|
    opts.banner = "Usage: pentest [options] rails/root/path"
  end
end
get_options() click to toggle source
# File lib/pentest/commandline.rb, line 27
def get_options
  options = {}
  parser = create_option_parser options
  args = parser.parse! ARGV
  [options, args]
end
run(default_app_path = ".") click to toggle source

Runs everything:

# File lib/pentest/commandline.rb, line 9
def run default_app_path = "."
  options, args = get_options

  if args.size >= 1
    options[:app_path] = args[0]
  else
    options[:app_path] = default_app_path
  end

  result = Pentest.run options.merge(:print_report => true)

  if result.nil?
    exit 0
  else
    exit 1
  end
end