Class: Options
- Inherits:
-
Object
- Object
- Options
- Defined in:
- lib/report_generator_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 41 42 43 44 45 |
# File 'lib/report_generator_options.rb', line 8 def self.parse(args) = OpenStruct.new .verbose = false .port = 3780 .dbn = 'nexpose' .dbu = 'nxpgsql' .separator = ',' .host = 'localhost' .report_vuln_only = false .sites = nil .headers = 'Vulnerable Status,Port Details,HostName,IP,Vulnerability Description,Vulnerability Remediations,Unique ID,Operating System,Vulnerability Category,Vulnerability Proof,CVSS Score' option_parser = OptionParser.new do |option_parser| option_parser.on("-h host", "The network address of the NeXpose instance - Defaults to 'localhost'") {|arg| .host=arg.chomp} option_parser.on("-u user_name", "The NeXpose user name - Required") {|arg| .user=arg.chomp} option_parser.on("-p password", "The NeXpose password - Required") {|arg| .password=arg.chomp} option_parser.on("-s delimeter", "The report delimiter - Defaults to ','") {|arg| .separator=arg.chomp} option_parser.on("-v [true|false]", "Report on vulnerable data only - Defaults to false") {|arg| .report_vuln_only=arg.chomp} option_parser.on("--sites site1,site2", "A list of sites to report on - Defaults to ALL") {|arg| .sites=arg.chomp} option_parser.on("--port port", "The NSC port - Defaults to 3780") {|arg| .port=arg.chomp} option_parser.on("--ofn file", "The output file name -Required") {|arg| .ofn=arg.chomp} option_parser.on("--headers headers", "A comma separated list of the headers -Default #{.headers}") {|arg| .headers=arg.chomp} 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 |