Class: Pentest::Commandline
- Inherits:
-
Object
- Object
- Pentest::Commandline
- Defined in:
- lib/pentest/commandline.rb
Overview
Implements Command-Line Interface of Pentest
Class Method Summary collapse
- .create_option_parser(options) ⇒ Object
- .get_options ⇒ Object
-
.run(default_app_path = ".") ⇒ Object
Runs everything:.
Class Method Details
.create_option_parser(options) ⇒ Object
34 35 36 37 38 |
# File 'lib/pentest/commandline.rb', line 34 def create_option_parser OptionParser.new do |opts| opts. = "Usage: pentest [options] rails/root/path" end end |
.get_options ⇒ Object
27 28 29 30 31 32 |
# File 'lib/pentest/commandline.rb', line 27 def = {} parser = create_option_parser args = parser.parse! ARGV [, args] end |
.run(default_app_path = ".") ⇒ Object
Runs everything:
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pentest/commandline.rb', line 9 def run default_app_path = "." , args = if args.size >= 1 [:app_path] = args[0] else [:app_path] = default_app_path end result = Pentest.run .merge(:print_report => true) if result.nil? exit 0 else exit 1 end end |