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

717 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: Msf::RPC::JSON::RpcCommand
&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::RPC::JSON::RpcCommand";
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 (R)</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="../../RPC.html" title="Msf::RPC (module)">RPC</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../JSON.html" title="Msf::RPC::JSON (module)">JSON</a></span></span>
&raquo;
<span class="title">RpcCommand</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::RPC::JSON::RpcCommand
</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::RPC::JSON::RpcCommand</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/rpc/json/rpc_command.rb</dd>
</dl>
</div>
<div id="subclasses">
<h2>Direct Known Subclasses</h2>
<p class="children"><span class='object_link'><a href="V1_0/RpcCommand.html" title="Msf::RPC::JSON::V1_0::RpcCommand (class)">V1_0::RpcCommand</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="#execute_timeout-instance_method" title="#execute_timeout (instance method)">#<strong>execute_timeout</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute execute_timeout.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#framework-instance_method" title="#framework (instance method)">#<strong>framework</strong> &#x21d2; Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute framework.</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="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(method, params) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Invokes the method on the receiver object with the specified params, returning the methods return value.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(framework, execute_timeout: 7200) &#x21d2; RpcCommand </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Instantiate an RpcCommand.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#register_method-instance_method" title="#register_method (instance method)">#<strong>register_method</strong>(method, name: nil) &#x21d2; Method </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Add a method to the RPC Command.</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>(framework, execute_timeout: 7200) &#x21d2; <tt><span class='object_link'><a href="" title="Msf::RPC::JSON::RpcCommand (class)">RpcCommand</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Instantiate an RpcCommand.</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="../../Simple/Framework.html" title="Msf::Simple::Framework (module)">Msf::Simple::Framework</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>Framework wrapper instance</p>
</div>
</li>
<li>
<span class='name'>execute_timeout</span>
<span class='type'>(<tt>Integer</tt>)</span>
<em class="default">(defaults to: <tt>7200</tt>)</em>
&mdash;
<div class='inline'>
<p>execute timeout duration in seconds</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
9
10
11
12
13</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/rpc_command.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_framework'>framework</span><span class='comma'>,</span> <span class='label'>execute_timeout:</span> <span class='int'>7200</span><span class='rparen'>)</span>
<span class='ivar'>@framework</span> <span class='op'>=</span> <span class='id identifier rubyid_framework'>framework</span>
<span class='ivar'>@execute_timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_execute_timeout'>execute_timeout</span>
<span class='ivar'>@methods</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</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="execute_timeout=-instance_method"></span>
<div class="method_details first">
<h3 class="signature first" id="execute_timeout-instance_method">
#<strong>execute_timeout</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute execute_timeout.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
4
5
6</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/rpc_command.rb', line 4</span>
<span class='kw'>def</span> <span class='id identifier rubyid_execute_timeout'>execute_timeout</span>
<span class='ivar'>@execute_timeout</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="framework-instance_method">
#<strong>framework</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute framework.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
3
4
5</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/rpc_command.rb', line 3</span>
<span class='kw'>def</span> <span class='id identifier rubyid_framework'>framework</span>
<span class='ivar'>@framework</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="execute-instance_method">
#<strong>execute</strong>(method, params) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Invokes the method on the receiver object with the specified params, returning the methods return value.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>method</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>the RPC method name</p>
</div>
</li>
<li>
<span class='name'>params</span>
<span class='type'>(<tt>Array</tt>, <tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>parameters for the RPC call</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Object</tt>)</span>
&mdash;
<div class='inline'>
<p>the methods return value.</p>
</div>
</li>
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
<li>
<span class='type'>(<tt><span class='object_link'><a href="MethodNotFound.html" title="Msf::RPC::JSON::MethodNotFound (class)">MethodNotFound</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>The method does not exist</p>
</div>
</li>
<li>
<span class='type'>(<tt>Timeout::Error</tt>)</span>
&mdash;
<div class='inline'>
<p>The method failed to terminate in @execute_timeout seconds</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/rpc_command.rb', line 37</span>
<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='ivar'>@methods</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="MethodNotFound.html" title="Msf::RPC::JSON::MethodNotFound (class)">MethodNotFound</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="MethodNotFound.html#initialize-instance_method" title="Msf::RPC::JSON::MethodNotFound#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='op'>::</span><span class='const'>Timeout</span><span class='period'>.</span><span class='id identifier rubyid_timeout'>timeout</span><span class='lparen'>(</span><span class='ivar'>@execute_timeout</span><span class='rparen'>)</span> <span class='kw'>do</span>
<span class='kw'>if</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='kw'>return</span> <span class='ivar'>@methods</span><span class='lbracket'>[</span><span class='id identifier rubyid_method'>method</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='ivar'>@methods</span><span class='lbracket'>[</span><span class='id identifier rubyid_method'>method</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</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'>return</span> <span class='ivar'>@methods</span><span class='lbracket'>[</span><span class='id identifier rubyid_method'>method</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</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>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="register_method-instance_method">
#<strong>register_method</strong>(method, name: nil) &#x21d2; <tt>Method</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Add a method to the RPC Command</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>method</span>
<span class='type'>(<tt>Method</tt>)</span>
&mdash;
<div class='inline'>
<p>the Method</p>
</div>
</li>
<li>
<span class='name'>name</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>the name the method is register under. The method name is used if nil.</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Method</tt>)</span>
&mdash;
<div class='inline'>
<p>the Method.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
19
20
21
22
23
24
25
26
27
28</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/rpc_command.rb', line 19</span>
<span class='kw'>def</span> <span class='id identifier rubyid_register_method'>register_method</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='label'>name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Method</span><span class='rparen'>)</span>
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='ivar'>@methods</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_method'>method</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:03:31 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>