Files
metasploit-gs/api/Msf/OptionalSession.html
T
jenkins-metasploit c3f5bd3de2 Reboot gh-pages
2026-05-08 17:08:43 +00:00

746 lines
34 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Msf::OptionalSession
&mdash; Documentation by YARD 0.9.37
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Msf::OptionalSession";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (O)</a> &raquo;
<span class='title'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span>
&raquo;
<span class="title">OptionalSession</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Msf::OptionalSession
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd><span class='object_link'><a href="SessionCompatibility.html" title="Msf::SessionCompatibility (module)">SessionCompatibility</a></span></dd>
</dl>
<dl>
<dt>Included in:</dt>
<dd><span class='object_link'><a href="OptionalSession/LDAP.html" title="Msf::OptionalSession::LDAP (module)">LDAP</a></span>, <span class='object_link'><a href="OptionalSession/MSSQL.html" title="Msf::OptionalSession::MSSQL (module)">MSSQL</a></span>, <span class='object_link'><a href="OptionalSession/MySQL.html" title="Msf::OptionalSession::MySQL (module)">MySQL</a></span>, <span class='object_link'><a href="OptionalSession/PostgreSQL.html" title="Msf::OptionalSession::PostgreSQL (module)">PostgreSQL</a></span>, <span class='object_link'><a href="OptionalSession/SMB.html" title="Msf::OptionalSession::SMB (module)">SMB</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/optional_session.rb<span class="defines">,<br />
lib/msf/core/optional_session/smb.rb,<br /> lib/msf/core/optional_session/ldap.rb,<br /> lib/msf/core/optional_session/mssql.rb,<br /> lib/msf/core/optional_session/mysql.rb,<br /> lib/msf/core/optional_session/postgresql.rb</span>
</dd>
</dl>
</div>
<h2>Defined Under Namespace</h2>
<p class="children">
<strong class="modules">Modules:</strong> <span class='object_link'><a href="OptionalSession/LDAP.html" title="Msf::OptionalSession::LDAP (module)">LDAP</a></span>, <span class='object_link'><a href="OptionalSession/MSSQL.html" title="Msf::OptionalSession::MSSQL (module)">MSSQL</a></span>, <span class='object_link'><a href="OptionalSession/MySQL.html" title="Msf::OptionalSession::MySQL (module)">MySQL</a></span>, <span class='object_link'><a href="OptionalSession/PostgreSQL.html" title="Msf::OptionalSession::PostgreSQL (module)">PostgreSQL</a></span>, <span class='object_link'><a href="OptionalSession/SMB.html" title="Msf::OptionalSession::SMB (module)">SMB</a></span>
</p>
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#session_or_rhost_required-instance_method" title="#session_or_rhost_required (instance method)">#<strong>session_or_rhost_required</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute session_or_rhost_required.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Attributes included from <span class='object_link'><a href="SessionCompatibility.html" title="Msf::SessionCompatibility (module)">SessionCompatibility</a></span></h3>
<p class="inherited"><span class='object_link'><a href="SessionCompatibility.html#passive-instance_method" title="Msf::SessionCompatibility#passive (method)">#passive</a></span>, <span class='object_link'><a href="SessionCompatibility.html#session_types-instance_method" title="Msf::SessionCompatibility#session_types (method)">#session_types</a></span></p>
<h3 class="inherited">Attributes included from <span class='object_link'><a href="Module/HasActions.html" title="Msf::Module::HasActions (module)">Module::HasActions</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Module/HasActions.html#actions-instance_method" title="Msf::Module::HasActions#actions (method)">#actions</a></span>, <span class='object_link'><a href="Module/HasActions.html#default_action-instance_method" title="Msf::Module::HasActions#default_action (method)">#default_action</a></span>, <span class='object_link'><a href="Module/HasActions.html#passive-instance_method" title="Msf::Module::HasActions#passive (method)">#passive</a></span>, <span class='object_link'><a href="Module/HasActions.html#passive_actions-instance_method" title="Msf::Module::HasActions#passive_actions (method)">#passive_actions</a></span></p>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#session-instance_method" title="#session (instance method)">#<strong>session</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#session_or_rhost_required%3F-instance_method" title="#session_or_rhost_required? (instance method)">#<strong>session_or_rhost_required?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate-instance_method" title="#validate (instance method)">#<strong>validate</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Validates options depending on whether we are using SESSION or an RHOST for our connection.</p>
</div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#validate_group-instance_method" title="#validate_group (instance method)">#<strong>validate_group</strong>(group_name) &#x21d2; Object </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'>
<p>Validates the options within an option group.</p>
</div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#validate_rhost-instance_method" title="#validate_rhost (instance method)">#<strong>validate_rhost</strong> &#x21d2; Object </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'>
<p>Used to validate options when RHOST has been set.</p>
</div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#validate_session-instance_method" title="#validate_session (instance method)">#<strong>validate_session</strong> &#x21d2; Object </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'>
<p>Used to validate options when SESSION has been set.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Methods included from <span class='object_link'><a href="SessionCompatibility.html" title="Msf::SessionCompatibility (module)">SessionCompatibility</a></span></h3>
<p class="inherited"><span class='object_link'><a href="SessionCompatibility.html#check_for_session_readiness-instance_method" title="Msf::SessionCompatibility#check_for_session_readiness (method)">#check_for_session_readiness</a></span>, <span class='object_link'><a href="SessionCompatibility.html#cleanup-instance_method" title="Msf::SessionCompatibility#cleanup (method)">#cleanup</a></span>, <span class='object_link'><a href="SessionCompatibility.html#command_names_for-instance_method" title="Msf::SessionCompatibility#command_names_for (method)">#command_names_for</a></span>, <span class='object_link'><a href="SessionCompatibility.html#compatible_sessions-instance_method" title="Msf::SessionCompatibility#compatible_sessions (method)">#compatible_sessions</a></span>, <span class='object_link'><a href="SessionCompatibility.html#initialize-instance_method" title="Msf::SessionCompatibility#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="SessionCompatibility.html#meterpreter_session_incompatibility_reasons-instance_method" title="Msf::SessionCompatibility#meterpreter_session_incompatibility_reasons (method)">#meterpreter_session_incompatibility_reasons</a></span>, <span class='object_link'><a href="SessionCompatibility.html#passive%3F-instance_method" title="Msf::SessionCompatibility#passive? (method)">#passive?</a></span>, <span class='object_link'><a href="SessionCompatibility.html#post_commands-instance_method" title="Msf::SessionCompatibility#post_commands (method)">#post_commands</a></span>, <span class='object_link'><a href="SessionCompatibility.html#session_changed%3F-instance_method" title="Msf::SessionCompatibility#session_changed? (method)">#session_changed?</a></span>, <span class='object_link'><a href="SessionCompatibility.html#session_compatible%3F-instance_method" title="Msf::SessionCompatibility#session_compatible? (method)">#session_compatible?</a></span>, <span class='object_link'><a href="SessionCompatibility.html#session_display_info-instance_method" title="Msf::SessionCompatibility#session_display_info (method)">#session_display_info</a></span>, <span class='object_link'><a href="SessionCompatibility.html#session_incompatibility_reasons-instance_method" title="Msf::SessionCompatibility#session_incompatibility_reasons (method)">#session_incompatibility_reasons</a></span>, <span class='object_link'><a href="SessionCompatibility.html#setup-instance_method" title="Msf::SessionCompatibility#setup (method)">#setup</a></span>, <span class='object_link'><a href="SessionCompatibility.html#sysinfo-instance_method" title="Msf::SessionCompatibility#sysinfo (method)">#sysinfo</a></span></p>
<h3 class="inherited">Methods included from <span class='object_link'><a href="Post/Common.html" title="Msf::Post::Common (module)">Post::Common</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Post/Common.html#clear_screen-instance_method" title="Msf::Post::Common#clear_screen (method)">#clear_screen</a></span>, <span class='object_link'><a href="Post/Common.html#cmd_exec-instance_method" title="Msf::Post::Common#cmd_exec (method)">#cmd_exec</a></span>, <span class='object_link'><a href="Post/Common.html#cmd_exec_get_pid-instance_method" title="Msf::Post::Common#cmd_exec_get_pid (method)">#cmd_exec_get_pid</a></span>, <span class='object_link'><a href="Post/Common.html#cmd_exec_with_result-instance_method" title="Msf::Post::Common#cmd_exec_with_result (method)">#cmd_exec_with_result</a></span>, <span class='object_link'><a href="Post/Common.html#command_exists%3F-instance_method" title="Msf::Post::Common#command_exists? (method)">#command_exists?</a></span>, <span class='object_link'><a href="Post/Common.html#create_process-instance_method" title="Msf::Post::Common#create_process (method)">#create_process</a></span>, <span class='object_link'><a href="Post/Common.html#get_env-instance_method" title="Msf::Post::Common#get_env (method)">#get_env</a></span>, <span class='object_link'><a href="Post/Common.html#get_envs-instance_method" title="Msf::Post::Common#get_envs (method)">#get_envs</a></span>, <span class='object_link'><a href="Post/Common.html#initialize-instance_method" title="Msf::Post::Common#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Post/Common.html#peer-instance_method" title="Msf::Post::Common#peer (method)">#peer</a></span>, <span class='object_link'><a href="Post/Common.html#report_virtualization-instance_method" title="Msf::Post::Common#report_virtualization (method)">#report_virtualization</a></span>, <span class='object_link'><a href="Post/Common.html#rhost-instance_method" title="Msf::Post::Common#rhost (method)">#rhost</a></span>, <span class='object_link'><a href="Post/Common.html#rport-instance_method" title="Msf::Post::Common#rport (method)">#rport</a></span></p>
<h3 class="inherited">Methods included from <span class='object_link'><a href="Module/HasActions.html" title="Msf::Module::HasActions (module)">Module::HasActions</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Module/HasActions.html#action-instance_method" title="Msf::Module::HasActions#action (method)">#action</a></span>, <span class='object_link'><a href="Module/HasActions.html#find_action-instance_method" title="Msf::Module::HasActions#find_action (method)">#find_action</a></span>, <span class='object_link'><a href="Module/HasActions.html#initialize-instance_method" title="Msf::Module::HasActions#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Module/HasActions.html#passive%3F-instance_method" title="Msf::Module::HasActions#passive? (method)">#passive?</a></span>, <span class='object_link'><a href="Module/HasActions.html#passive_action%3F-instance_method" title="Msf::Module::HasActions#passive_action? (method)">#passive_action?</a></span></p>
<h3 class="inherited">Methods included from <span class='object_link'><a href="Auxiliary/Report.html" title="Msf::Auxiliary::Report (module)">Auxiliary::Report</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Auxiliary/Report.html#active_db%3F-instance_method" title="Msf::Auxiliary::Report#active_db? (method)">#active_db?</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_cracked_credential-instance_method" title="Msf::Auxiliary::Report#create_cracked_credential (method)">#create_cracked_credential</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_credential-instance_method" title="Msf::Auxiliary::Report#create_credential (method)">#create_credential</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_credential_and_login-instance_method" title="Msf::Auxiliary::Report#create_credential_and_login (method)">#create_credential_and_login</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_credential_login-instance_method" title="Msf::Auxiliary::Report#create_credential_login (method)">#create_credential_login</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#db-instance_method" title="Msf::Auxiliary::Report#db (method)">#db</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#db_warning_given%3F-instance_method" title="Msf::Auxiliary::Report#db_warning_given? (method)">#db_warning_given?</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#get_client-instance_method" title="Msf::Auxiliary::Report#get_client (method)">#get_client</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#get_host-instance_method" title="Msf::Auxiliary::Report#get_host (method)">#get_host</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#inside_workspace_boundary%3F-instance_method" title="Msf::Auxiliary::Report#inside_workspace_boundary? (method)">#inside_workspace_boundary?</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#invalidate_login-instance_method" title="Msf::Auxiliary::Report#invalidate_login (method)">#invalidate_login</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#mytask-instance_method" title="Msf::Auxiliary::Report#mytask (method)">#mytask</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#myworkspace-instance_method" title="Msf::Auxiliary::Report#myworkspace (method)">#myworkspace</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#myworkspace_id-instance_method" title="Msf::Auxiliary::Report#myworkspace_id (method)">#myworkspace_id</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_auth_info-instance_method" title="Msf::Auxiliary::Report#report_auth_info (method)">#report_auth_info</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_client-instance_method" title="Msf::Auxiliary::Report#report_client (method)">#report_client</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_exploit-instance_method" title="Msf::Auxiliary::Report#report_exploit (method)">#report_exploit</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_host-instance_method" title="Msf::Auxiliary::Report#report_host (method)">#report_host</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_loot-instance_method" title="Msf::Auxiliary::Report#report_loot (method)">#report_loot</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_note-instance_method" title="Msf::Auxiliary::Report#report_note (method)">#report_note</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_service-instance_method" title="Msf::Auxiliary::Report#report_service (method)">#report_service</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_vuln-instance_method" title="Msf::Auxiliary::Report#report_vuln (method)">#report_vuln</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_form-instance_method" title="Msf::Auxiliary::Report#report_web_form (method)">#report_web_form</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_page-instance_method" title="Msf::Auxiliary::Report#report_web_page (method)">#report_web_page</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_site-instance_method" title="Msf::Auxiliary::Report#report_web_site (method)">#report_web_site</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_vuln-instance_method" title="Msf::Auxiliary::Report#report_web_vuln (method)">#report_web_vuln</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#store_cred-instance_method" title="Msf::Auxiliary::Report#store_cred (method)">#store_cred</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#store_local-instance_method" title="Msf::Auxiliary::Report#store_local (method)">#store_local</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#store_loot-instance_method" title="Msf::Auxiliary::Report#store_loot (method)">#store_loot</a></span></p>
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Metasploit/Framework/Require.html" title="Metasploit::Framework::Require (module)">Metasploit::Framework::Require</a></span></h3>
<p class="inherited"><span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally-class_method" title="Metasploit::Framework::Require.optionally (method)">optionally</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_active_record_railtie-class_method" title="Metasploit::Framework::Require.optionally_active_record_railtie (method)">optionally_active_record_railtie</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_include_metasploit_credential_creation-class_method" title="Metasploit::Framework::Require.optionally_include_metasploit_credential_creation (method)">optionally_include_metasploit_credential_creation</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_include_metasploit_credential_creation-instance_method" title="Metasploit::Framework::Require#optionally_include_metasploit_credential_creation (method)">#optionally_include_metasploit_credential_creation</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_require_metasploit_db_gem_engines-class_method" title="Metasploit::Framework::Require.optionally_require_metasploit_db_gem_engines (method)">optionally_require_metasploit_db_gem_engines</a></span></p>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id="session_or_rhost_required=-instance_method"></span>
<div class="method_details first">
<h3 class="signature first" id="session_or_rhost_required-instance_method">
#<strong>session_or_rhost_required</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute session_or_rhost_required.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
11
12
13</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/optional_session.rb', line 11</span>
<span class='kw'>def</span> <span class='id identifier rubyid_session_or_rhost_required'>session_or_rhost_required</span>
<span class='ivar'>@session_or_rhost_required</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="session-instance_method">
#<strong>session</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
32
33
34
35
36</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/optional_session.rb', line 32</span>
<span class='kw'>def</span> <span class='id identifier rubyid_session'>session</span>
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_optional_session_enabled?'>optional_session_enabled?</span>
<span class='kw'>super</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="session_or_rhost_required?-instance_method">
#<strong>session_or_rhost_required?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
13
14
15</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/optional_session.rb', line 13</span>
<span class='kw'>def</span> <span class='id identifier rubyid_session_or_rhost_required?'>session_or_rhost_required?</span>
<span class='ivar'>@session_or_rhost_required</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='ivar'>@session_or_rhost_required</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate-instance_method">
#<strong>validate</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Validates options depending on whether we are using SESSION or an RHOST for our connection</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
18
19
20
21
22
23
24
25
26
27
28
29
30</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/optional_session.rb', line 18</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate'>validate</span>
<span class='kw'>super</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_optional_session_enabled?'>optional_session_enabled?</span>
<span class='comment'># If the session is set use that by default regardless of rhost being (un)set
</span> <span class='kw'>if</span> <span class='id identifier rubyid_session'>session</span>
<span class='id identifier rubyid_validate_session'>validate_session</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_rhost'>rhost</span>
<span class='id identifier rubyid_validate_rhost'>validate_rhost</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_session_or_rhost_required?'>session_or_rhost_required?</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">OptionValidateError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="OptionValidateError.html#initialize-instance_method" title="Msf::OptionValidateError#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>message:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>A SESSION or RHOST must be provided</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_group-instance_method">
#<strong>validate_group</strong>(group_name) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Validates the options within an option group</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>group_name</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>Name of the option group</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
59
60
61
62</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/optional_session.rb', line 59</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_group'>validate_group</span><span class='lparen'>(</span><span class='id identifier rubyid_group_name'>group_name</span><span class='rparen'>)</span>
<span class='id identifier rubyid_option_group'>option_group</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_groups'>groups</span><span class='lbracket'>[</span><span class='id identifier rubyid_group_name'>group_name</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_option_group'>option_group</span><span class='period'>.</span><span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_datastore'>datastore</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_option_group'>option_group</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_rhost-instance_method">
#<strong>validate_rhost</strong> &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Used to validate options when RHOST has been set</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
41
42
43</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/optional_session.rb', line 41</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_rhost'>validate_rhost</span>
<span class='id identifier rubyid_validate_group'>validate_group</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RHOST</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_session-instance_method">
#<strong>validate_session</strong> &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Used to validate options when SESSION has been set</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt><span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">Msf::OptionValidateError</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48
49
50
51
52
53
54</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/optional_session.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_session'>validate_session</span>
<span class='id identifier rubyid_issues'>issues</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>if</span> <span class='id identifier rubyid_session_types'>session_types</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_session_types'>session_types</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
<span class='id identifier rubyid_issues'>issues</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Incompatible session type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>. This module works with: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_session_types'>session_types</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>, </span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">OptionValidateError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="OptionValidateError.html#initialize-instance_method" title="Msf::OptionValidateError#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_issues'>issues</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='comma'>,</span> <span class='label'>reasons:</span> <span class='id identifier rubyid_issues'>issues</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_issues'>issues</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='id identifier rubyid_validate_group'>validate_group</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:01:14 2026 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.37 (ruby-3.1.5).
</div>
</div>
</body>
</html>