Sha256: 334cc4a80a789d54e3bd58c79d76196808a24a9cb8bf656feba8f3ac4ce0f932
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'pwn' require 'optparse' require 'yaml' opts = {} OptionParser.new do |options| options.banner = "USAGE: #{$PROGRAM_NAME} [opts] " options.on('-cYPATH', '--yaml-config=YPATH', '<Required - YAML Config Containing Access & Secret Keys for Authentication>') do |c| opts[:yaml_config] = c end options.on('-nVALUE', '--scan-template-name=VALUE', '<Optional - Name of Canned Scan Template to Use for Scan Creation (Defaults to "Basic Network Scan">') do |n| opts[:scan_template_name] = n end end.parse! if opts.empty? puts `#{$PROGRAM_NAME} --help` exit 1 end begin yaml_config = opts[:yaml_config] raise "YAML Config Not Found: #{yaml_config}" unless File.exist?(yaml_config) yaml = YAML.load_file( yaml_config, symbolize_names: true ) access_key = yaml[:access_key] secret_key = yaml[:secret_key] scan_template_name = opts[:scan_template_name] scan_template_name = 'Basic Network Scan' unless scan_template_name nessus_obj = PWN::Plugins::NessusCloud.login( access_key: access_key, secret_key: secret_key ) canned_scan_template_list = PWN::Plugins::NessusCloud.get_canned_scan_templates( nessus_obj: nessus_obj ) puts scan_template_list.inspect selected_scan_template = scan_template_list[:templates].select do |scan_template| scan_template[:title] == scan_template_name end puts selected_scan_template.inspect scan_template_id = selected_scan_template.first[:uuid] puts scan_template_id rescue Interrupt puts 'CTRL+C detected...goodbye.' rescue StandardError => e raise e end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pwn-0.4.424 | bin/pwn_nessus_cloud_create_scan |