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

514 lines
20 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Msf::Exploit::Remote::CheckModule
&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::Exploit::Remote::CheckModule";
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 (C)</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="../../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Remote.html" title="Msf::Exploit::Remote (class)">Remote</a></span></span>
&raquo;
<span class="title">CheckModule</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::Exploit::Remote::CheckModule
</h1>
<div class="box_info">
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/exploit/remote/check_module.rb</dd>
</dl>
</div>
<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="#check-instance_method" title="#check (instance method)">#<strong>check</strong> &#x21d2; Msf::Exploit::CheckCode </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>When this mixin is included, this method becomes the exploits check method.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#check_module-instance_method" title="#check_module (instance method)">#<strong>check_module</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#check_options-instance_method" title="#check_options (instance method)">#<strong>check_options</strong> &#x21d2; Hash </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Override this method to change the datastore options with which the check module is executed.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(info = {}) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="check-instance_method">
#<strong>check</strong> &#x21d2; <tt><span class='object_link'><a href="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">Msf::Exploit::CheckCode</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>When this mixin is included, this method becomes the exploits check method</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">Msf::Exploit::CheckCode</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>Whether or not the target is vulnerable</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/check_module.rb', line 21</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check'>check</span>
<span class='comment'># Instantiate the module
</span> <span class='id identifier rubyid_mod'>mod</span> <span class='op'>=</span> <span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_modules'>modules</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_check_module'>check_module</span><span class='rparen'>)</span>
<span class='comment'># Bail if we couldn&#39;t
</span> <span class='kw'>unless</span> <span class='id identifier rubyid_mod'>mod</span>
<span class='kw'>return</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="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../CheckCode.html#Unsupported-constant" title="Msf::Exploit::CheckCode::Unsupported (constant)">Unsupported</a></span></span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Could not instantiate </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_check_module'>check_module</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># Bail if it isn&#39;t aux
</span> <span class='kw'>if</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</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="../../../Msf.html#MODULE_AUX-constant" title="Msf::MODULE_AUX (constant)">MODULE_AUX</a></span></span>
<span class='kw'>return</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="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../CheckCode.html#Unsupported-constant" title="Msf::Exploit::CheckCode::Unsupported (constant)">Unsupported</a></span></span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_check_module'>check_module</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not an auxiliary module.</span><span class='tstring_end'>&quot;</span></span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># Bail if run isn&#39;t defined
</span> <span class='kw'>unless</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:run</span><span class='rparen'>)</span>
<span class='kw'>return</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="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../CheckCode.html#Unsupported-constant" title="Msf::Exploit::CheckCode::Unsupported (constant)">Unsupported</a></span></span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_check_module'>check_module</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not define a run method.</span><span class='tstring_end'>&quot;</span></span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_print_status'>print_status</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Using </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_check_module'>check_module</span><span class='embexpr_end'>}</span><span class='tstring_content'> as check</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='comment'># Retrieve the module&#39;s return value
</span> <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_run_simple'>run_simple</span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>LocalInput</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_user_input'>user_input</span><span class='comma'>,</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>LocalOutput</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_user_output'>user_output</span><span class='comma'>,</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Options</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_datastore'>datastore</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_check_options'>check_options</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>RunAsJob</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='kw'>false</span>
<span class='rparen'>)</span>
<span class='comment'># Ensure return value is a CheckCode
</span> <span class='kw'>case</span> <span class='id identifier rubyid_res'>res</span>
<span class='kw'>when</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="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span>
<span class='comment'># Return the CheckCode
</span> <span class='id identifier rubyid_res'>res</span>
<span class='kw'>when</span> <span class='const'>Hash</span>
<span class='comment'># XXX: Find CheckCode associated with RHOST, which is set automatically
</span> <span class='id identifier rubyid_checkcode'>checkcode</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='lbracket'>[</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='rbracket'>]</span>
<span class='comment'># Bail if module doesn&#39;t return a CheckCode
</span> <span class='kw'>unless</span> <span class='id identifier rubyid_checkcode'>checkcode</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</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="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='rparen'>)</span>
<span class='kw'>return</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="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../CheckCode.html#Unsupported-constant" title="Msf::Exploit::CheckCode::Unsupported (constant)">Unsupported</a></span></span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_check_module'>check_module</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not return a CheckCode.</span><span class='tstring_end'>&quot;</span></span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='comment'># Return the CheckCode
</span> <span class='id identifier rubyid_checkcode'>checkcode</span>
<span class='kw'>else</span>
<span class='comment'># Bail if module doesn&#39;t return a CheckCode
</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="../CheckCode.html" title="Msf::Exploit::CheckCode (class)">CheckCode</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../CheckCode.html#Unsupported-constant" title="Msf::Exploit::CheckCode::Unsupported (constant)">Unsupported</a></span></span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_check_module'>check_module</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not return a CheckCode.</span><span class='tstring_end'>&quot;</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="check_module-instance_method">
#<strong>check_module</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
90
91
92</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/check_module.rb', line 90</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check_module'>check_module</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'>CheckModule</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="check_options-instance_method">
#<strong>check_options</strong> &#x21d2; <tt>Hash</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Override this method to change the datastore options with which the check module is executed.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>The datastore options for the check module.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
86
87
88</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/check_module.rb', line 86</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check_options'>check_options</span>
<span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="initialize-instance_method">
#<strong>initialize</strong>(info = {}) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
10
11
12
13
14
15
16</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/check_module.rb', line 10</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_info'>info</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='kw'>super</span>
<span class='id identifier rubyid_register_advanced_options'>register_advanced_options</span><span class='lparen'>(</span><span class='lbracket'>[</span>
<span class='const'><span class='object_link'><a href="../../OptString.html" title="Msf::OptString (class)">OptString</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../../OptString.html#initialize-instance_method" title="Msf::OptString#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>CheckModule</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='kw'>true</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Module to check with</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='rbracket'>]</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:02:04 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>