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

696 lines
41 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Msf::Module::Failure
&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::Module::Failure";
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 (F)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Msf.html" title="Msf (module)">Msf</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Module</a></span></span>
&raquo;
<span class="title">Failure</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::Module::Failure
</h1>
<div class="box_info">
<dl>
<dt>Included in:</dt>
<dd><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/module/failure.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Constants indicating the reason for an unsuccessful module attempt</p>
</div>
</div>
<div class="tags">
</div>
<h2>
Constant Summary
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
</h2>
<dl class="constants">
<dt id="BadConfig-constant" class="">BadConfig =
<div class="docstring">
<div class="discussion">
<p>The exploit settings were incorrect</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bad-config</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="Disconnected-constant" class="">Disconnected =
<div class="docstring">
<div class="discussion">
<p>The network service disconnected us mid-attempt</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>disconnected</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="NoAccess-constant" class="">NoAccess =
<div class="docstring">
<div class="discussion">
<p>The application replied indication we do not have access</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>no-access</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="None-constant" class="">None =
<div class="docstring">
<div class="discussion">
<p>No confidence in success or failure</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>none</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="NoTarget-constant" class="">NoTarget =
<div class="docstring">
<div class="discussion">
<p>The target is not compatible with this exploit or settings</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>no-target</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="NotFound-constant" class="">NotFound =
<div class="docstring">
<div class="discussion">
<p>The application endpoint or specific service was not found</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>not-found</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="NotVulnerable-constant" class="">NotVulnerable =
<div class="docstring">
<div class="discussion">
<p>The application response indicated it was not vulnerable</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>not-vulnerable</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="PayloadFailed-constant" class="">PayloadFailed =
<div class="docstring">
<div class="discussion">
<p>The payload was delivered but no session was opened (AV, network, etc)</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>payload-failed</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="TimeoutExpired-constant" class="">TimeoutExpired =
<div class="docstring">
<div class="discussion">
<p>The exploit triggered some form of timeout</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>timeout-expired</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="UnexpectedReply-constant" class="">UnexpectedReply =
<div class="docstring">
<div class="discussion">
<p>The application replied in an unexpected fashion</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>unexpected-reply</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="Unknown-constant" class="">Unknown =
<div class="docstring">
<div class="discussion">
<p>No confidence in success or failure</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>unknown</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="Unreachable-constant" class="">Unreachable =
<div class="docstring">
<div class="discussion">
<p>The network service was unreachable (connection refused, etc)</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>unreachable</span><span class='tstring_end'>&#39;</span></span></pre></dd>
<dt id="UserInterrupt-constant" class="">UserInterrupt =
<div class="docstring">
<div class="discussion">
<p>The exploit was interrupted by the user</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>user-interrupt</span><span class='tstring_end'>&#39;</span></span></pre></dd>
</dl>
<h2>
Class Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#fail_reason_from_check_code-class_method" title="fail_reason_from_check_code (class method)">.<strong>fail_reason_from_check_code</strong>(check_code) &#x21d2; String<sup>?</sup> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Map a <span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">Exploit::CheckCode</a></span> to the corresponding fail_reason constant.</p>
</div></span>
</li>
</ul>
<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="#report_failure-instance_method" title="#report_failure (instance method)">#<strong>report_failure</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="fail_reason_from_check_code-class_method">
.<strong>fail_reason_from_check_code</strong>(check_code) &#x21d2; <tt>String</tt><sup>?</sup>
</h3><div class="docstring">
<div class="discussion">
<p>Map a <span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">Exploit::CheckCode</a></span> to the corresponding fail_reason constant.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>check_code</span>
<span class='type'>(<tt><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">Msf::Exploit::CheckCode</a></span></tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
&mdash;
<div class='inline'>
<p>a Failure constant, or nil if unmapped</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48
49
50
51
52
53
54
55
56
57</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/module/failure.rb', line 46</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fail_reason_from_check_code'>fail_reason_from_check_code</span><span class='lparen'>(</span><span class='id identifier rubyid_check_code'>check_code</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:code</span><span class='rparen'>)</span>
<span class='kw'>case</span> <span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
<span class='kw'>when</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Vulnerable-constant" title="Msf::Exploit::CheckCode::Vulnerable (constant)">Vulnerable</a></span></span><span class='period'>.</span><span class='id identifier rubyid_code'><span class='object_link'><a href="../Exploit/CheckCode.html#code-instance_method" title="Msf::Exploit::CheckCode#code (method)">code</a></span></span><span class='comma'>,</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Appears-constant" title="Msf::Exploit::CheckCode::Appears (constant)">Appears</a></span></span><span class='period'>.</span><span class='id identifier rubyid_code'><span class='object_link'><a href="../Exploit/CheckCode.html#code-instance_method" title="Msf::Exploit::CheckCode#code (method)">code</a></span></span>
<span class='const'><span class='object_link'><a href="#None-constant" title="Msf::Module::Failure::None (constant)">None</a></span></span>
<span class='kw'>when</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Safe-constant" title="Msf::Exploit::CheckCode::Safe (constant)">Safe</a></span></span><span class='period'>.</span><span class='id identifier rubyid_code'><span class='object_link'><a href="../Exploit/CheckCode.html#code-instance_method" title="Msf::Exploit::CheckCode#code (method)">code</a></span></span>
<span class='const'><span class='object_link'><a href="#NotVulnerable-constant" title="Msf::Module::Failure::NotVulnerable (constant)">NotVulnerable</a></span></span>
<span class='kw'>when</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Detected-constant" title="Msf::Exploit::CheckCode::Detected (constant)">Detected</a></span></span><span class='period'>.</span><span class='id identifier rubyid_code'><span class='object_link'><a href="../Exploit/CheckCode.html#code-instance_method" title="Msf::Exploit::CheckCode#code (method)">code</a></span></span><span class='comma'>,</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Unknown-constant" title="Msf::Exploit::CheckCode::Unknown (constant)">Unknown</a></span></span><span class='period'>.</span><span class='id identifier rubyid_code'><span class='object_link'><a href="../Exploit/CheckCode.html#code-instance_method" title="Msf::Exploit::CheckCode#code (method)">code</a></span></span>
<span class='const'><span class='object_link'><a href="#Unknown-constant" title="Msf::Module::Failure::Unknown (constant)">Unknown</a></span></span>
<span class='kw'>end</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="report_failure-instance_method">
#<strong>report_failure</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/module/failure.rb', line 60</span>
<span class='kw'>def</span> <span class='id identifier rubyid_report_failure'>report_failure</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_db'>db</span> <span class='kw'>and</span> <span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_db'>db</span><span class='period'>.</span><span class='id identifier rubyid_active'>active</span>
<span class='id identifier rubyid_info'>info</span> <span class='op'>=</span> <span class='lbrace'>{</span>
<span class='label'>timestamp:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='comma'>,</span>
<span class='label'>workspace:</span> <span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_db'>db</span><span class='period'>.</span><span class='id identifier rubyid_find_workspace'>find_workspace</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_workspace'>workspace</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='label'>module:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</span><span class='comma'>,</span>
<span class='label'>fail_reason:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fail_reason'>fail_reason</span><span class='comma'>,</span>
<span class='label'>fail_detail:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fail_detail'>fail_detail</span><span class='comma'>,</span>
<span class='label'>username:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_owner'>owner</span><span class='comma'>,</span>
<span class='label'>refs:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_references'>references</span><span class='comma'>,</span>
<span class='label'>run_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RUN_ID</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
<span class='rbrace'>}</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:target_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:target</span><span class='rparen'>)</span>
<span class='comment'># Enrich attempt data with check result details when available
</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:check_code</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:check_code</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:check_detail</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_reason'>reason</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_mapped_reason'>mapped_reason</span> <span class='op'>=</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="../Module.html" title="Msf::Module (class)">Module</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Msf::Module::Failure (module)">Failure</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fail_reason_from_check_code'><span class='object_link'><a href="#fail_reason_from_check_code-class_method" title="Msf::Module::Failure.fail_reason_from_check_code (method)">fail_reason_from_check_code</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='rparen'>)</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:fail_reason</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_mapped_reason'>mapped_reason</span> <span class='kw'>if</span> <span class='id identifier rubyid_mapped_reason'>mapped_reason</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</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='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</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='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RHOSTS</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='comment'># Only include RHOST if it&#39;s a single valid host, not a multi-value string or file path
</span> <span class='id identifier rubyid_rhost'>rhost</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</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='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='comment'># Check if RHOST is a valid IP address to avoid ActiveRecord issues on validation
</span> <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_is_ip_addr?'>is_ip_addr?</span><span class='lparen'>(</span><span class='id identifier rubyid_rhost'>rhost</span><span class='rparen'>)</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:host</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_rhost'>rhost</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RPORT</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='kw'>and</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RPORT</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RPORT</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_ancestors'>ancestors</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/Remote.html" title="Msf::Exploit::Remote (class)">Remote</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/Remote/Tcp.html" title="Msf::Exploit::Remote::Tcp (module)">Tcp</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:proto</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>tcp</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_ancestors'>ancestors</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/Remote.html" title="Msf::Exploit::Remote (class)">Remote</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/Remote/Udp.html" title="Msf::Exploit::Remote::Udp (module)">Udp</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:proto</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>udp</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='comment'># When the check identified a vulnerability, ensure the vuln record exists
</span> <span class='comment'># before report_exploit_failure tries to look it up. The UI-level
</span> <span class='comment'># check_simple also calls report_vuln, but that happens *after* this
</span> <span class='comment'># ensure block, so the vuln wouldn&#39;t exist yet for the attempt lookup.
</span> <span class='kw'>if</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:host</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:check_code</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span>
<span class='lbracket'>[</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Vulnerable-constant" title="Msf::Exploit::CheckCode::Vulnerable (constant)">Vulnerable</a></span></span><span class='comma'>,</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Appears-constant" title="Msf::Exploit::CheckCode::Appears (constant)">Appears</a></span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='rparen'>)</span>
<span class='id identifier rubyid_vuln_info'>vuln_info</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span> <span class='op'>==</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html#Appears-constant" title="Msf::Exploit::CheckCode::Appears (constant)">Appears</a></span></span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Target appears vulnerable based on check of </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>else</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Vulnerability confirmed by check of </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</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_vuln_opts'>vuln_opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
<span class='label'>workspace:</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:workspace</span><span class='rbracket'>]</span><span class='comma'>,</span>
<span class='label'>host:</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:host</span><span class='rbracket'>]</span><span class='comma'>,</span>
<span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>refs:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_references'>references</span><span class='comma'>,</span>
<span class='label'>info:</span> <span class='id identifier rubyid_vuln_info'>vuln_info</span>
<span class='rbrace'>}</span>
<span class='comment'># Include port so that checks against different ports on the same
</span> <span class='comment'># host create distinct vuln records instead of collapsing into one.
</span> <span class='id identifier rubyid_vuln_opts'>vuln_opts</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_vuln_opts'>vuln_opts</span><span class='lbracket'>[</span><span class='symbol'>:proto</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:proto</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:proto</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_db'>db</span><span class='period'>.</span><span class='id identifier rubyid_report_vuln'>report_vuln</span><span class='lparen'>(</span><span class='id identifier rubyid_vuln_opts'>vuln_opts</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># Skip creating a duplicate vuln attempt if one was already recorded
</span> <span class='comment'># during this run (e.g. by Auxiliary::Report#report_vuln). When a
</span> <span class='comment'># check_code is available, update the existing attempt so it carries the
</span> <span class='comment'># check result details (the attempt created by report_vuln may not have
</span> <span class='comment'># had the check_code yet because it runs before job_run_proc stores it).
</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:last_vuln_attempt</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_last_vuln_attempt'>last_vuln_attempt</span>
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:check_code</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_check_code'>check_code</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</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="../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exploit/CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='rparen'>)</span>
<span class='id identifier rubyid__enrich_existing_vuln_attempt'>_enrich_existing_vuln_attempt</span><span class='lparen'>(</span><span class='id identifier rubyid_info'>info</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_last_vuln_attempt'>last_vuln_attempt</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='symbol'>:skip_vuln_attempt</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_db'>db</span><span class='period'>.</span><span class='id identifier rubyid_report_exploit_failure'>report_exploit_failure</span><span class='lparen'>(</span><span class='id identifier rubyid_info'>info</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:08 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>