614 lines
17 KiB
HTML
614 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: Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Base
|
||
|
||
— 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 = "Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Base";
|
||
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 (B)</a> »
|
||
<span class='title'><span class='object_link'><a href="../../../../../Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span> » <span class='title'><span class='object_link'><a href="../../../../Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span> » <span class='title'><span class='object_link'><a href="../../../Obfuscation.html" title="Metasploit::Framework::Obfuscation (module)">Obfuscation</a></span></span> » <span class='title'><span class='object_link'><a href="../../CRandomizer.html" title="Metasploit::Framework::Obfuscation::CRandomizer (module)">CRandomizer</a></span></span> » <span class='title'><span class='object_link'><a href="../CodeFactory.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory (module)">CodeFactory</a></span></span>
|
||
»
|
||
<span class="title">Base</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: Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Base
|
||
|
||
|
||
|
||
</h1>
|
||
<div class="box_info">
|
||
|
||
<dl>
|
||
<dt>Inherits:</dt>
|
||
<dd>
|
||
<span class="inheritName">Object</span>
|
||
|
||
<ul class="fullTree">
|
||
<li>Object</li>
|
||
|
||
<li class="next">Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Base</li>
|
||
|
||
</ul>
|
||
<a href="#" class="inheritanceTree">show all</a>
|
||
|
||
</dd>
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<dl>
|
||
<dt>Defined in:</dt>
|
||
<dd>lib/metasploit/framework/obfuscation/crandomizer/code_factory/base.rb</dd>
|
||
</dl>
|
||
|
||
</div>
|
||
|
||
<div id="subclasses">
|
||
<h2>Direct Known Subclasses</h2>
|
||
<p class="children"><span class='object_link'><a href="GetTickCount.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::GetTickCount (class)">GetTickCount</a></span>, <span class='object_link'><a href="If.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::If (class)">If</a></span>, <span class='object_link'><a href="IntAssignments.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::IntAssignments (class)">IntAssignments</a></span>, <span class='object_link'><a href="Malloc.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Malloc (class)">Malloc</a></span>, <span class='object_link'><a href="OutputDebugString.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::OutputDebugString (class)">OutputDebugString</a></span>, <span class='object_link'><a href="Printf.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Printf (class)">Printf</a></span>, <span class='object_link'><a href="StringAssignments.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::StringAssignments (class)">StringAssignments</a></span>, <span class='object_link'><a href="Switch.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Switch (class)">Switch</a></span>, <span class='object_link'><a href="UninitVariables.html" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::UninitVariables (class)">UninitVariables</a></span></p>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
||
<ul class="summary">
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#code-instance_method" title="#code (instance method)">#<strong>code</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
<span class="note title readonly">readonly</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Returns the value of attribute code.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#dep-instance_method" title="#dep (instance method)">#<strong>dep</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
<span class="note title readonly">readonly</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Returns the value of attribute dep.</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="#good_dep%3F-instance_method" title="#good_dep? (instance method)">#<strong>good_dep?</strong>(parser) ⇒ Boolean </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Checks whether this class is suitable for the code.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ Base </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
<span class="note title constructor">constructor</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>A new instance of Base.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#normalized_stub-instance_method" title="#normalized_stub (instance method)">#<strong>normalized_stub</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'></div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#stub-instance_method" title="#stub (instance method)">#<strong>stub</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Override this method when you inherit this class.</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> ⇒ <tt><span class='object_link'><a href="" title="Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Base (class)">Base</a></span></tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Returns a new instance of Base.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
13
|
||
14
|
||
15
|
||
16</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/base.rb', line 13</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
||
<span class='ivar'>@dep</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
<span class='ivar'>@code</span> <span class='op'>=</span> <span class='id identifier rubyid_normalized_stub'>normalized_stub</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=""></span>
|
||
<div class="method_details first">
|
||
<h3 class="signature first" id="code-instance_method">
|
||
|
||
#<strong>code</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Returns the value of attribute code.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
11
|
||
12
|
||
13</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/base.rb', line 11</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_code'>code</span>
|
||
<span class='ivar'>@code</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id=""></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="dep-instance_method">
|
||
|
||
#<strong>dep</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Returns the value of attribute dep.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
10
|
||
11
|
||
12</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/base.rb', line 10</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_dep'>dep</span>
|
||
<span class='ivar'>@dep</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="good_dep?-instance_method">
|
||
|
||
#<strong>good_dep?</strong>(parser) ⇒ <tt>Boolean</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Checks whether this class is suitable for the code.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
<p class="tag_title">Parameters:</p>
|
||
<ul class="param">
|
||
|
||
<li>
|
||
|
||
<span class='name'>parser</span>
|
||
|
||
|
||
<span class='type'>(<tt>Metasm::C::Parser</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
37
|
||
38
|
||
39
|
||
40
|
||
41
|
||
42
|
||
43
|
||
44
|
||
45
|
||
46
|
||
47</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/base.rb', line 37</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_good_dep?'>good_dep?</span><span class='lparen'>(</span><span class='id identifier rubyid_parser'>parser</span><span class='rparen'>)</span>
|
||
<span class='comment'># The difference between @dep and parser.toplevel.symbol.keys
|
||
</span> <span class='comment'># is the list of functions not being supported by the original code.
|
||
</span> <span class='id identifier rubyid_ready_function_names'>ready_function_names</span> <span class='op'>=</span> <span class='id identifier rubyid_parser'>parser</span><span class='period'>.</span><span class='id identifier rubyid_toplevel'>toplevel</span><span class='period'>.</span><span class='id identifier rubyid_symbol'>symbol</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
|
||
<span class='id identifier rubyid_delta'>delta</span> <span class='op'>=</span> <span class='id identifier rubyid_dep'>dep</span> <span class='op'>-</span> <span class='id identifier rubyid_ready_function_names'>ready_function_names</span>
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_delta'>delta</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
<span class='kw'>true</span>
|
||
<span class='kw'>else</span>
|
||
<span class='kw'>false</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="normalized_stub-instance_method">
|
||
|
||
#<strong>normalized_stub</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
49
|
||
50
|
||
51
|
||
52</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/base.rb', line 49</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_normalized_stub'>normalized_stub</span>
|
||
<span class='id identifier rubyid_stub_parser'>stub_parser</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../../../../Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../../../Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../../Obfuscation.html" title="Metasploit::Framework::Obfuscation (module)">Obfuscation</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../CRandomizer.html" title="Metasploit::Framework::Obfuscation::CRandomizer (module)">CRandomizer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Utility.html" title="Metasploit::Framework::Obfuscation::CRandomizer::Utility (class)">Utility</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse'><span class='object_link'><a href="../Utility.html#parse-class_method" title="Metasploit::Framework::Obfuscation::CRandomizer::Utility.parse (method)">parse</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_stub'>stub</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_stub_parser'>stub_parser</span><span class='period'>.</span><span class='id identifier rubyid_toplevel'>toplevel</span><span class='period'>.</span><span class='id identifier rubyid_statements'>statements</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_var'>var</span><span class='period'>.</span><span class='id identifier rubyid_initializer'>initializer</span><span class='period'>.</span><span class='id identifier rubyid_statements'>statements</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="stub-instance_method">
|
||
|
||
#<strong>stub</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Override this method when you inherit this class. The method should return the source of the stub you’re trying to create, as a C function. For example: %Q| void printf(const char*); void stub()
|
||
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_printf'>printf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>hello world\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='semicolon'>;</span>
|
||
</code></pre>
|
||
|
||
<p>| Notice if you are using a function like the above, you must declare/define that beforehand. The function declaration will not be used in the final source code.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Raises:</p>
|
||
<ul class="raise">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
29
|
||
30
|
||
31</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/obfuscation/crandomizer/code_factory/base.rb', line 29</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_stub'>stub</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:04: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> |