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

555 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::Exploit::Remote::Relay::TargetList
&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::Exploit::Remote::Relay::TargetList";
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 (T)</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="../../../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Remote.html" title="Msf::Exploit::Remote (class)">Remote</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Relay.html" title="Msf::Exploit::Remote::Relay (module)">Relay</a></span></span>
&raquo;
<span class="title">TargetList</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::Exploit::Remote::Relay::TargetList
</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::Exploit::Remote::Relay::TargetList</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Includes:</dt>
<dd>MonitorMixin</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/exploit/remote/relay/target_list.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>A thread safe target list. The provided targets will be iterated over via the <span class='object_link'><a href="#next-instance_method" title="Msf::Exploit::Remote::Relay::TargetList#next (method)">#next</a></span> method.</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="#each-instance_method" title="#each (instance method)">#<strong>each</strong>(&amp;block) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(protocol, port, targets, path = nil, randomize_targets: true, drop_mic_only: false, drop_mic_and_sign_key_exch_flags: false, protocol_options: {}) &#x21d2; TargetList </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>A new instance of TargetList.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#next-instance_method" title="#next (instance method)">#<strong>next</strong>(identity) &#x21d2; Target<sup>?</sup> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Return the next available target, or nil if the identity has been relayed against all targets.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#on_relay_end-instance_method" title="#on_relay_end (instance method)">#<strong>on_relay_end</strong>(target, identity:, is_success:) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Updates tracking to mark a host as being successfully relayed or not.</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>(protocol, port, targets, path = nil, randomize_targets: true, drop_mic_only: false, drop_mic_and_sign_key_exch_flags: false, protocol_options: {}) &#x21d2; <tt><span class='object_link'><a href="" title="Msf::Exploit::Remote::Relay::TargetList (class)">TargetList</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a new instance of TargetList.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>targets</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/relay/target_list.rb', line 9</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_protocol'>protocol</span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='comma'>,</span> <span class='id identifier rubyid_targets'>targets</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>randomize_targets:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>drop_mic_only:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>drop_mic_and_sign_key_exch_flags:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>protocol_options:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../../../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'>Socket</span><span class='op'>::</span><span class='const'>RangeWalker</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_targets'>targets</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_enum'>to_enum</span><span class='lparen'>(</span><span class='symbol'>:each_ip</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_target_ip'>target_ip</span><span class='op'>|</span>
<span class='const'><span class='object_link'><a href="Target.html" title="Msf::Exploit::Remote::Relay::Target (class)">Target</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Target.html#initialize-instance_method" title="Msf::Exploit::Remote::Relay::Target#initialize (method)">new</a></span></span><span class='lparen'>(</span>
<span class='label'>ip:</span> <span class='id identifier rubyid_target_ip'>target_ip</span><span class='comma'>,</span>
<span class='label'>port:</span> <span class='id identifier rubyid_port'>port</span><span class='comma'>,</span>
<span class='label'>protocol:</span> <span class='id identifier rubyid_protocol'>protocol</span><span class='comma'>,</span>
<span class='label'>path:</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span>
<span class='label'>drop_mic_only:</span> <span class='id identifier rubyid_drop_mic_only'>drop_mic_only</span><span class='comma'>,</span>
<span class='label'>drop_mic_and_sign_key_exch_flags:</span> <span class='id identifier rubyid_drop_mic_and_sign_key_exch_flags'>drop_mic_and_sign_key_exch_flags</span><span class='comma'>,</span>
<span class='label'>protocol_options:</span> <span class='id identifier rubyid_protocol_options'>protocol_options</span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='ivar'>@targets</span> <span class='op'>=</span> <span class='id identifier rubyid_randomize_targets'>randomize_targets</span> <span class='op'>?</span> <span class='id identifier rubyid_targets'>targets</span><span class='period'>.</span><span class='id identifier rubyid_shuffle'>shuffle</span> <span class='op'>:</span> <span class='id identifier rubyid_targets'>targets</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-instance_method">
#<strong>each</strong>(&amp;block) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
26
27
28</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/relay/target_list.rb', line 26</span>
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='ivar'>@targets</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="next-instance_method">
#<strong>next</strong>(identity) &#x21d2; <tt><span class='object_link'><a href="Target.html" title="Msf::Exploit::Remote::Relay::Target (class)">Target</a></span></tt><sup>?</sup>
</h3><div class="docstring">
<div class="discussion">
<p>Return the next available target, or nil if the identity has been relayed against all targets</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>identity</span>
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
&mdash;
<div class='inline'>
<p>The identity, i.e. domain/user, if available</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Target.html" title="Msf::Exploit::Remote::Relay::Target (class)">Target</a></span></tt>, <tt>nil</tt>)</span>
&mdash;
<div class='inline'>
<p>The next target for the given identity with the least amount of relay attempts. Or nil if all targets have been relayed to for that identity</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
33
34
35
36
37
38
39
40
41</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/relay/target_list.rb', line 33</span>
<span class='kw'>def</span> <span class='kw'>next</span><span class='lparen'>(</span><span class='id identifier rubyid_identity'>identity</span><span class='rparen'>)</span>
<span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
<span class='id identifier rubyid_next_target'>next_target</span> <span class='op'>=</span> <span class='id identifier rubyid_next_target_for'>next_target_for</span><span class='lparen'>(</span><span class='id identifier rubyid_identity'>identity</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_next_target'>next_target</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='id identifier rubyid_next_target'>next_target</span><span class='period'>.</span><span class='id identifier rubyid_on_relay_start'>on_relay_start</span><span class='lparen'>(</span><span class='id identifier rubyid_identity'>identity</span><span class='rparen'>)</span>
<span class='id identifier rubyid_next_target'>next_target</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="on_relay_end-instance_method">
#<strong>on_relay_end</strong>(target, identity:, is_success:) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Updates tracking to mark a host as being successfully relayed or not</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>target</span>
<span class='type'>(<tt>Msf::Exploit::Remote::SMB::Relay::Target</tt>)</span>
&mdash;
<div class='inline'>
<p>The target that was successfully relayed or not</p>
</div>
</li>
<li>
<span class='name'>identity</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>the identity which was used as part of relaying</p>
</div>
</li>
<li>
<span class='name'>is_success</span>
<span class='type'>(<tt>TrueClass|FalseClass</tt>)</span>
&mdash;
<div class='inline'>
<p>True when this identity was successfully relayed to the target, false otherwise</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
47
48
49
50
51</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/remote/relay/target_list.rb', line 47</span>
<span class='kw'>def</span> <span class='id identifier rubyid_on_relay_end'>on_relay_end</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='label'>identity:</span><span class='comma'>,</span> <span class='label'>is_success:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_on_relay_end'>on_relay_end</span><span class='lparen'>(</span><span class='label'>identity:</span> <span class='id identifier rubyid_identity'>identity</span><span class='comma'>,</span> <span class='label'>is_success:</span> <span class='id identifier rubyid_is_success'>is_success</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:03:42 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>