Class: Options
- Inherits:
-
Object
- Object
- Options
- Defined in:
- lib/api-options.rb
Overview
Defines options to be executed against the NeXpose API
Class Method Summary collapse
Class Method Details
.parse(args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/api-options.rb', line 8 def self.parse(args) = OpenStruct.new .verbose = false option_parser = OptionParser.new do |option_parser| option_parser.on("-h HOST", "The network address of the NeXpose instance - Required") {|arg| .host=arg} option_parser.on("-u USER", "The user name - Required") {|arg| .user=arg} option_parser.on("-p PASSWORD", "The password - Required") {|arg| .password=arg} option_parser.on("--n1", "List all the asset groups") {|arg| .key=1} option_parser.on("--n2 GI", "List an asset groups config. The GI (group id or group name is required)") do |arg| .key=2 .args=arg end option_parser.on("--ses params", "Start an asset group excluded scan where params are a comma separated list of the site-id to scan followed by asset group id(s) to exclude") do |arg| .key=3 .args=arg.chomp end option_parser.on_tail("--help", "Help") do puts option_parser exit 0 end end begin option_parser.parse!(args) rescue OptionParser::ParseError => e puts "#{e}\n\n#{option_parser}" exit 1 end end |