Files
metasploit-gs/api/Metasploit/Framework/NTDS/Parser.html
T
jenkins-metasploit c3f5bd3de2 Reboot gh-pages
2026-05-08 17:08:43 +00:00

682 lines
19 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::NTDS::Parser
&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 = "Metasploit::Framework::NTDS::Parser";
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="../../../Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../NTDS.html" title="Metasploit::Framework::NTDS (module)">NTDS</a></span></span>
&raquo;
<span class="title">Parser</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::NTDS::Parser
</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::NTDS::Parser</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/metasploit/framework/ntds/parser.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>This class represent an NTDS parser. It interacts with the Meterpreter Client to provide a simple interface for enumerating AD user accounts.</p>
</div>
</div>
<div class="tags">
</div>
<h2>
Constant Summary
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
</h2>
<dl class="constants">
<dt id="BATCH_SIZE-constant" class="">BATCH_SIZE =
<div class="docstring">
<div class="discussion">
<p>The size, in Bytes, of a batch of NTDS accounts</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='lparen'>(</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="../NTDS.html" title="Metasploit::Framework::NTDS (module)">NTDS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Account.html" title="Metasploit::Framework::NTDS::Account (class)">Account</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Account.html#ACCOUNT_SIZE-constant" title="Metasploit::Framework::NTDS::Account::ACCOUNT_SIZE (constant)">ACCOUNT_SIZE</a></span></span> <span class='op'>*</span> <span class='int'>20</span><span class='rparen'>)</span></pre></dd>
</dl>
<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="#channel-instance_method" title="#channel (instance method)">#<strong>channel</strong> &#x21d2; Rex::Post::Meterpreter::Channels::Pool </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>The Meterpreter NTDS Parser Channel.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#client-instance_method" title="#client (instance method)">#<strong>client</strong> &#x21d2; Msf::Session </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>The Meterpreter Client.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#file_path-instance_method" title="#file_path (instance method)">#<strong>file_path</strong> &#x21d2; String </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>The path to the NTDS.dit file on the remote system.</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="#each_account-instance_method" title="#each_account (instance method)">#<strong>each_account</strong> {|account| ... } &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Yields a [Metasploit::Framework::NTDS::Account] for each account found in the remote NTDS.dit file.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(client, file_path = &#39;&#39;) &#x21d2; Parser </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>A new instance of Parser.</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>(client, file_path = &#39;&#39;) &#x21d2; <tt><span class='object_link'><a href="" title="Metasploit::Framework::NTDS::Parser (class)">Parser</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a new instance of Parser.</p>
</div>
</div>
<div class="tags">
<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">
19
20
21
22
23
24</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/ntds/parser.rb', line 19</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></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'>Invalid Filepath</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='ivar'>@file_path</span> <span class='op'>=</span> <span class='id identifier rubyid_file_path'>file_path</span>
<span class='ivar'>@channel</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_extapi'>extapi</span><span class='period'>.</span><span class='id identifier rubyid_ntds'>ntds</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
<span class='ivar'>@client</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</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="channel=-instance_method"></span>
<div class="method_details first">
<h3 class="signature first" id="channel-instance_method">
#<strong>channel</strong> &#x21d2; <tt><span class='object_link'><a href="../../../Rex/Post/Meterpreter/Channels/Pool.html" title="Rex::Post::Meterpreter::Channels::Pool (class)">Rex::Post::Meterpreter::Channels::Pool</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns The Meterpreter NTDS Parser Channel.</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="../../../Rex/Post/Meterpreter/Channels/Pool.html" title="Rex::Post::Meterpreter::Channels::Pool (class)">Rex::Post::Meterpreter::Channels::Pool</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>The Meterpreter NTDS Parser Channel</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
13
14
15</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/ntds/parser.rb', line 13</span>
<span class='kw'>def</span> <span class='id identifier rubyid_channel'>channel</span>
<span class='ivar'>@channel</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="client=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="client-instance_method">
#<strong>client</strong> &#x21d2; <tt><span class='object_link'><a href="../../../Msf/Session.html" title="Msf::Session (module)">Msf::Session</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns The Meterpreter Client.</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="../../../Msf/Session.html" title="Msf::Session (module)">Msf::Session</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>The Meterpreter Client</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
15
16
17</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/ntds/parser.rb', line 15</span>
<span class='kw'>def</span> <span class='id identifier rubyid_client'>client</span>
<span class='ivar'>@client</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="file_path=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="file_path-instance_method">
#<strong>file_path</strong> &#x21d2; <tt>String</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns The path to the NTDS.dit file on the remote system.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>The path to the NTDS.dit file on the remote system</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
17
18
19</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/ntds/parser.rb', line 17</span>
<span class='kw'>def</span> <span class='id identifier rubyid_file_path'>file_path</span>
<span class='ivar'>@file_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="each_account-instance_method">
#<strong>each_account</strong> {|account| ... } &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Yields a [Metasploit::Framework::NTDS::Account] for each account found in the remote NTDS.dit file.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Yields:</p>
<ul class="yield">
<li>
<span class='type'>(<tt>account</tt>)</span>
</li>
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
<li>
<span class='name'>account</span>
<span class='type'>(<tt><span class='object_link'><a href="Account.html" title="Metasploit::Framework::NTDS::Account (class)">Metasploit::Framework::NTDS::Account</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>an AD user account</p>
</div>
</li>
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
<li>
<span class='type'>(<tt>void</tt>)</span>
&mdash;
<div class='inline'>
<p>does not return a value</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
32
33
34
35
36
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/ntds/parser.rb', line 32</span>
<span class='kw'>def</span> <span class='id identifier rubyid_each_account'>each_account</span>
<span class='id identifier rubyid_raw_batch_data'>raw_batch_data</span> <span class='op'>=</span> <span class='id identifier rubyid_pull_batch'>pull_batch</span>
<span class='kw'>until</span> <span class='id identifier rubyid_raw_batch_data'>raw_batch_data</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='id identifier rubyid_batch'>batch</span> <span class='op'>=</span> <span class='id identifier rubyid_raw_batch_data'>raw_batch_data</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
<span class='kw'>while</span> <span class='id identifier rubyid_batch'>batch</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_raw_data'>raw_data</span> <span class='op'>=</span> <span class='id identifier rubyid_batch'>batch</span><span class='period'>.</span><span class='id identifier rubyid_slice!'>slice!</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</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="../NTDS.html" title="Metasploit::Framework::NTDS (module)">NTDS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Account.html" title="Metasploit::Framework::NTDS::Account (class)">Account</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Account.html#ACCOUNT_SIZE-constant" title="Metasploit::Framework::NTDS::Account::ACCOUNT_SIZE (constant)">ACCOUNT_SIZE</a></span></span><span class='rparen'>)</span>
<span class='comment'># Make sure our data isn&#39;t all Null-bytes
</span> <span class='kw'>if</span> <span class='id identifier rubyid_raw_data'>raw_data</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[^\x00]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_account'>account</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="../NTDS.html" title="Metasploit::Framework::NTDS (module)">NTDS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Account.html" title="Metasploit::Framework::NTDS::Account (class)">Account</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Account.html#initialize-instance_method" title="Metasploit::Framework::NTDS::Account#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_raw_data'>raw_data</span><span class='rparen'>)</span>
<span class='kw'>yield</span> <span class='id identifier rubyid_account'>account</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_raw_batch_data'>raw_batch_data</span> <span class='op'>=</span> <span class='id identifier rubyid_pull_batch'>pull_batch</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:03:57 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>