Codebase list pysmb / 6230f2e docs / html / api / nmb_NetBIOS.html
6230f2e

Tree @6230f2e (Download .tar.gz)

nmb_NetBIOS.html @6230f2eraw · history · blame

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>NetBIOS class &#8212; pysmb 1.2.7 documentation</title>
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/sphinxdoc.css" type="text/css" />
    <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="SMBConnection Class" href="smb_SMBConnection.html" />
    <link rel="prev" title="NBNSProtocol Class" href="nmb_NBNSProtocol.html" /> 
  </head><body>
    <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="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="smb_SMBConnection.html" title="SMBConnection Class"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="nmb_NBNSProtocol.html" title="NBNSProtocol Class"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">pysmb 1.2.7 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">NetBIOS class</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="netbios-class">
<h1>NetBIOS class<a class="headerlink" href="#netbios-class" title="Permalink to this headline"></a></h1>
<dl class="simple">
<dt>To use the NetBIOS class in your application,</dt><dd><ol class="arabic simple">
<li><p>Create a new NetBIOS instance</p></li>
<li><p>Call <em>queryName</em> method for each name you wish to query. The method will block until a reply is received from the remote SMB/CIFS service, or until timeout.</p></li>
<li><p>When you are done, call <em>close</em> method to release the underlying resources.</p></li>
</ol>
</dd>
</dl>
<dl class="py class">
<dt id="nmb.NetBIOS.NetBIOS">
<em class="property">class </em><code class="sig-prename descclassname">nmb.NetBIOS.</code><code class="sig-name descname">NetBIOS</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">broadcast</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">listen_port</span><span class="o">=</span><span class="default_value">0</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/nmb/NetBIOS.html#NetBIOS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nmb.NetBIOS.NetBIOS" title="Permalink to this definition"></a></dt>
<dd><dl class="py method">
<dt id="nmb.NetBIOS.NetBIOS.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">broadcast</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">listen_port</span><span class="o">=</span><span class="default_value">0</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/nmb/NetBIOS.html#NetBIOS.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nmb.NetBIOS.NetBIOS.__init__" title="Permalink to this definition"></a></dt>
<dd><p>Instantiate a NetBIOS instance, and creates a IPv4 UDP socket to listen/send NBNS packets.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>broadcast</strong> (<em>boolean</em>) – A boolean flag to indicate if we should setup the listening UDP port in broadcast mode</p></li>
<li><p><strong>listen_port</strong> (<em>integer</em>) – Specifies the UDP port number to bind to for listening. If zero, OS will automatically select a free port number.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="nmb.NetBIOS.NetBIOS.close">
<code class="sig-name descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/nmb/NetBIOS.html#NetBIOS.close"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nmb.NetBIOS.NetBIOS.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the underlying and free resources.</p>
<p>The NetBIOS instance should not be used to perform any operations after this method returns.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>None</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="nmb.NetBIOS.NetBIOS.queryIPForName">
<code class="sig-name descname">queryIPForName</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">ip</span></em>, <em class="sig-param"><span class="n">port</span><span class="o">=</span><span class="default_value">137</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">30</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/nmb/NetBIOS.html#NetBIOS.queryIPForName"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nmb.NetBIOS.NetBIOS.queryIPForName" title="Permalink to this definition"></a></dt>
<dd><p>Send a query to the machine with <em>ip</em> and hopes that the machine will reply back with its name.</p>
<p>The implementation of this function is contributed by Jason Anderson.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ip</strong> (<em>string</em>) – If the NBNSProtocol instance was instianted with broadcast=True, then this parameter can be an empty string. We will leave it to the OS to determine an appropriate broadcast address.
If the NBNSProtocol instance was instianted with broadcast=False, then you should provide a target IP to send the query.</p></li>
<li><p><strong>port</strong> (<em>integer</em>) – The NetBIOS-NS port (IANA standard defines this port to be 137). You should not touch this parameter unless you know what you are doing.</p></li>
<li><p><strong>timeout</strong> (<em>integer/float</em>) – Number of seconds to wait for a reply, after which the method will return None</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of string containing the names of the machine at <em>ip</em>. On timeout, returns None.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="nmb.NetBIOS.NetBIOS.queryName">
<code class="sig-name descname">queryName</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">ip</span><span class="o">=</span><span class="default_value">''</span></em>, <em class="sig-param"><span class="n">port</span><span class="o">=</span><span class="default_value">137</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">30</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/nmb/NetBIOS.html#NetBIOS.queryName"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#nmb.NetBIOS.NetBIOS.queryName" title="Permalink to this definition"></a></dt>
<dd><p>Send a query on the network and hopes that if machine matching the <em>name</em> will reply with its IP address.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ip</strong> (<em>string</em>) – If the NBNSProtocol instance was instianted with broadcast=True, then this parameter can be an empty string. We will leave it to the OS to determine an appropriate broadcast address.
If the NBNSProtocol instance was instianted with broadcast=False, then you should provide a target IP to send the query.</p></li>
<li><p><strong>port</strong> (<em>integer</em>) – The NetBIOS-NS port (IANA standard defines this port to be 137). You should not touch this parameter unless you know what you are doing.</p></li>
<li><p><strong>timeout</strong> (<em>integer/float</em>) – Number of seconds to wait for a reply, after which the method will return None</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A list of IP addresses in dotted notation (aaa.bbb.ccc.ddd). On timeout, returns None.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="nmb_NBNSProtocol.html"
                        title="previous chapter">NBNSProtocol Class</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="smb_SMBConnection.html"
                        title="next chapter">SMBConnection Class</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/api/nmb_NetBIOS.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#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="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="smb_SMBConnection.html" title="SMBConnection Class"
             >next</a> |</li>
        <li class="right" >
          <a href="nmb_NBNSProtocol.html" title="NBNSProtocol Class"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">pysmb 1.2.7 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">NetBIOS class</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2001-2021, Michael Teo https://miketeo.net/.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
    </div>
  </body>
</html>