This file is indexed.

/usr/share/doc/pyro4-doc/html/flame.html is in pyro4-doc 4.53-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Flame: Foreign Location Automatic Module Exposer &#8212; Pyro 4.53 documentation</title>
    
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '4.53',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="/usr/share/javascript/jquery/jquery.js"></script>
    <script type="text/javascript" src="/usr/share/javascript/underscore/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Pyro 4.53 documentation" href="index.html" />
    <link rel="next" title="Tips &amp; Tricks" href="tipstricks.html" />
    <link rel="prev" title="Exceptions and remote tracebacks" href="errors.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="tipstricks.html" title="Tips &amp; Tricks"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="errors.html" title="Exceptions and remote tracebacks"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Pyro 4.53 documentation</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="flame-foreign-location-automatic-module-exposer">
<span id="index-0"></span><h1>Flame: Foreign Location Automatic Module Exposer<a class="headerlink" href="#flame-foreign-location-automatic-module-exposer" title="Permalink to this headline"></a></h1>
<img alt="_images/flammable.png" class="align-left" src="_images/flammable.png" />
<p>Pyro Flame is an easy way of exposing remote modules and builtins, and even a remote interactive
Python console. It is available since Pyro 4.10.
With Flame, you don&#8217;t need to write any server side code anymore, and still be
able to call objects, modules and other things on the remote machine.
Flame does this by giving a client direct access to any module or builtin that is available on the remote machine.</p>
<p>Flame can be found in the <a class="reference internal" href="api/flame.html#module-Pyro4.utils.flame" title="Pyro4.utils.flame"><code class="xref py py-mod docutils literal"><span class="pre">Pyro4.utils.flame</span></code></a> module.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>Be very sure about what you are doing before enabling Flame.</p>
<p>Flame is disabled by default. You need to explicitly set a config item
to true, and start a Flame server yourself, to make it available.
This is because it allows client programs full access to <em>everything</em> on your system.
Only use it if you fully trust your environment and the clients that can connect to your machines.</p>
<p class="last">(Flame is also symbolic for burning server machines that got totally owned by malicious clients.)</p>
</div>
<div class="section" id="enabling-flame">
<span id="index-1"></span><h2>Enabling Flame<a class="headerlink" href="#enabling-flame" title="Permalink to this headline"></a></h2>
<p>Flame is actually a special Pyro object that is exposed via a normal Pyro daemon.
You need to start it explicitly in your daemon. This is done by calling a utility
function with your daemon that you want to enable flame on:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">Pyro4.utils.flame</span>
<span class="n">Pyro4</span><span class="o">.</span><span class="n">utils</span><span class="o">.</span><span class="n">flame</span><span class="o">.</span><span class="n">start</span><span class="p">(</span><span class="n">daemon</span><span class="p">)</span>
</pre></div>
</div>
<p>Additionally, you have to make some configuration changes:</p>
<ul class="simple">
<li>flame server: set the <code class="docutils literal"><span class="pre">FLAME_ENABLED</span></code> config item to True</li>
<li>flame server: set the <code class="docutils literal"><span class="pre">SERIALIZERS_ACCEPTED</span></code> config item to <code class="docutils literal"><span class="pre">{&quot;pickle&quot;}</span></code></li>
<li>flame client: set the <code class="docutils literal"><span class="pre">SERIALIZER</span></code> config item to <code class="docutils literal"><span class="pre">pickle</span></code></li>
</ul>
<p>You&#8217;ll have to explicitly enable Flame. When you don&#8217;t, you&#8217;ll
get an error when trying to start Flame. The config item is False by default
to avoid unintentionally running Flame servers.
Also, Flame requires the pickle serializer. It doesn&#8217;t work when using one of
the secure serializers, because it needs to be able to transfer custom python objects.</p>
</div>
<div class="section" id="command-line-server">
<span id="index-2"></span><h2>Command line server<a class="headerlink" href="#command-line-server" title="Permalink to this headline"></a></h2>
<p>There&#8217;s a little command line server program that will launch a flame enabled Pyro daemon,
to avoid the hassle of having to write a custom server program yourself everywhere you want
to provide a Flame server:</p>
<p><strong class="command">python -m Pyro4.utils.flameserver</strong> (or simply: <strong class="command">pyro4-flameserver</strong>)</p>
<p>The command line arguments are similar to the echo server (see <a class="reference internal" href="commandline.html#command-line-echoserver"><span class="std std-ref">Test echo server</span></a>).
Use <code class="docutils literal"><span class="pre">-h</span></code> to make it print a short help text. For the command line server you&#8217;ll also have
to set the <code class="docutils literal"><span class="pre">FLAME_ENABLED</span></code> config item to True, otherwise you&#8217;ll get an error when trying to start it.
Because we&#8217;re talking about command line clients, the most convenient way to do so is probably by
setting the environment variable in your shell: <code class="docutils literal"><span class="pre">PYRO_FLAME_ENABLED=true</span></code>.</p>
</div>
<div class="section" id="flame-object-and-examples">
<span id="index-3"></span><h2>Flame object and examples<a class="headerlink" href="#flame-object-and-examples" title="Permalink to this headline"></a></h2>
<p>A Flame server exposes a <code class="docutils literal"><span class="pre">&quot;Pyro.Flame&quot;</span></code> object (you can hardcode this name or use the
constant <a class="reference internal" href="api/constants.html#Pyro4.constants.FLAME_NAME" title="Pyro4.constants.FLAME_NAME"><code class="xref py py-attr docutils literal"><span class="pre">Pyro4.constants.FLAME_NAME</span></code></a>).
Its interface is described in the API documentation, see <a class="reference internal" href="api/flame.html#Pyro4.utils.flame.Flame" title="Pyro4.utils.flame.Flame"><code class="xref py py-class docutils literal"><span class="pre">Pyro4.utils.flame.Flame</span></code></a>.</p>
<p>Connecting to the flame server can be done as usual (by creating a Pyro proxy yourself)
or by using the convenience function <a class="reference internal" href="api/flame.html#Pyro4.utils.flame.connect" title="Pyro4.utils.flame.connect"><code class="xref py py-func docutils literal"><span class="pre">Pyro4.utils.flame.connect()</span></code></a>.
A little example follows. You have to have running flame server, and then you can write a client like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">Pyro4.utils.flame</span>

<span class="n">Pyro4</span><span class="o">.</span><span class="n">config</span><span class="o">.</span><span class="n">SERIALIZER</span> <span class="o">=</span> <span class="s2">&quot;pickle&quot;</span>    <span class="c1"># flame requires pickle serializer</span>

<span class="n">flame</span> <span class="o">=</span> <span class="n">Pyro4</span><span class="o">.</span><span class="n">utils</span><span class="o">.</span><span class="n">flame</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">&quot;hostname:9999&quot;</span><span class="p">)</span>    <span class="c1"># or whatever the server runs at</span>

<span class="n">socketmodule</span> <span class="o">=</span> <span class="n">flame</span><span class="o">.</span><span class="n">module</span><span class="p">(</span><span class="s2">&quot;socket&quot;</span><span class="p">)</span>
<span class="n">osmodule</span> <span class="o">=</span> <span class="n">flame</span><span class="o">.</span><span class="n">module</span><span class="p">(</span><span class="s2">&quot;os&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;remote host name=&quot;</span><span class="p">,</span> <span class="n">socketmodule</span><span class="o">.</span><span class="n">gethostname</span><span class="p">())</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;remote server directory contents=&quot;</span><span class="p">,</span> <span class="n">osmodule</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">))</span>

<span class="n">flame</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;import math&quot;</span><span class="p">)</span>
<span class="n">root</span> <span class="o">=</span> <span class="n">flame</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="s2">&quot;math.sqrt(500)&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;calculated square root=&quot;</span><span class="p">,</span> <span class="n">root</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;remote exceptions also work&quot;</span><span class="p">,</span> <span class="n">flame</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="s2">&quot;1//0&quot;</span><span class="p">))</span>

<span class="c1"># print something on the remote std output</span>
<span class="n">flame</span><span class="o">.</span><span class="n">builtin</span><span class="p">(</span><span class="s2">&quot;print&quot;</span><span class="p">)(</span><span class="s2">&quot;Hello there, remote server stdout!&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p id="index-4">A remote interactive console can be started like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">flame</span><span class="o">.</span><span class="n">console</span><span class="p">()</span> <span class="k">as</span> <span class="n">console</span><span class="p">:</span>
    <span class="n">console</span><span class="o">.</span><span class="n">interact</span><span class="p">()</span>
    <span class="c1"># ... you can repeat sessions if you want</span>
</pre></div>
</div>
<p>... which will print something like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">Python</span> <span class="mf">2.7</span><span class="o">.</span><span class="mi">2</span> <span class="p">(</span><span class="n">default</span><span class="p">,</span> <span class="n">Jun</span> <span class="mi">12</span> <span class="mi">2011</span><span class="p">,</span> <span class="mi">20</span><span class="p">:</span><span class="mi">46</span><span class="p">:</span><span class="mi">48</span><span class="p">)</span>
<span class="p">[</span><span class="n">GCC</span> <span class="mf">4.2</span><span class="o">.</span><span class="mi">1</span> <span class="p">(</span><span class="n">Apple</span> <span class="n">Inc</span><span class="o">.</span> <span class="n">build</span> <span class="mi">5577</span><span class="p">)]</span> <span class="n">on</span> <span class="n">darwin</span>
<span class="p">(</span><span class="n">Remote</span> <span class="n">console</span> <span class="n">on</span> <span class="n">charon</span><span class="p">:</span><span class="mi">9999</span><span class="p">)</span>
<span class="o">&gt;&gt;&gt;</span> <span class="c1"># type stuff here and it gets executed on the remote machine</span>
<span class="o">&gt;&gt;&gt;</span> <span class="kn">import</span> <span class="nn">socket</span>
<span class="o">&gt;&gt;&gt;</span> <span class="n">socket</span><span class="o">.</span><span class="n">gethostname</span><span class="p">()</span>
<span class="s1">&#39;charon.local&#39;</span>
<span class="o">&gt;&gt;&gt;</span> <span class="o">^</span><span class="n">D</span>
<span class="p">(</span><span class="n">Remote</span> <span class="n">session</span> <span class="n">ended</span><span class="p">)</span>
</pre></div>
</div>
<div class="admonition note" id="index-5">
<p class="first admonition-title">Note</p>
<p>The <code class="docutils literal"><span class="pre">getfile</span></code> and <code class="docutils literal"><span class="pre">sendfile</span></code> functions can be used for <em>very</em> basic file transfer.</p>
<p class="last">The <code class="docutils literal"><span class="pre">getmodule</span></code> and <code class="docutils literal"><span class="pre">sendmodule</span></code> functions can be used to send module source files
to other machines so it is possible to execute code that wasn&#8217;t available before.
This is a <em>very</em> experimental replacement of the mobile code feature that Pyro 3.x had.
It also is a very easy way of totally owning the server because you can make it execute
anything you like. Be very careful.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><a class="reference internal" href="pyrolite.html"><span class="doc">Pyrolite - client library for Java and .NET</span></a> also supports convenient access to a Pyro Flame server. This includes the remote interactive console.</p>
</div>
<p>See the <code class="file docutils literal"><span class="pre">flame</span></code> example for example code including uploading module source code to the server.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/pyro.png" alt="Logo"/>
            </a></p>
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Flame: Foreign Location Automatic Module Exposer</a><ul>
<li><a class="reference internal" href="#enabling-flame">Enabling Flame</a></li>
<li><a class="reference internal" href="#command-line-server">Command line server</a></li>
<li><a class="reference internal" href="#flame-object-and-examples">Flame object and examples</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="errors.html"
                        title="previous chapter">Exceptions and remote tracebacks</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="tipstricks.html"
                        title="next chapter">Tips &amp; Tricks</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="tipstricks.html" title="Tips &amp; Tricks"
             >next</a> |</li>
        <li class="right" >
          <a href="errors.html" title="Exceptions and remote tracebacks"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Pyro 4.53 documentation</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright Irmen de Jong.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9.
    </div>
  </body>
</html>