<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://www.offensivethinking.org/</id>
  <title>Offensive Thinking</title>
  <updated>2010-05-20T19:44:09Z</updated>
  <link rel="alternate" href="http://www.offensivethinking.org/"/>
  <link rel="self" href="http://www.offensivethinking.org/atom.xml"/>
  <author>
    <name>Patrick Hof</name>
    <uri>http://www.offensivethinking.org</uri>
  </author>
  <entry>
    <id>tag:www.offensivethinking.org,2010-05-20:/thoughts/2010/05/20/new-project-http2code/</id>
    <title type="html">New project: http2code</title>
    <published>2010-05-20T19:44:09Z</published>
    <updated>2010-05-20T19:44:09Z</updated>
    <link rel="alternate" href="http://www.offensivethinking.org/thoughts/2010/05/20/new-project-http2code/"/>
    <content type="html">&lt;p style="text-align:justify;"&gt;A new repository has been added to my github account: &lt;a href="http://courts.github.com/http2code"&gt;http2code&lt;/a&gt;.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;It was inspired by &lt;a href="http://w3af.sourceforge.net/"&gt;w3af&amp;#8217;s&lt;/a&gt; ability to export a raw request to a template source code file for different languages (as a matter of fact, I once wrote the &lt;a href="http://w3af.svn.sourceforge.net/viewvc/w3af/trunk/core/data/export/ruby_export.py?view=markup"&gt;Ruby export&lt;/a&gt;).  The idea is simple: I have a raw &lt;span class="caps"&gt;HTTP&lt;/span&gt; &lt;span class="caps"&gt;GET&lt;/span&gt; or &lt;span class="caps"&gt;POST&lt;/span&gt; request, e.g. from my favourite &lt;span class="caps"&gt;HTTP&lt;/span&gt; (attack) proxy. Now quite often, I want to write a little script revolving around that request, for example for fuzzing. Previously, I always manually added the request&amp;#8217;s content to some template code for the &lt;span class="caps"&gt;HTTP&lt;/span&gt; library du jour I hopefully still found lying around somewhere on my hard drive. Then, I started to adapt the code to my liking.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;The whole &amp;#8220;copy the raw request, insert it into source code template (if any) and reformat until it fits into what the &lt;span class="caps"&gt;HTTP&lt;/span&gt; library expects (like parsing the raw body of a &lt;span class="caps"&gt;POST&lt;/span&gt; into an associative array, for example)&amp;#8221; is a rather dull and repetitive task better done by a script. w3af already does it quite nicely, but I wanted a simple command line tool for this.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;So I wrote http2code:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
Usage: http2code [options]
 -n, --newlines            Use \n as line delimiter when parsing the
                           POST request instead of \r\n
 -t, --template TEMPLATE   Use template TEMPLATE
 -b, --header-blacklist    Use header blacklist to automatically
                           remove common headers not needed
 -h, --help                Show this help

Available Templates:
--------------------
typhoeus.rb
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align:justify;"&gt;It takes a raw request from stdin and parses it into &lt;span class="caps"&gt;JSON&lt;/span&gt; data structures for headers, body and the first line containing the &lt;span class="caps"&gt;HTTP&lt;/span&gt; verb and &lt;span class="caps"&gt;URL&lt;/span&gt;. If you supply a template name, it&amp;#8217;ll just put the &lt;span class="caps"&gt;JSON&lt;/span&gt; data into the template where some placeholders are defined. Then it writes the result to stdout. Pretty simple, but it saves me a lot of time. You will still have to manually adapt the code though, it may not work right out of the box.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;At the moment there&amp;#8217;s only a &lt;a href="http://github.com/pauldix/typhoeus"&gt;typhoeus&lt;/a&gt; template, I plan on adding them as I need / write them.&lt;/p&gt;</content>
    <summary type="html">Parse HTTP requests to JSON and optionally put them into template source code</summary>
  </entry>
  <entry>
    <id>tag:www.offensivethinking.org,2010-04-10:/thoughts/2010/04/10/update-on-enc/</id>
    <title type="html">Update on Enc</title>
    <published>2010-04-10T16:18:24Z</published>
    <updated>2010-04-10T16:18:24Z</updated>
    <link rel="alternate" href="http://www.offensivethinking.org/thoughts/2010/04/10/update-on-enc/"/>
    <content type="html">&lt;p style="text-align:justify;"&gt;A little update on &lt;a href="/projects/enc/"&gt;&lt;em&gt;Enc&lt;/em&gt;&lt;/a&gt;: I added a gemspec and generally made it &amp;#8220;gem compatible&amp;#8221;. Build and install your gem by running&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
gem build Enc.gemspec
gem install Enc-x.x.x.gem
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align:justify;"&gt;The command line client is now separate from the module and called &lt;em&gt;encli&lt;/em&gt; in the &lt;em&gt;/bin&lt;/em&gt; directory.&lt;/p&gt;</content>
    <summary type="html">Now available with gemspec</summary>
  </entry>
  <entry>
    <id>tag:www.offensivethinking.org,2010-04-09:/thoughts/2010/04/09/new-github-release-enc/</id>
    <title type="html">New github release: Enc</title>
    <published>2010-04-09T20:08:27Z</published>
    <updated>2010-04-09T20:08:27Z</updated>
    <link rel="alternate" href="http://www.offensivethinking.org/thoughts/2010/04/09/new-github-release-enc/"/>
    <content type="html">&lt;p style="text-align:justify;"&gt;I&amp;#8217;ve added a new &lt;a href="http://www.github.com"&gt;github&lt;/a&gt; repository to &lt;a href="http://www.github.com/courts"&gt;my account&lt;/a&gt;: &lt;a href="http://www.github.com/courts/enc"&gt;&lt;em&gt;Enc&lt;/em&gt;&lt;/a&gt;. It&amp;#8217;s a module containing a variety of encoders, mainly for string encoding. Yes, I know. Please don&amp;#8217;t envy me for being so creative with the name. It&amp;#8217;s a gift.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;Its intended use is for web application fuzzing and the like, but you can of course also use it for whatever string encoding purposes you have. The main reasons why I started to write &lt;em&gt;Enc&lt;/em&gt; are that I&amp;#8217;m forgetful and I don&amp;#8217;t like to repeat myself. I always wrote the same little one- or two-liners again and again, or, worse, I repeatedly searched for them on the net (how do I &lt;span class="caps"&gt;XOR&lt;/span&gt; two strings in Ruby again?). I finally got fed up and started to collect these little snippets in a, hopefully useful, module. My plan is to add new encoders as I need them or think they may be useful someday.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;The module includes a very basic command line tool which reads from stdin and writes to stdout. Run the module file with &lt;em&gt;-h&lt;/em&gt; to see the currently available encoders:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
./enc.rb -h

Available Encoders
------------------
HTML::dec
HTML::hex
HTML::html
MSSQL::char
MySQL::char
MySQL::comment
Std::b64
Std::hex
Std::md5
Std::rand_upcase
Std::sha1
Std::url
Std::xor
UTF8::bin
UTF8::utf8

Usage: ./enc.rb &amp;lt;encoder&amp;gt; [params] &amp;lt;string from stdin&amp;gt;

Examples:
./enc.rb Std::url &amp;lt;&amp;lt;&amp;lt; '&amp;lt;script&amp;gt;'
./enc.rb Std::url true &amp;lt;&amp;lt;&amp;lt; '&amp;lt;script&amp;gt;'

Please see the YARD documentation for available parameters.
&lt;/code&gt;
&lt;/pre&gt;
&lt;p style="text-align:justify;"&gt;The &lt;a href="http://yardoc.org/"&gt;&lt;span class="caps"&gt;YARD&lt;/span&gt;&lt;/a&gt; documentation ist available online at &lt;a href="http://courts.github.com/enc"&gt;http://courts.github.com/enc&lt;/a&gt;, if you don&amp;#8217;t want to build it yourself. It has a more detailed description of the different encoders.&lt;/p&gt;</content>
    <summary type="html">A Ruby module with string encoders</summary>
  </entry>
  <entry>
    <id>tag:www.offensivethinking.org,2010-03-21:/thoughts/2010/03/21/new-snippets-on-github/</id>
    <title type="html">New snippets on github: alarm and bitify</title>
    <published>2010-03-21T12:49:31Z</published>
    <updated>2010-03-21T12:49:31Z</updated>
    <link rel="alternate" href="http://www.offensivethinking.org/thoughts/2010/03/21/new-snippets-on-github/"/>
    <content type="html">&lt;p style="text-align:justify;"&gt;I&amp;#8217;ve added two more scripts to my &lt;a href="http://www.github.com/courts/snippets"&gt;github snippets repository&lt;/a&gt; that you may find useful. I use them quite frequently.&lt;/p&gt;
&lt;h2&gt;&lt;a href="http://github.com/courts/snippets/tree/master/bitify/"&gt;bitify&lt;/a&gt;&lt;/h2&gt;
&lt;p style="text-align:justify;"&gt;I know, I&amp;#8217;m all creative with names, aren&amp;#8217;t I ;)? This little script, basically a one-liner, uses &lt;a href="http://bit.ly"&gt;bit.ly&lt;/a&gt; to shorten a &lt;span class="caps"&gt;URL&lt;/span&gt; on the command line. Because, you know, I hate leaving the command line. Web interfaces are for &lt;a href="https://secure.wikimedia.org/wikipedia/en/wiki/WIMP_(computing)"&gt;WIMPs&lt;/a&gt;. Together with &lt;a href="http://software.complete.org/software/wiki/twidge"&gt;twidge&lt;/a&gt;, it enables me to use &lt;a href="http://twitter.com"&gt;twitter&lt;/a&gt; and &lt;a href="http://identi.ca"&gt;identi.ca&lt;/a&gt; from the shell.&lt;/p&gt;
&lt;h2&gt;&lt;a href="http://github.com/courts/snippets/tree/master/alarm/"&gt;alarm&lt;/a&gt;&lt;/h2&gt;
&lt;p style="text-align:justify;"&gt;I searched for a good solution to the following problem for quite some time: I am notoriously forgetful. So, besides my trusty &lt;a href="http://www.roaringpenguin.com/products/remind"&gt;remind&lt;/a&gt;, I was in search for a simple command line tool to pop up a message at a certain time. Sounds easy, doesn&amp;#8217;t it? Well, the problem is the &amp;#8220;command line&amp;#8221; part. Sure, you can just use the &amp;#8220;at&amp;#8221; command, but I wanted a popup box, not a message in a terminal I may already have forgotten about.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;Fortunately, remind implements something called &amp;#8220;daemon mode&amp;#8221;. It allows you to run a remind instance in the background, triggering arbitrary commands at a certain time. Perfect. All I needed was a simple script to allow me to conveniently add reminders to the file watched by remind. That&amp;#8217;s how &lt;em&gt;alarm&lt;/em&gt; was born.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;Alarm messages take either an absolute or a relative time and a message.  Examples:&lt;/p&gt;
&lt;p&gt;alarm &amp;#8216;12:00 Prepare dinner&amp;#8217;&lt;br /&gt;
alarm &amp;#8216;30m Dinner is ready&amp;#8217;&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;I start the remind daemon in my xmonad.hs file as follows:&lt;/p&gt;
&lt;p&gt;remind -z &amp;#8216;-k zenity &amp;#8212;info &amp;#8212;text=&amp;#8220;%s&amp;#8221; &amp;amp;&amp;#8217; ~/.alarm_reminders&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;This pops up a nice message box with &lt;a href="http://live.gnome.org/Zenity"&gt;zenity&lt;/a&gt; when an alarm is due.&lt;/p&gt;</content>
    <summary type="html">Two more scripts I frequently use that you may find useful.</summary>
  </entry>
  <entry>
    <id>tag:www.offensivethinking.org,2010-03-20:/thoughts/2010/03/20/new-ical2rem-rb-version/</id>
    <title type="html">New ical2rem.rb version on github</title>
    <published>2010-03-20T20:11:23Z</published>
    <updated>2010-03-20T20:11:23Z</updated>
    <link rel="alternate" href="http://www.offensivethinking.org/thoughts/2010/03/20/new-ical2rem-rb-version/"/>
    <content type="html">&lt;p style="text-align:justify;"&gt;I finally pushed a new version of &lt;a href="/projects/ical2rem"&gt;ical2rem.rb&lt;/a&gt; to &lt;a href="http://www.github.com"&gt;github&lt;/a&gt;. It&amp;#8217;s been a while that I&amp;#8217;ve worked on this.  I&amp;#8217;m using the update I pushed today for quite a while now, I just didn&amp;#8217;t came around to actually release it.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;It&amp;#8217;s a major update in the sense that ical2rem.rb now uses Rick DeNatale&amp;#8217;s &lt;a href="http://ri-cal.rubyforge.org"&gt;RiCal&lt;/a&gt; for all its &lt;span class="caps"&gt;VCAL&lt;/span&gt; parsing. I switched because &lt;a href="http://vpim.rubyforge.org"&gt;VPim&lt;/a&gt; didn&amp;#8217;t work with Ruby 1.9 at the time and as an Arch Linux user, I made the switch quite early.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;So please go and check out the &lt;a href="http://www.github.com/courts/ical2rem.rb/"&gt;new version on github&lt;/a&gt;. Drop me a mail if you find any bugs, I appreciate it.&lt;/p&gt;
&lt;p style="text-align:justify;"&gt;On a completely unrelated note, I also updated my &lt;a href="/projects/dotfiles"&gt;dotfiles&lt;/a&gt; a little and added four new ones: inputrc, irbrc, vimperatorrc and wyrdrc. Have fun.&lt;/p&gt;</content>
    <summary type="html">Now with Ruby 1.9 support.</summary>
  </entry>
</feed>
