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

793 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: Msf::RPC::JSON::Client
&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::Client";
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 (C)</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">Client</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::Client
</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::Client</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/rpc/json/client.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>JSON-RPC Client All client method call requests must be dispatched from within an EventMachine (reactor) run loop.</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="public ">
<span class="summary_signature">
<a href="#api_token-instance_method" title="#api_token (instance method)">#<strong>api_token</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 api_token.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#namespace-instance_method" title="#namespace (instance method)">#<strong>namespace</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute namespace.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#symbolize_names-instance_method" title="#symbolize_names (instance method)">#<strong>symbolize_names</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 symbolize_names.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#uri-instance_method" title="#uri (instance method)">#<strong>uri</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 uri.</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>(uri, api_token: nil, namespace: nil, symbolize_names: true, private_key_file: nil, cert_chain_file: nil, verify_peer: nil) &#x21d2; Client </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Instantiate a Client.</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>(uri, api_token: nil, namespace: nil, symbolize_names: true, private_key_file: nil, cert_chain_file: nil, verify_peer: nil) &#x21d2; <tt><span class='object_link'><a href="" title="Msf::RPC::JSON::Client (class)">Client</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Instantiate a Client. be prepended to the method name with a period separator. Default: nil processing JSON objects; otherwise, strings are used. Default: true from a peer, to be verified by user code. Default: nil</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>uri</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>the JSON-RPC service URI</p>
</div>
</li>
<li>
<span class='name'>api_token</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>the API token. Default: nil</p>
</div>
</li>
<li>
<span class='name'>namespace</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>the namespace for the JSON-RPC method. The namespace will</p>
</div>
</li>
<li>
<span class='name'>symbolize_names</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>true</tt>)</em>
&mdash;
<div class='inline'>
<p>If true, symbols are used for the names (keys) when</p>
</div>
</li>
<li>
<span class='name'>private_key_file</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>the SSL private key file used for the HTTPS request. Default: nil</p>
</div>
</li>
<li>
<span class='name'>cert_chain_file</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>the SSL cert chain file used for the HTTPS request. Default: nil</p>
</div>
</li>
<li>
<span class='name'>verify_peer</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>nil</tt>)</em>
&mdash;
<div class='inline'>
<p>indicates whether a server should request a certificate</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
26
27
28
29
30
31
32
33
34
35</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/client.rb', line 26</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'><span class='object_link'><a href="../../../top-level-namespace.html#uri-instance_method" title="#uri (method)">uri</a></span></span><span class='comma'>,</span> <span class='label'>api_token:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>namespace:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>symbolize_names:</span> <span class='kw'>true</span><span class='comma'>,</span>
<span class='label'>private_key_file:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>cert_chain_file:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>verify_peer:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='ivar'>@uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'><span class='object_link'><a href="../../../top-level-namespace.html#uri-instance_method" title="#uri (method)">uri</a></span></span><span class='rparen'>)</span>
<span class='ivar'>@api_token</span> <span class='op'>=</span> <span class='id identifier rubyid_api_token'>api_token</span>
<span class='ivar'>@namespace</span> <span class='op'>=</span> <span class='id identifier rubyid_namespace'>namespace</span>
<span class='ivar'>@symbolize_names</span> <span class='op'>=</span> <span class='id identifier rubyid_symbolize_names'>symbolize_names</span>
<span class='ivar'>@private_key_file</span> <span class='op'>=</span> <span class='id identifier rubyid_private_key_file'>private_key_file</span>
<span class='ivar'>@cert_chain_file</span> <span class='op'>=</span> <span class='id identifier rubyid_cert_chain_file'>cert_chain_file</span>
<span class='ivar'>@verify_peer</span> <span class='op'>=</span> <span class='id identifier rubyid_verify_peer'>verify_peer</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="method_missing_details" class="method_details_list">
<h2>Dynamic Method Handling</h2>
<p class="notice this">
This class handles dynamic methods through the <tt>method_missing</tt> method
</p>
<div class="method_details first">
<h3 class="signature first" id="method_missing-instance_method">
#<strong>method_missing</strong>(symbol, *args, **keyword_args, &amp;block) &#x21d2; <tt><span class='object_link'><a href="Request.html" title="Msf::RPC::JSON::Request (class)">Msf::RPC::JSON::Request</a></span></tt> <span class="extras">(private)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Invoked by Ruby when obj is sent a message it cannot handle, then processes the call as an RPC method invocation.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>symbol</span>
<span class='type'>(<tt>Symbol</tt>)</span>
&mdash;
<div class='inline'>
<p>the symbol for the method called</p>
</div>
</li>
<li>
<span class='name'>args</span>
<span class='type'>(<tt>Array</tt>)</span>
&mdash;
<div class='inline'>
<p>any positional arguments passed to the method</p>
</div>
</li>
<li>
<span class='name'>keyword_args</span>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>any keyword arguments passed to the method</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="Request.html" title="Msf::RPC::JSON::Request (class)">Msf::RPC::JSON::Request</a></span></tt>)</span>
&mdash;
<div class='inline'>
<p>an EM::Deferrable for the RPC method invocation.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
45
46
47
48
49
50
51
52
53
54
55
56
57
58</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/client.rb', line 45</span>
<span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_keyword_args'>keyword_args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='comment'># assemble method parameters
</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_keyword_args'>keyword_args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_keyword_args'>keyword_args</span>
<span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span>
<span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_keyword_args'>keyword_args</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_keyword_args'>keyword_args</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_process_call_async'>process_call_async</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</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="api_token-instance_method">
#<strong>api_token</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute api_token.</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/msf/core/rpc/json/client.rb', line 11</span>
<span class='kw'>def</span> <span class='id identifier rubyid_api_token'>api_token</span>
<span class='ivar'>@api_token</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="namespace=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="namespace-instance_method">
#<strong>namespace</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute namespace.</p>
</div>
</div>
<div class="tags">
</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/msf/core/rpc/json/client.rb', line 13</span>
<span class='kw'>def</span> <span class='id identifier rubyid_namespace'>namespace</span>
<span class='ivar'>@namespace</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="symbolize_names-instance_method">
#<strong>symbolize_names</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute symbolize_names.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
12
13
14</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/rpc/json/client.rb', line 12</span>
<span class='kw'>def</span> <span class='id identifier rubyid_symbolize_names'>symbolize_names</span>
<span class='ivar'>@symbolize_names</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="uri-instance_method">
#<strong>uri</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute uri.</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/msf/core/rpc/json/client.rb', line 10</span>
<span class='kw'>def</span> <span class='id identifier rubyid_uri'><span class='object_link'><a href="../../../top-level-namespace.html#uri-instance_method" title="#uri (method)">uri</a></span></span>
<span class='ivar'>@uri</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:03:26 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>