Files
metasploit-gs/api/Msf/Modules/External/GoBridge.html
T
jenkins-metasploit c3f5bd3de2 Reboot gh-pages
2026-05-08 17:08:43 +00:00

422 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: Msf::Modules::External::GoBridge
&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::Modules::External::GoBridge";
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 (G)</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="../../Modules.html" title="Msf::Modules (module)">Modules</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../External.html" title="Msf::Modules::External (class)">External</a></span></span>
&raquo;
<span class="title">GoBridge</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::Modules::External::GoBridge
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName"><span class='object_link'><a href="Bridge.html" title="Msf::Modules::External::Bridge (class)">Bridge</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next"><span class='object_link'><a href="Bridge.html" title="Msf::Modules::External::Bridge (class)">Bridge</a></span></li>
<li class="next">Msf::Modules::External::GoBridge</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/msf/core/modules/external/bridge.rb</dd>
</dl>
</div>
<h2>Constant Summary</h2>
<h3 class="inherited">Constants inherited
from <span class='object_link'><a href="Bridge.html" title="Msf::Modules::External::Bridge (class)">Bridge</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Bridge.html#LOADERS-constant" title="Msf::Modules::External::Bridge::LOADERS (constant)">Bridge::LOADERS</a></span></p>
<h2>Instance Attribute Summary</h2>
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Bridge.html" title="Msf::Modules::External::Bridge (class)">Bridge</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Bridge.html#buf-instance_method" title="Msf::Modules::External::Bridge#buf (method)">#buf</a></span>, <span class='object_link'><a href="Bridge.html#cmd-instance_method" title="Msf::Modules::External::Bridge#cmd (method)">#cmd</a></span>, <span class='object_link'><a href="Bridge.html#env-instance_method" title="Msf::Modules::External::Bridge#env (method)">#env</a></span>, <span class='object_link'><a href="Bridge.html#exit_status-instance_method" title="Msf::Modules::External::Bridge#exit_status (method)">#exit_status</a></span>, <span class='object_link'><a href="Bridge.html#framework-instance_method" title="Msf::Modules::External::Bridge#framework (method)">#framework</a></span>, <span class='object_link'><a href="Bridge.html#ios-instance_method" title="Msf::Modules::External::Bridge#ios (method)">#ios</a></span>, <span class='object_link'><a href="Bridge.html#messages-instance_method" title="Msf::Modules::External::Bridge#messages (method)">#messages</a></span>, <span class='object_link'><a href="Bridge.html#path-instance_method" title="Msf::Modules::External::Bridge#path (method)">#path</a></span>, <span class='object_link'><a href="Bridge.html#read_thread-instance_method" title="Msf::Modules::External::Bridge#read_thread (method)">#read_thread</a></span>, <span class='object_link'><a href="Bridge.html#running-instance_method" title="Msf::Modules::External::Bridge#running (method)">#running</a></span>, <span class='object_link'><a href="Bridge.html#wait_thread-instance_method" title="Msf::Modules::External::Bridge#wait_thread (method)">#wait_thread</a></span></p>
<h2>
Class Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#applies%3F-class_method" title="applies? (class method)">.<strong>applies?</strong>(module_name) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'></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="#handle_exception-instance_method" title="#handle_exception (instance method)">#<strong>handle_exception</strong>(error) &#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>(module_path, framework: nil) &#x21d2; GoBridge </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>A new instance of GoBridge.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Bridge.html" title="Msf::Modules::External::Bridge (class)">Bridge</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Bridge.html#cleanup-instance_method" title="Msf::Modules::External::Bridge#cleanup (method)">#cleanup</a></span>, <span class='object_link'><a href="Bridge.html#close-instance_method" title="Msf::Modules::External::Bridge#close (method)">#close</a></span>, <span class='object_link'><a href="Bridge.html#exec-instance_method" title="Msf::Modules::External::Bridge#exec (method)">#exec</a></span>, <span class='object_link'><a href="Bridge.html#harvest_process-instance_method" title="Msf::Modules::External::Bridge#harvest_process (method)">#harvest_process</a></span>, <span class='object_link'><a href="Bridge.html#next_message-instance_method" title="Msf::Modules::External::Bridge#next_message (method)">#next_message</a></span>, <span class='object_link'><a href="Bridge.html#open-class_method" title="Msf::Modules::External::Bridge.open (method)">open</a></span>, <span class='object_link'><a href="Bridge.html#send-instance_method" title="Msf::Modules::External::Bridge#send (method)">#send</a></span>, <span class='object_link'><a href="Bridge.html#success%3F-instance_method" title="Msf::Modules::External::Bridge#success? (method)">#success?</a></span>, <span class='object_link'><a href="Bridge.html#threadme-instance_method" title="Msf::Modules::External::Bridge#threadme (method)">#threadme</a></span>, <span class='object_link'><a href="Bridge.html#write_message-instance_method" title="Msf::Modules::External::Bridge#write_message (method)">#write_message</a></span></p>
<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>(module_path, framework: nil) &#x21d2; <tt><span class='object_link'><a href="" title="Msf::Modules::External::GoBridge (class)">GoBridge</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a new instance of GoBridge.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/modules/external/bridge.rb', line 213</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_module_path'>module_path</span><span class='comma'>,</span> <span class='label'>framework:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='kw'>super</span>
<span class='id identifier rubyid_default_go_path'>default_go_path</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOPATH</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_shared_module_lib_path'>shared_module_lib_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_module_path'>module_path</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/shared</span><span class='tstring_end'>&quot;</span></span>
<span class='id identifier rubyid_go_path'>go_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>../go</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>__FILE__</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_default_go_path'>default_go_path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_go_path'>go_path</span> <span class='op'>=</span> <span class='id identifier rubyid_go_path'>go_path</span> <span class='op'>+</span> <span class='const'>File</span><span class='op'>::</span><span class='const'>PATH_SEPARATOR</span> <span class='op'>+</span> <span class='id identifier rubyid_default_go_path'>default_go_path</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_shared_module_lib_path'>shared_module_lib_path</span><span class='rparen'>)</span>
<span class='id identifier rubyid_go_path'>go_path</span> <span class='op'>=</span> <span class='id identifier rubyid_go_path'>go_path</span> <span class='op'>+</span> <span class='const'>File</span><span class='op'>::</span><span class='const'>PATH_SEPARATOR</span> <span class='op'>+</span> <span class='id identifier rubyid_shared_module_lib_path'>shared_module_lib_path</span>
<span class='kw'>end</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span>
<span class='lbrace'>{</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GOPATH</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_go_path'>go_path</span><span class='comma'>,</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GO111MODULE</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>auto</span><span class='tstring_end'>&#39;</span></span>
<span class='rbrace'>}</span>
<span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>go</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>run</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="class_method_details" class="method_details_list">
<h2>Class Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="applies?-class_method">
.<strong>applies?</strong>(module_name) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<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">
209
210
211</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/modules/external/bridge.rb', line 209</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_applies?'>applies?</span><span class='lparen'>(</span><span class='id identifier rubyid_module_name'>module_name</span><span class='rparen'>)</span>
<span class='id identifier rubyid_module_name'>module_name</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.go$</span><span class='regexp_end'>/</span></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="handle_exception-instance_method">
#<strong>handle_exception</strong>(error) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
236
237
238
239
240
241
242
243</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/msf/core/modules/external/bridge.rb', line 236</span>
<span class='kw'>def</span> <span class='id identifier rubyid_handle_exception'>handle_exception</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
<span class='kw'>case</span> <span class='id identifier rubyid_error'>error</span>
<span class='kw'>when</span> <span class='const'>Errno</span><span class='op'>::</span><span class='const'>ENOENT</span>
<span class='const'>LoadError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Failed to execute external Go module. Please ensure you have Go installed on your environment.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='kw'>super</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:33 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>