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

625 lines
16 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::Flatfile
&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::Flatfile";
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="../PersistentStorage.html" title="Msf::PersistentStorage (class)">PersistentStorage</a></span></span>
&raquo;
<span class="title">Flatfile</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::Flatfile
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName"><span class='object_link'><a href="../PersistentStorage.html" title="Msf::PersistentStorage (class)">Msf::PersistentStorage</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next"><span class='object_link'><a href="../PersistentStorage.html" title="Msf::PersistentStorage (class)">Msf::PersistentStorage</a></span></li>
<li class="next">Msf::PersistentStorage::Flatfile</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/base/persistent_storage/flatfile.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>This class persists the state of the framework to a flatfile in a human readable format. At the moment, the level of information it conveys is rather basic and ugly, but this is just a prototype, so it will be improved. Oh yes, it will be improved.</p>
</div>
</div>
<div class="tags">
</div>
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="protected ">
<span class="summary_signature">
<a href="#fd-instance_method" title="#fd (instance method)">#<strong>fd</strong> &#x21d2; Object </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'>
<p>:nodoc:.</p>
</div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#path-instance_method" title="#path (instance method)">#<strong>path</strong> &#x21d2; Object </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'>
<p>:nodoc:.</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="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(path) &#x21d2; Flatfile </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Initializes the flatfile for storage based on the parameters specified.</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 method stores the current state of the framework in human readable form to a flatfile.</p>
</div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#store_general-instance_method" title="#store_general (instance method)">#<strong>store_general</strong>(framework) &#x21d2; void </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'>
<p>This method stores general information about the current state of the framework instance.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="../PersistentStorage.html" title="Msf::PersistentStorage (class)">Msf::PersistentStorage</a></span></h3>
<p class="inherited"><span class='object_link'><a href="../PersistentStorage.html#add_storage_class-class_method" title="Msf::PersistentStorage.add_storage_class (method)">add_storage_class</a></span>, <span class='object_link'><a href="../PersistentStorage.html#create-class_method" title="Msf::PersistentStorage.create (method)">create</a></span>, <span class='object_link'><a href="../PersistentStorage.html#fetch-instance_method" title="Msf::PersistentStorage#fetch (method)">#fetch</a></span></p>
<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>(path) &#x21d2; <tt><span class='object_link'><a href="" title="Msf::PersistentStorage::Flatfile (class)">Flatfile</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Initializes the flatfile for storage based on the parameters specified. The hash must contain a FilePath attribute.</p>
</div>
</div>
<div class="tags">
<div class="docstring">
<div class="discussion">
<p>Initializes the flatfile with the set path.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>path</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>path of the flatfile.</p>
</div>
</li>
</ul>
</div>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt>ArgumentError</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
17
18
19
20
21</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage/flatfile.rb', line 17</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='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>You must specify a file path</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>0</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id="fd=-instance_method"></span>
<div class="method_details first">
<h3 class="signature first" id="fd-instance_method">
#<strong>fd</strong> &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
<p>:nodoc:</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
41
42
43</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage/flatfile.rb', line 41</span>
<span class='kw'>def</span> <span class='id identifier rubyid_fd'>fd</span>
<span class='ivar'>@fd</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="path=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="path-instance_method">
#<strong>path</strong> &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
<p>:nodoc:</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
41
42
43</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage/flatfile.rb', line 41</span>
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
<span class='ivar'>@path</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="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 method stores the current state of the framework in human readable form to a flatfile. This can be used as a reporting mechanism.</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>Msf:::Framework</tt>)</span>
&mdash;
<div class='inline'>
<p>the Framework to store.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
28
29
30
31
32
33
34
35
36
37</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage/flatfile.rb', line 28</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='comment'># Open the supplied file path for writing.
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fd'>fd</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>begin</span>
<span class='id identifier rubyid_store_general'>store_general</span><span class='lparen'>(</span><span class='id identifier rubyid_framework'>framework</span><span class='rparen'>)</span>
<span class='kw'>ensure</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fd'>fd</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="store_general-instance_method">
#<strong>store_general</strong>(framework) &#x21d2; <tt>void</tt> <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
<p class="note returns_void">This method returns an undefined value.</p>
<p>This method stores general information about the current state of the framework instance.</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>the Framework to store.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
48
49
50
51
52
53
54</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/base/persistent_storage/flatfile.rb', line 48</span>
<span class='kw'>def</span> <span class='id identifier rubyid_store_general'>store_general</span><span class='lparen'>(</span><span class='id identifier rubyid_framework'>framework</span><span class='rparen'>)</span>
<span class='id identifier rubyid_fd'>fd</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Metasploit Framework Report\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>===========================\n\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Generated: </span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:03:35 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>