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

739 lines
17 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: Msf::PersistentStorage
&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::PersistentStorage";
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 (P)</a> &raquo;
<span class='title'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span>
&raquo;
<span class="title">PersistentStorage</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>Class: Msf::PersistentStorage
<span class="abstract note title">Abstract</span>
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName">Object</span>
<ul class="fullTree">
<li>Object</li>
<li class="next">Msf::PersistentStorage</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/base/persistent_storage.rb<span class="defines">,<br />
lib/msf/base/persistent_storage/flatfile.rb</span>
</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<div class="note abstract">
<strong>This class is abstract.</strong>
<div class='inline'>
<p>Subclass and override <span class='object_link'><a href="#initialize-instance_method" title="Msf::PersistentStorage#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="#store-instance_method" title="Msf::PersistentStorage#store (method)">#store</a></span>, and <span class='object_link'><a href="#fetch-instance_method" title="Msf::PersistentStorage#fetch (method)">#fetch</a></span>.</p>
</div>
</div>
<p>This class provides a generalized interface to persisting information, either in whole or in part, about the state of the framework. This can be used to store data that can later be reinitialized in a new instance of the framework or to provide a simple mechanism for generating reports of some form.</p>
</div>
</div>
<div class="tags">
</div><div id="subclasses">
<h2>Direct Known Subclasses</h2>
<p class="children"><span class='object_link'><a href="PersistentStorage/Flatfile.html" title="Msf::PersistentStorage::Flatfile (class)">Flatfile</a></span></p>
</div>
<h2>Defined Under Namespace</h2>
<p class="children">
<strong class="classes">Classes:</strong> <span class='object_link'><a href="PersistentStorage/Flatfile.html" title="Msf::PersistentStorage::Flatfile (class)">Flatfile</a></span>
</p>
<h2>
Constant Summary
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
</h2>
<dl class="constants">
<dt id="storage_classes-classvariable" class="">@@storage_classes =
</dt>
<dd><pre class="code"><span class='lbrace'>{</span><span class='rbrace'>}</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="#add_storage_class-class_method" title="add_storage_class (class method)">.<strong>add_storage_class</strong>(name, klass) &#x21d2; void </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This method adds a new storage class to the hash of storage classes that can be created through create.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#create-class_method" title="create (class method)">.<strong>create</strong>(name, *params) &#x21d2; PersistentStorage<sup>?</sup> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Creates an instance of the storage class with the supplied name.</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="#fetch-instance_method" title="#fetch (instance method)">#<strong>fetch</strong>(framework) &#x21d2; void </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This method initializes the supplied framework instance with the state that is stored in the persisted backing that the derived class implements.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(*params) &#x21d2; PersistentStorage </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Stub initialization routine that takes the params passed to create.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#store-instance_method" title="#store (instance method)">#<strong>store</strong>(framework) &#x21d2; void </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This methods stores all or part of the current state of the supplied framework instance to whatever medium the derived class implements.</p>
</div></span>
</li>
</ul>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(*params) &#x21d2; <tt><span class='object_link'><a href="" title="Msf::PersistentStorage (class)">PersistentStorage</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Stub initialization routine that takes the params passed to create.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>params</span>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>the parameters to initialize with.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
34
35</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage.rb', line 34</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="add_storage_class-class_method">
.<strong>add_storage_class</strong>(name, klass) &#x21d2; <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note returns_void">This method returns an undefined value.</p>
<p>This method adds a new storage class to the hash of storage classes that can be created through create.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>name</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>the name of the storage class.</p>
</div>
</li>
<li>
<span class='name'>klass</span>
<span class='type'>(<tt><span class='object_link'><a href="" title="Msf::PersistentStorage (class)">PersistentStorage</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>the storage class to add.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
67
68
69</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage.rb', line 67</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_add_storage_class'>add_storage_class</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
<span class='cvar'>@@storage_classes</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="create-class_method">
.<strong>create</strong>(name, *params) &#x21d2; <tt><span class='object_link'><a href="" title="Msf::PersistentStorage (class)">PersistentStorage</a></span></tt><sup>?</sup>
</h3><div class="docstring">
<div class="discussion">
<p>Creates an instance of the storage class with the supplied name. The array supplied as an argument is passed to the constructor of the associated class as a means of generic initialization.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>name</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>the name of the storage class.</p>
</div>
</li>
<li>
<span class='name'>params</span>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>the parameters to give the new class.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="" title="Msf::PersistentStorage (class)">PersistentStorage</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>the newly created class.</p>
</div>
</li>
<li>
<span class='type'>(<tt>nil</tt>)</span>
&mdash;
<div class='inline'>
<p>if class has not been added through <span class='object_link'><a href="#add_storage_class-class_method" title="Msf::PersistentStorage.add_storage_class (method)">add_storage_class</a></span>.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25
26
27
28
29</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage.rb', line 23</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='cvar'>@@storage_classes</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='kw'>nil</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="fetch-instance_method">
#<strong>fetch</strong>(framework) &#x21d2; <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note returns_void">This method returns an undefined value.</p>
<p>This method initializes the supplied framework instance with the state that is stored in the persisted backing that the derived class implements. If the derived class does not implement this method, the NotImplementedError is raised.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>framework</span>
<span class='type'>(<tt><span class='object_link'><a href="Framework.html" title="Msf::Framework (class)">Msf::Framework</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>framework to restore state to.</p>
</div>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt>NotImplementedError</tt>)</span>
&mdash;
<div class='inline'>
<p>raised if not implemented.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
57
58
59</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage.rb', line 57</span>
<span class='kw'>def</span> <span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_framework'>framework</span><span class='rparen'>)</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="store-instance_method">
#<strong>store</strong>(framework) &#x21d2; <tt>void</tt>
</h3><div class="docstring">
<div class="discussion">
<p class="note returns_void">This method returns an undefined value.</p>
<p>This methods stores all or part of the current state of the supplied framework instance to whatever medium the derived class implements. If the derived class does not implement this method, the NotImplementedError is raised.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>framework</span>
<span class='type'>(<tt><span class='object_link'><a href="Framework.html" title="Msf::Framework (class)">Msf::Framework</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>framework state to store.</p>
</div>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt>NotImpementedError</tt>)</span>
&mdash;
<div class='inline'>
<p>raised if not implemented.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
45
46
47</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage.rb', line 45</span>
<span class='kw'>def</span> <span class='id identifier rubyid_store'>store</span><span class='lparen'>(</span><span class='id identifier rubyid_framework'>framework</span><span class='rparen'>)</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:03:28 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>