<!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>tcpstate &mdash; xnet 0.2.0 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.2.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="xnet 0.2.0 documentation" href="index.html" />
    <link rel="next" title="netcats" href="netcats.html" />
    <link rel="prev" title="Xnet - Just like Xmas, but on your networks!" href="index.html" /> 
  </head>
  <body>
    <div class="related">
      <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="netcats.html" title="netcats"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Xnet - Just like Xmas, but on your networks!"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">xnet 0.2.0 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="tcpstate">
<h1>tcpstate<a class="headerlink" href="#tcpstate" title="Permalink to this headline">¶</a></h1>
<p><cite>tcpstate</cite> is essentially a parallell port scanner.</p>
<div class="highlight-bash"><pre>$ tcpstate -h
Usage:

    $$$ Merry Xnet! $$$

 $ /usr/local/bin/tcpstate [options] host1 host2 ...
 $ /usr/local/bin/tcpstate [options] -r hostfile.txt
 $ cat hostsfile.txt | /usr/local/bin/tcpstate [options] -


Options:
  -h, --help            show this help message and exit
  --test                run tests
  --pdb                 enable interactive pdb debugging on exceptions
  --print-source        print source code of tool
  -y n, --parallelism=n
                        set parallelism (default 128)
  -r path, --read=path  read input from file
  -w nsecs, --wait=nsecs
                        wait at most nsecs seconds for actions to complete
  -i nsecs, --interval=nsecs
                        time interval between each action
  --repeat=ntimes       repeat action this many times (-1 = infinity)
  -T, --supress-timeout
                        supress messages from tasks timing out
  -f fmt, --format=fmt  specify output format, see --format-help for info
  --format-help         print output format help
  --split-output=base   produce one output file for each piece of input
  --split-tee=base      like --split-output but also print to stdout
  -v, --verbose         verbose output
  -p PORT, --port=PORT  * port to state check
  -O OPEN, --open=OPEN  * print only results for open ports</pre>
</div>
<div class="section" id="basic-usage">
<h2>Basic usage<a class="headerlink" href="#basic-usage" title="Permalink to this headline">¶</a></h2>
<p>Example 1) Check the default port 80:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>tcpstate www.eff.org www.google.com whois.ripe.net
www.eff.org 80 open
www.google.com 80 open
whois.ripe.net 80 closed
</pre></div>
</div>
<p>Example 2) Check alternative ports:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>tcpstate -p 443 www.eff.org www.google.com whois.ripe.net
www.eff.org 443 open
www.google.com 443 open
whois.ripe.net 443 filtered
</pre></div>
</div>
<p>Example 3) Filtered ports take forever to return, lets wait at most 3.5 seconds:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>tcpstate -w 3.5  -p 443 www.eff.org www.google.com whois.ripe.net
www.eff.org 443 open
www.google.com 443 open
whois.ripe.net <span class="nb">wait</span>-timeout
</pre></div>
</div>
</div>
<div class="section" id="formatting">
<h2>Formatting<a class="headerlink" href="#formatting" title="Permalink to this headline">¶</a></h2>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>tcpstate --format-help

Format variables <span class="k">for </span>tcpstate:

 host    - target host
 port    - target port
 state   - TCP-state or error-message

Default format:
 <span class="s1">&#39;{host} {port} {state}&#39;</span>
</pre></div>
</div>
<p>Example 5) Lets change the output format:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>tcpstate -w 3.5 -p 443 www.eff.org www.google.com whois.ripe.net -f <span class="s2">&quot;port {port} is {state} on {host}&quot;</span>
port 443 is open on www.eff.org
port 443 is open on www.google.com
whois.ripe.net <span class="nb">wait</span>-timeout
</pre></div>
</div>
<p>Example 6) Timeout-messages go to stderr and can be supressed using -T or &#8220;manually&#8221; redirected at will:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>tcpstate -w 2 -p 443 www.eff.org whois.ripe.net -f <span class="s2">&quot;port {port} is {state} on {host}&quot;</span> 2&gt;/tmp/errors
port 443 is open on www.eff.org

<span class="nv">$ </span>cat /tmp/errors
whois.ripe.net <span class="nb">wait</span>-timeout
</pre></div>
</div>
</div>
<div class="section" id="alternative-invocation">
<h2>Alternative invocation<a class="headerlink" href="#alternative-invocation" title="Permalink to this headline">¶</a></h2>
<p>Example 7) Alternative ways to specify target addresses are of course possible.
IP range notation, netmasks or by reading files (-r) or stdin.</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>tcpstate -w 5 69.50.232.50-55
69.50.232.50 <span class="nb">wait</span>-timeout
69.50.232.51 <span class="nb">wait</span>-timeout
69.50.232.52 80 open
69.50.232.53 80 open
69.50.232.54 80 open
69.50.232.55 <span class="nb">wait</span>-timeout

<span class="nv">$ </span><span class="nb">echo </span>72.29.78.36 &gt; hosts.txt
<span class="nv">$ </span>tcpstate - &lt; hosts.txt
72.29.78.36 80 open

<span class="nv">$ </span>tcpstate -r hosts.txt
72.29.78.36 80 open

<span class="nv">$ </span><span class="nb">echo </span>tripleaes.com | tcpstate -
tripleaes.com 80 open
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">tcpstate</a><ul>
<li><a class="reference internal" href="#basic-usage">Basic usage</a></li>
<li><a class="reference internal" href="#formatting">Formatting</a></li>
<li><a class="reference internal" href="#alternative-invocation">Alternative invocation</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">Xnet - Just like Xmas, but on your networks!</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="netcats.html"
                        title="next chapter">netcats</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/tcpstate.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <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="netcats.html" title="netcats"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Xnet - Just like Xmas, but on your networks!"
             >previous</a> |</li>
        <li><a href="index.html">xnet 0.2.0 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2013, Krister Hedfors.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>