388 lines
14 KiB
HTML
388 lines
14 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::PyBridge
|
|
|
|
— 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::PyBridge";
|
|
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> »
|
|
<span class='title'><span class='object_link'><a href="../../../Msf.html" title="Msf (module)">Msf</a></span></span> » <span class='title'><span class='object_link'><a href="../../Modules.html" title="Msf::Modules (module)">Modules</a></span></span> » <span class='title'><span class='object_link'><a href="../External.html" title="Msf::Modules::External (class)">External</a></span></span>
|
|
»
|
|
<span class="title">PyBridge</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::PyBridge
|
|
|
|
|
|
|
|
</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::PyBridge</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) ⇒ 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) ⇒ 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) ⇒ PyBridge </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="note title constructor">constructor</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>A new instance of PyBridge.</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) ⇒ <tt><span class='object_link'><a href="" title="Msf::Modules::External::PyBridge (class)">PyBridge</a></span></tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Returns a new instance of PyBridge.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
180
|
|
181
|
|
182
|
|
183
|
|
184</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/modules/external/bridge.rb', line 180</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_pythonpath'>pythonpath</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>PYTHONPATH</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></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'>'</span><span class='tstring_content'>PYTHONPATH</span><span class='tstring_end'>'</span></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'>'</span><span class='tstring_content'>../python</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='kw'>__FILE__</span><span class='rparen'>)</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_pythonpath'>pythonpath</span><span class='rbrace'>}</span><span class='rparen'>)</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) ⇒ <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">
|
|
|
|
|
|
176
|
|
177
|
|
178</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/modules/external/bridge.rb', line 176</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'>\.py$</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) ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
186
|
|
187
|
|
188
|
|
189
|
|
190
|
|
191
|
|
192
|
|
193</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/modules/external/bridge.rb', line 186</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'>'</span><span class='tstring_content'>Failed to execute external Python module. Please ensure you have Python3 installed on your environment.</span><span class='tstring_end'>'</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> |