1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00
0bin/docs/.build/html/en/zerobinpaste_tool.html
2015-05-10 19:53:55 +02:00

194 lines
9.1 KiB
HTML

<!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>zerobinpaste command-line tool &mdash; 0bin 0.1 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: '0.1',
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="0bin 0.1 documentation" href="../index.html" />
<link rel="next" title="Introduction" href="../fr/intro.html" />
<link rel="prev" title="Options" href="options.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="../fr/intro.html" title="Introduction"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="options.html" title="Options"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="zerobinpaste-command-line-tool">
<h1>zerobinpaste command-line tool<a class="headerlink" href="#zerobinpaste-command-line-tool" title="Permalink to this headline"></a></h1>
<p>zerobinpaste is a simple CLI tool (analogous to pastebinit or wgetpaste) to use
with files or shell redirection in terminal or simple scripts.</p>
<p>Example use-cases might look like:</p>
<div class="highlight-python"><div class="highlight"><pre>% zerobinpaste README.rst
http://some.0bin.site/paste/0cc3d8a8...
% grep error /var/log/syslog | zerobinpaste
http://some.0bin.site/paste/81fd1324...
% zerobinpaste docs/en/*.rst
easy_install.rst http://some.0bin.site/paste/9adc576a...
apache_install.rst http://some.0bin.site/paste/01408cbd...
options.rst http://some.0bin.site/paste/921b2768...
...
% ps axlf | zerobinpaste | mail -s &quot;Process tree on $(date)&quot; root
</pre></div>
</div>
<p>Produced links can then be copy-pasted to some IRC channel or used in whatever
other conceivable way.</p>
<p>Tool does encryption by itself on the client machine and key (after hashmark) is
never sent to server or anywhere but the tool&#8217;s stdout stream (e.g. terminal).</p>
<p>Tool has to be built with <a class="reference external" href="http://nodejs.org/">node.js</a> separately (see below).</p>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>At least the pastebin site (main URL where you&#8217;d paste stuff with the browser)
has to be specified for the tool to use either via -u (&#8211;url) option (can be
simplified with shell alias - e.g. <code class="docutils literal"><span class="pre">alias</span> <span class="pre">zp='zerobinpaste</span> <span class="pre">-u</span> <span class="pre">http://some.0bin.site</span></code>)
or in the &#8220;~/.zerobinpasterc&#8221; configuration file (json format).</p>
<div class="line-block">
<div class="line">Non-option arguments are interpreted as files to upload/paste contents of.</div>
<div class="line">If no arguments are specified, data to paste will be read from stdin stream.</div>
</div>
<p>Simple configuration file may look like this:</p>
<blockquote>
<div>{&#8220;url&#8221;: &#8220;<a class="reference external" href="http://some.0bin.site">http://some.0bin.site</a>&#8220;}</div></blockquote>
<p>Any options (in the long form, e.g. &#8220;url&#8221; for &#8211;url above) that are allowed on
the command-line can be specified there.</p>
<p>Run the tool with -h or &#8211;help option to see full list of supported parameters.</p>
</div>
<div class="section" id="build-installation">
<h2>Build / Installation<a class="headerlink" href="#build-installation" title="Permalink to this headline"></a></h2>
<p>In essence:</p>
<blockquote>
<div>0bin% cd tools
0bin/tools% make
...
0bin/tools% cp zerobinpaste ~/bin # install to PATH</div></blockquote>
<p>&#8220;npm&#8221; binary (packaged and installed with node.js) is required to pull in build
dependencies, if necessary, and &#8220;node&#8221; binary is required for produced binary to
run.</p>
<p>Use &#8220;make&#8221; in &#8220;tools&#8221; path to produce non-minified runnable &#8220;zerobinpaste&#8221;
script there.</p>
<p><code class="docutils literal"><span class="pre">make</span> <span class="pre">ugly</span></code> command can be used instead of <code class="docutils literal"><span class="pre">make</span></code> to create &#8220;minified&#8221;
version (using/installing <a class="reference external" href="https://github.com/mishoo/UglifyJS">uglifyjs</a>, about 25% smaller in size).</p>
<p>Resulting &#8220;zerobinpaste&#8221; script requires only node.js (&#8220;node&#8221; binary) installed
to run and can be placed in any of the PATH dirs (e.g. &#8220;~/bin&#8221;,
&#8220;/usr/local/bin&#8221;) to be run just as &#8220;zerobinpaste&#8221;.</p>
</div>
<div class="section" id="why-node-js-and-not-python">
<h2>Why node.js and not python<a class="headerlink" href="#why-node-js-and-not-python" title="Permalink to this headline"></a></h2>
<p>Unfortunately, it&#8217;s fairly complex and unreliable to replicate non-trivial and
undocumented encryption protocol that <a class="reference external" href="http://crypto.stanford.edu/sjcl/">SJCL</a> convenience methods employ, and any
mistake in encryption is guaranteed to produce unreadable paste.</p>
<p>Current implementation uses same JavaScript code (and V8 node.js engine) that
browsers do, hence can be fairly simple and robust.</p>
<p>Future development plans include supporting configurable, less complex and more
widespread encryption schemas, allowing for simplier non-javascript client as
well.</p>
<p>See <a class="reference external" href="https://github.com/sametmax/0bin/pull/39">related pull request</a> for more details.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">zerobinpaste command-line tool</a><ul>
<li><a class="reference internal" href="#usage">Usage</a></li>
<li><a class="reference internal" href="#build-installation">Build / Installation</a></li>
<li><a class="reference internal" href="#why-node-js-and-not-python">Why node.js and not python</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="options.html"
title="previous chapter">Options</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../fr/intro.html"
title="next chapter">Introduction</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/en/zerobinpaste_tool.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<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" 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="../fr/intro.html" title="Introduction"
>next</a> |</li>
<li class="right" >
<a href="options.html" title="Options"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">0bin 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&copy; Copyright 2012, Sam et Max.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
</body>
</html>