<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hax by Jaku &#187; curl</title>
	<atom:link href="http://haxbyjaku.com/tag/curl/feed/" rel="self" type="application/rss+xml" />
	<link>http://haxbyjaku.com</link>
	<description>Don't tell me what to do.</description>
	<lastBuildDate>Sat, 03 Dec 2011 11:17:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Posting data to Pastebin with cURL</title>
		<link>http://haxbyjaku.com/haxs/posting-data-to-pastebin-with-curl/</link>
		<comments>http://haxbyjaku.com/haxs/posting-data-to-pastebin-with-curl/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 04:02:43 +0000</pubDate>
		<dc:creator>Jaku</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Haxs]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[pastebin]]></category>
		<category><![CDATA[pastebin and curl]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://haxbyjaku.com/?p=379</guid>
		<description><![CDATA[I needed to get a bunch of text up on pastebin and I&#8217;ve used my own cURL script to get it up there before. But then I started to think that others might want to be able to just post to pastebin directly from their bash shell. What started off as a simple one-liner then [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to get a bunch of text up on pastebin and I&#8217;ve used my own cURL script to get it up there before. But then I started to think that others might want to be able to just post to pastebin directly from their bash shell. What started off as a simple one-liner then started to grow into a bit more. </p>
<p>With pastebin you are able to post to a sub-domain, as well as put a name along with the post and even set how long the data should stay up. So I&#8217;ve made it possible for you to edit those settings in the script so that if you want to post as &#8220;bob&#8221; and keep the data up there for a day you can do all of that. </p>
<p>The easiest way to install this would be the following 2 commands</p>
<p><code>sudo curl haxbyjaku.com/pastebin -o /usr/bin/pastebin<br />
sudo chmod +x  /usr/bin/pastebin</code></p>
<p>I know that you won&#8217;t run sudo on commands that download code from my server, but you can trust it since you get to see everything. <img src='http://haxbyjaku.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>After it is installed I suggest editing the file as well so that you can set your own settings such as username or pastebin URL. Once that is all set simple run a command like <code>"echo test | pastebin"</code> in your terminal and you&#8217;ll get the URL that pastebin posted it to. You can even do something like <code>"echo /etc/passwd | pastebin"</code> and it will work exactly as you expect it to.</p>
<p>I&#8217;ve pasted the code after the break as well.</p>
<p><span id="more-379"></span><br />
<code><br />
#!/bin/bash<br />
#Pastebin poster, created by Jaku</p>
<p>#Username<br />
USER="jaku_bin"<br />
#Data retainment (d=1 day, m=1 month, f=forever)<br />
RETAIN="d"<br />
#Default Text type (too many to list)<br />
TEXT="None"<br />
#Default pastbin URL<br />
URL="pastebin.com/pastebin.php"</p>
<p>while read input; do<br />
CODE="$CODE<br />
$input"<br />
done</p>
<p>curl -i -d "code2=$CODE&#038;paste=Send&#038;expiry=$RETAIN&#038;poster=$USER&#038;format=$TEXT" $URL -s| grep -i Location:<br />
</code></p>
<p>So like I said, it&#8217;s not very complicated but it certainly does get the job done. Let me know if you have any comments or questions! <img src='http://haxbyjaku.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://haxbyjaku.com/haxs/posting-data-to-pastebin-with-curl/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

