Class: ExploitRunDescription
- Inherits:
-
Object
- Object
- ExploitRunDescription
- Defined in:
- lib/metasploit/exploit_run_description.rb
Constant Summary collapse
- @@port_value =
''
- @@uri_value =
''
- @@use_ssl_value =
''
- @@device_ip_to_scan_value =
''
- @@use_os_filter_value =
''
Instance Attribute Summary collapse
-
#connection_url ⇒ Object
Returns the value of attribute connection_url.
-
#device_ip_to_scan ⇒ Object
Returns the value of attribute device_ip_to_scan.
-
#module_filter ⇒ Object
Returns the value of attribute module_filter.
-
#nexpose_console_name ⇒ Object
Returns the value of attribute nexpose_console_name.
-
#port ⇒ Object
Returns the value of attribute port.
-
#report_type ⇒ Object
Returns the value of attribute report_type.
-
#token ⇒ Object
Returns the value of attribute token.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#use_os_filter ⇒ Object
Returns the value of attribute use_os_filter.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
-
#whitelist_hosts ⇒ Object
Returns the value of attribute whitelist_hosts.
-
#workspace_name ⇒ Object
Returns the value of attribute workspace_name.
Instance Method Summary collapse
- #get_audit_options ⇒ Object
- #get_exploit_options ⇒ Object
- #get_options ⇒ Object
- #get_report_options ⇒ Object
- #get_value(value_to_check, default) ⇒ Object
-
#initialize(options) ⇒ ExploitRunDescription
constructor
A new instance of ExploitRunDescription.
- #to_bool(str) ⇒ Object
- #verify ⇒ Object
Constructor Details
#initialize(options) ⇒ ExploitRunDescription
Returns a new instance of ExploitRunDescription.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/metasploit/exploit_run_description.rb', line 23 def initialize() if File.file?('config/exploit.yml') = YAML.load_file('config/exploit.yml') end self.connection_url = ['connection_url'] @@port_value = ['port'] @@uri_value = ['uri'] @@use_ssl_value = ['use_ssl'] self.token = ['token'] self.workspace_name = ['workspace_name'] self.nexpose_console_name = ['nexpose_console_name'] @@device_ip_to_scan_value = ['device_ip_to_scan'] self.use_os_filter = ['use_os_filter'] self.module_filter = ['module_filter'] self.report_type = ['report_type'] self.whitelist_hosts = ['whitelist_hosts'] end |
Instance Attribute Details
#connection_url ⇒ Object
Returns the value of attribute connection_url.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def connection_url @connection_url end |
#device_ip_to_scan ⇒ Object
Returns the value of attribute device_ip_to_scan.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def device_ip_to_scan @device_ip_to_scan end |
#module_filter ⇒ Object
Returns the value of attribute module_filter.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def module_filter @module_filter end |
#nexpose_console_name ⇒ Object
Returns the value of attribute nexpose_console_name.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def nexpose_console_name @nexpose_console_name end |
#port ⇒ Object
Returns the value of attribute port.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def port @port end |
#report_type ⇒ Object
Returns the value of attribute report_type.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def report_type @report_type end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def token @token end |
#uri ⇒ Object
Returns the value of attribute uri.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def uri @uri end |
#use_os_filter ⇒ Object
Returns the value of attribute use_os_filter.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def use_os_filter @use_os_filter end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def use_ssl @use_ssl end |
#whitelist_hosts ⇒ Object
Returns the value of attribute whitelist_hosts.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def whitelist_hosts @whitelist_hosts end |
#workspace_name ⇒ Object
Returns the value of attribute workspace_name.
4 5 6 |
# File 'lib/metasploit/exploit_run_description.rb', line 4 def workspace_name @workspace_name end |
Instance Method Details
#get_audit_options ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/metasploit/exploit_run_description.rb', line 64 def { "workspace" => self.workspace_name, "DS_URLS" => self.device_ip_to_scan, "DS_MAX_REQUESTS" => 1000, "DS_MAX_MINUTES" => 3, "DS_MAX_THREADS" => 5, "DS_MAX_INSTANCES" => 3} end |
#get_exploit_options ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/metasploit/exploit_run_description.rb', line 73 def { "workspace" => self.workspace_name, "DS_WHITELIST_HOSTS" => self.whitelist_hosts, "DS_MinimumRank" => "great", "DS_EXPLOIT_SPEED" => 5, "DS_EXPLOIT_TIMEOUT" => 2, "DS_LimitSessions" => true, "DS_MATCH_VULNS" => true, "DS_MATCH_PORTS" => true, "DS_FilterByOS" => self.use_os_filter, "DS_ModuleFilter" => self.module_filter} end |
#get_options ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/metasploit/exploit_run_description.rb', line 48 def {:host => self.connection_url, :port => self.port, :token => self.token, :uri => self.uri, :ssl => self.use_ssl, :ssl_version => 'TLS1' } end |
#get_report_options ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/metasploit/exploit_run_description.rb', line 86 def { 'workspace' => self.workspace_name, 'name' => self.workspace_name, 'report_type' => self.report_type, 'created_by' => self.workspace_name, 'file_formats' => [:pdf], 'DS_WHITELIST_HOSTS' => self.device_ip_to_scan } end |
#get_value(value_to_check, default) ⇒ Object
145 146 147 |
# File 'lib/metasploit/exploit_run_description.rb', line 145 def get_value(value_to_check, default) (value_to_check.nil? || value_to_check.empty?) ? default : value_to_check end |
#to_bool(str) ⇒ Object
149 150 151 |
# File 'lib/metasploit/exploit_run_description.rb', line 149 def to_bool(str) str == 'true' end |
#verify ⇒ Object
41 42 43 44 45 46 |
# File 'lib/metasploit/exploit_run_description.rb', line 41 def verify raise StandardError, CONSTANTS::REQUIRED_TOKEN_MESSAGE if token.nil? || token.empty? raise StandardError, CONSTANTS::REQUIRED_CONNECTION_URL_MESSAGE if connection_url.nil? || connection_url.empty? raise StandardError, CONSTANTS::REQUIRED_DEVICE_IP_TO_SCAN_MESSAGE if device_ip_to_scan.nil? || device_ip_to_scan.empty? raise StandardError, CONSTANTS::REQUIRED_WORKSPACE_MESSAGE if workspace_name.nil? || workspace_name.empty? end |