709 lines
33 KiB
HTML
709 lines
33 KiB
HTML
|
|
<!DOCTYPE html>
|
|||
|
|
<html>
|
|||
|
|
<head>
|
|||
|
|
<meta charset="utf-8">
|
|||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|||
|
|
<title>
|
|||
|
|
Module: Msf::ModuleManager::Reloading
|
|||
|
|
|
|||
|
|
— 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::ModuleManager::Reloading";
|
|||
|
|
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 (R)</a> »
|
|||
|
|
<span class='title'><span class='object_link'><a href="../../Msf.html" title="Msf (module)">Msf</a></span></span> » <span class='title'><span class='object_link'><a href="../ModuleManager.html" title="Msf::ModuleManager (class)">ModuleManager</a></span></span>
|
|||
|
|
»
|
|||
|
|
<span class="title">Reloading</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::ModuleManager::Reloading
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</h1>
|
|||
|
|
<div class="box_info">
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<dl>
|
|||
|
|
<dt>Included in:</dt>
|
|||
|
|
<dd><span class='object_link'><a href="../ModuleManager.html" title="Msf::ModuleManager (class)">Msf::ModuleManager</a></span></dd>
|
|||
|
|
</dl>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<dl>
|
|||
|
|
<dt>Defined in:</dt>
|
|||
|
|
<dd>lib/msf/core/module_manager/reloading.rb</dd>
|
|||
|
|
</dl>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<h2>Overview</h2><div class="docstring">
|
|||
|
|
<div class="discussion">
|
|||
|
|
|
|||
|
|
<p>Msf::ModuleManager::Reloading</p>
|
|||
|
|
|
|||
|
|
<p>Provides methods for reloading Metasploit modules (including payloads, stagers, adapters, stages, etc.), clearing out old aliases, and refreshing the module cache.</p>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="tags">
|
|||
|
|
|
|||
|
|
|
|||
|
|
</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="#manual_reload-instance_method" title="#manual_reload (instance method)">#<strong>manual_reload</strong>(parent_path, type, ref_name) ⇒ Object </a>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<li class="public ">
|
|||
|
|
<span class="summary_signature">
|
|||
|
|
|
|||
|
|
<a href="#reload_module-instance_method" title="#reload_module (instance method)">#<strong>reload_module</strong>(mod) ⇒ Class, Msf::Module </a>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class="summary_desc"><div class='inline'>
|
|||
|
|
<p>Reloads the module specified in mod.</p>
|
|||
|
|
</div></span>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<li class="public ">
|
|||
|
|
<span class="summary_signature">
|
|||
|
|
|
|||
|
|
<a href="#reload_modules-instance_method" title="#reload_modules (instance method)">#<strong>reload_modules</strong> ⇒ Hash{String => Integer} </a>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class="summary_desc"><div class='inline'>
|
|||
|
|
<p>Reloads modules from all module paths.</p>
|
|||
|
|
</div></span>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<li class="public ">
|
|||
|
|
<span class="summary_signature">
|
|||
|
|
|
|||
|
|
<a href="#reload_payload_module-instance_method" title="#reload_payload_module (instance method)">#<strong>reload_payload_module</strong>(mod) ⇒ Class, Msf::Module </a>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class="summary_desc"><div class='inline'>
|
|||
|
|
<p>Reload payload module, separately from other categories.</p>
|
|||
|
|
</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="manual_reload-instance_method">
|
|||
|
|
|
|||
|
|
#<strong>manual_reload</strong>(parent_path, type, ref_name) ⇒ <tt>Object</tt>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</h3><table class="source_code">
|
|||
|
|
<tr>
|
|||
|
|
<td>
|
|||
|
|
<pre class="lines">
|
|||
|
|
|
|||
|
|
|
|||
|
|
51
|
|||
|
|
52
|
|||
|
|
53</pre>
|
|||
|
|
</td>
|
|||
|
|
<td>
|
|||
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/module_manager/reloading.rb', line 51</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_manual_reload'>manual_reload</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_path'>parent_path</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_ref_name'>ref_name</span><span class='rparen'>)</span>
|
|||
|
|
<span class='id identifier rubyid_loaders'>loaders</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_loader'>loader</span><span class='op'>|</span> <span class='id identifier rubyid_loader'>loader</span><span class='period'>.</span><span class='id identifier rubyid_load_module'>load_module</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_path'>parent_path</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_ref_name'>ref_name</span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='label'>force:</span> <span class='kw'>true</span> <span class='rbrace'>}</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|||
|
|
<span class='kw'>end</span></pre>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="method_details ">
|
|||
|
|
<h3 class="signature " id="reload_module-instance_method">
|
|||
|
|
|
|||
|
|
#<strong>reload_module</strong>(mod) ⇒ <tt>Class</tt>, <tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</h3><div class="docstring">
|
|||
|
|
<div class="discussion">
|
|||
|
|
|
|||
|
|
<p>Reloads the module specified in mod. This can either be an instance of a module or a module class.</p>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="tags">
|
|||
|
|
<p class="tag_title">Parameters:</p>
|
|||
|
|
<ul class="param">
|
|||
|
|
|
|||
|
|
<li>
|
|||
|
|
|
|||
|
|
<span class='name'>mod</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>, <tt>Class</tt>)</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
—
|
|||
|
|
<div class='inline'>
|
|||
|
|
<p>either an instance of a module or a module class</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
</ul>
|
|||
|
|
|
|||
|
|
<p class="tag_title">Returns:</p>
|
|||
|
|
<ul class="return">
|
|||
|
|
|
|||
|
|
<li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class='type'>(<tt>Class</tt>, <tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>)</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
—
|
|||
|
|
<div class='inline'>
|
|||
|
|
<p>original_metasploit_class_or_instance if an instance of the reloaded module cannot be created.</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
<li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>)</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
—
|
|||
|
|
<div class='inline'>
|
|||
|
|
<p>new instance of original_metasploit_class with datastore copied from original_metasploit_instance.</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
</ul>
|
|||
|
|
|
|||
|
|
</div><table class="source_code">
|
|||
|
|
<tr>
|
|||
|
|
<td>
|
|||
|
|
<pre class="lines">
|
|||
|
|
|
|||
|
|
|
|||
|
|
13
|
|||
|
|
14
|
|||
|
|
15
|
|||
|
|
16
|
|||
|
|
17
|
|||
|
|
18
|
|||
|
|
19
|
|||
|
|
20
|
|||
|
|
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</pre>
|
|||
|
|
</td>
|
|||
|
|
<td>
|
|||
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/module_manager/reloading.rb', line 13</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_reload_module'>reload_module</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span>
|
|||
|
|
<span class='comment'># if it's an instance, then get its class
|
|||
|
|
</span> <span class='kw'>if</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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='id identifier rubyid_metasploit_class'>metasploit_class</span> <span class='op'>=</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
|
|||
|
|
<span class='kw'>else</span>
|
|||
|
|
<span class='id identifier rubyid_metasploit_class'>metasploit_class</span> <span class='op'>=</span> <span class='id identifier rubyid_mod'>mod</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_aliased_as'>aliased_as</span> <span class='op'>=</span> <span class='id identifier rubyid_inv_aliases'>inv_aliases</span><span class='lbracket'>[</span><span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|||
|
|
<span class='id identifier rubyid_aliased_as'>aliased_as</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span>
|
|||
|
|
<span class='id identifier rubyid_aliases'>aliases</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_a'>a</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
<span class='id identifier rubyid_inv_aliases'>inv_aliases</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_payload?'>payload?</span>
|
|||
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_reload_payload_module'>reload_payload_module</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_aliased_as'>aliased_as</span> <span class='op'>=</span> <span class='id identifier rubyid_inv_aliases'>inv_aliases</span><span class='lbracket'>[</span><span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|||
|
|
<span class='id identifier rubyid_aliased_as'>aliased_as</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span>
|
|||
|
|
<span class='id identifier rubyid_aliases'>aliases</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_a'>a</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
<span class='id identifier rubyid_inv_aliases'>inv_aliases</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='id identifier rubyid_namespace_module'>namespace_module</span> <span class='op'>=</span> <span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_module_parent'>module_parent</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># Check if the namespace module has a loader
|
|||
|
|
</span> <span class='kw'>unless</span> <span class='id identifier rubyid_namespace_module'>namespace_module</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:loader</span><span class='rparen'>)</span>
|
|||
|
|
<span class='id identifier rubyid_elog'><span class='object_link'><a href="../../top-level-namespace.html#elog-instance_method" title="#elog (method)">elog</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Module does not have loader</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_mod'>mod</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='id identifier rubyid_loader'>loader</span> <span class='op'>=</span> <span class='id identifier rubyid_namespace_module'>namespace_module</span><span class='period'>.</span><span class='id identifier rubyid_loader'>loader</span>
|
|||
|
|
<span class='id identifier rubyid_loader'>loader</span><span class='period'>.</span><span class='id identifier rubyid_reload_module'>reload_module</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>end</span></pre>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="method_details ">
|
|||
|
|
<h3 class="signature " id="reload_modules-instance_method">
|
|||
|
|
|
|||
|
|
#<strong>reload_modules</strong> ⇒ <tt>Hash{String => Integer}</tt>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</h3><div class="docstring">
|
|||
|
|
<div class="discussion">
|
|||
|
|
|
|||
|
|
<p>Reloads modules from all module paths</p>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="tags">
|
|||
|
|
|
|||
|
|
<p class="tag_title">Returns:</p>
|
|||
|
|
<ul class="return">
|
|||
|
|
|
|||
|
|
<li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class='type'>(<tt>Hash{String => Integer}</tt>)</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
—
|
|||
|
|
<div class='inline'>
|
|||
|
|
<p>Maps module type to number of modules loaded</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
</ul>
|
|||
|
|
|
|||
|
|
</div><table class="source_code">
|
|||
|
|
<tr>
|
|||
|
|
<td>
|
|||
|
|
<pre class="lines">
|
|||
|
|
|
|||
|
|
|
|||
|
|
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</pre>
|
|||
|
|
</td>
|
|||
|
|
<td>
|
|||
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/module_manager/reloading.rb', line 108</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_reload_modules'>reload_modules</span>
|
|||
|
|
<span class='id identifier rubyid_enablement_by_type'>enablement_by_type</span><span class='period'>.</span><span class='id identifier rubyid_each_key'>each_key</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_type'>type</span><span class='op'>|</span>
|
|||
|
|
<span class='id identifier rubyid_module_set_by_type'>module_set_by_type</span><span class='lbracket'>[</span><span class='id identifier rubyid_type'>type</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
|||
|
|
<span class='id identifier rubyid_init_module_set'>init_module_set</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
<span class='id identifier rubyid_aliases'>aliases</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
|||
|
|
<span class='id identifier rubyid_inv_aliases'>inv_aliases</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># default the count to zero the first time a type is accessed
|
|||
|
|
</span> <span class='id identifier rubyid_count_by_type'>count_by_type</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
|
|||
|
|
|
|||
|
|
<span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_init_module_paths'>init_module_paths</span> <span class='kw'>unless</span> <span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_module_paths_inited'>module_paths_inited</span>
|
|||
|
|
|
|||
|
|
<span class='id identifier rubyid_module_paths'>module_paths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
|||
|
|
<span class='id identifier rubyid_path_count_by_type'>path_count_by_type</span> <span class='op'>=</span> <span class='id identifier rubyid_load_modules'>load_modules</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='label'>force:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># merge count with count from other paths
|
|||
|
|
</span> <span class='id identifier rubyid_path_count_by_type'>path_count_by_type</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='op'>|</span>
|
|||
|
|
<span class='id identifier rubyid_count_by_type'>count_by_type</span><span class='lbracket'>[</span><span class='id identifier rubyid_type'>type</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='id identifier rubyid_count'>count</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='id identifier rubyid_refresh_cache_from_module_files'>refresh_cache_from_module_files</span>
|
|||
|
|
|
|||
|
|
<span class='id identifier rubyid_count_by_type'>count_by_type</span>
|
|||
|
|
<span class='kw'>end</span></pre>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="method_details ">
|
|||
|
|
<h3 class="signature " id="reload_payload_module-instance_method">
|
|||
|
|
|
|||
|
|
#<strong>reload_payload_module</strong>(mod) ⇒ <tt>Class</tt>, <tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
</h3><div class="docstring">
|
|||
|
|
<div class="discussion">
|
|||
|
|
|
|||
|
|
<p>Reload payload module, separately from other categories. This is due to complexity of payload module and due to the fact they don’t follow class structure as rest of the modules.</p>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="tags">
|
|||
|
|
<p class="tag_title">Parameters:</p>
|
|||
|
|
<ul class="param">
|
|||
|
|
|
|||
|
|
<li>
|
|||
|
|
|
|||
|
|
<span class='name'>mod</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>, <tt>Class</tt>)</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
—
|
|||
|
|
<div class='inline'>
|
|||
|
|
<p>either an instance of a module or a module class</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
</ul>
|
|||
|
|
|
|||
|
|
<p class="tag_title">Returns:</p>
|
|||
|
|
<ul class="return">
|
|||
|
|
|
|||
|
|
<li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class='type'>(<tt>Class</tt>, <tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>)</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
—
|
|||
|
|
<div class='inline'>
|
|||
|
|
<p>original_metasploit_class_or_instance if an instance of the reloaded module cannot be created.</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
<li>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<span class='type'>(<tt><span class='object_link'><a href="../Module.html" title="Msf::Module (class)">Msf::Module</a></span></tt>)</span>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
—
|
|||
|
|
<div class='inline'>
|
|||
|
|
<p>new instance of original_metasploit_class with datastore copied from original_metasploit_instance.</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</li>
|
|||
|
|
|
|||
|
|
</ul>
|
|||
|
|
|
|||
|
|
</div><table class="source_code">
|
|||
|
|
<tr>
|
|||
|
|
<td>
|
|||
|
|
<pre class="lines">
|
|||
|
|
|
|||
|
|
|
|||
|
|
58
|
|||
|
|
59
|
|||
|
|
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</pre>
|
|||
|
|
</td>
|
|||
|
|
<td>
|
|||
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/module_manager/reloading.rb', line 58</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_reload_payload_module'>reload_payload_module</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</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='id identifier rubyid_metasploit_class'>metasploit_class</span> <span class='op'>=</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
|
|||
|
|
<span class='id identifier rubyid_original_instance'>original_instance</span> <span class='op'>=</span> <span class='id identifier rubyid_mod'>mod</span>
|
|||
|
|
<span class='kw'>else</span>
|
|||
|
|
<span class='id identifier rubyid_metasploit_class'>metasploit_class</span> <span class='op'>=</span> <span class='id identifier rubyid_mod'>mod</span>
|
|||
|
|
<span class='id identifier rubyid_original_instance'>original_instance</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_module_set'>module_set</span> <span class='op'>=</span> <span class='id identifier rubyid_module_set_by_type'>module_set_by_type</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|||
|
|
<span class='id identifier rubyid_module_set'>module_set</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_refname'>refname</span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
<span class='id identifier rubyid_module_info'>module_info</span> <span class='op'>=</span> <span class='id identifier rubyid_module_info_by_path'>module_info_by_path</span><span class='lbracket'>[</span><span class='id identifier rubyid_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rbracket'>]</span>
|
|||
|
|
<span class='kw'>unless</span> <span class='id identifier rubyid_module_info'>module_info</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_parent_path'>parent_path</span> <span class='op'>=</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='lbracket'>[</span><span class='symbol'>:parent_path</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|||
|
|
<span class='id identifier rubyid_elog'><span class='object_link'><a href="../../top-level-namespace.html#elog-instance_method" title="#elog (method)">elog</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Failed to get parent_path from module object</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_mod'>mod</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># reload adapters if any
|
|||
|
|
</span> <span class='id identifier rubyid_manual_reload'>manual_reload</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_path'>parent_path</span><span class='comma'>,</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>adapters</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_adapter_refname'>adapter_refname</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_adapter_refname'>adapter_refname</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># reload stagers if any
|
|||
|
|
</span> <span class='id identifier rubyid_manual_reload'>manual_reload</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_path'>parent_path</span><span class='comma'>,</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>stagers</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_stager_refname'>stager_refname</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_stager_refname'>stager_refname</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># reload stages if any
|
|||
|
|
</span> <span class='id identifier rubyid_manual_reload'>manual_reload</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_path'>parent_path</span><span class='comma'>,</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>stages</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_stage_refname'>stage_refname</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_mod'>mod</span><span class='period'>.</span><span class='id identifier rubyid_stage_refname'>stage_refname</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># reload single if any
|
|||
|
|
</span> <span class='id identifier rubyid_manual_reload'>manual_reload</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_path'>parent_path</span><span class='comma'>,</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>singles</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='lbracket'>[</span><span class='symbol'>:reference_name</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_original_instance'>original_instance</span><span class='period'>.</span><span class='id identifier rubyid_payload_type'>payload_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="../Payload.html" title="Msf::Payload (class)">Payload</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Payload/Type.html" title="Msf::Payload::Type (module)">Type</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Payload/Type.html#Single-constant" title="Msf::Payload::Type::Single (constant)">Single</a></span></span>
|
|||
|
|
|
|||
|
|
<span class='comment'># Get reloaded module
|
|||
|
|
</span> <span class='id identifier rubyid_new_instance'>new_instance</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_metasploit_class'>metasploit_class</span><span class='period'>.</span><span class='id identifier rubyid_fullname'>fullname</span><span class='rparen'>)</span>
|
|||
|
|
|
|||
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_new_instance'>new_instance</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
|||
|
|
<span class='id identifier rubyid_elog'><span class='object_link'><a href="../../top-level-namespace.html#elog-instance_method" title="#elog (method)">elog</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Failed create new instance</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_mod'>mod</span>
|
|||
|
|
<span class='kw'>end</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># Restore the datastore
|
|||
|
|
</span> <span class='id identifier rubyid_new_instance'>new_instance</span><span class='period'>.</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_original_instance'>original_instance</span><span class='period'>.</span><span class='id identifier rubyid_datastore'>datastore</span><span class='rparen'>)</span>
|
|||
|
|
|
|||
|
|
<span class='comment'># Return the new instance, which the framework will make the active module.
|
|||
|
|
</span> <span class='kw'>return</span> <span class='id identifier rubyid_new_instance'>new_instance</span>
|
|||
|
|
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
|||
|
|
<span class='id identifier rubyid_elog'><span class='object_link'><a href="../../top-level-namespace.html#elog-instance_method" title="#elog (method)">elog</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Failed to reload payload </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fullname'>fullname</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|||
|
|
<span class='kw'>return</span> <span class='id identifier rubyid_mod'>mod</span>
|
|||
|
|
<span class='kw'>end</span></pre>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div id="footer">
|
|||
|
|
Generated on Fri May 8 17:01:51 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>
|