Offensive Thinking
Internet Thoughtcrime
2010-05-20 New project: http2code
A new repository has been added to my github account: http2code.
It was inspired by w3af’s ability to export a raw request to a template source code file for different languages (as a matter of fact, I once wrote the Ruby export). The idea is simple: I have a raw HTTP GET or POST request, e.g. from my favourite HTTP (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’s content to some template code for the HTTP library du jour I hopefully still found lying around somewhere on my hard drive. Then, I started to adapt the code to my liking.
The whole “copy the raw request, insert it into source code template (if any) and reformat until it fits into what the HTTP library expects (like parsing the raw body of a POST into an associative array, for example)” 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.
So I wrote http2code:
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
It takes a raw request from stdin and parses it into JSON data structures for headers, body and the first line containing the HTTP verb and URL. If you supply a template name, it’ll just put the JSON 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.
At the moment there’s only a typhoeus template, I plan on adding them as I need / write them.
A little update on Enc: I added a gemspec and generally made it “gem compatible”. Build and install your gem by running
gem build Enc.gemspec
gem install Enc-x.x.x.gem
The command line client is now separate from the module and called encli in the /bin directory.
2010-04-09 New github release: Enc
I’ve added a new github repository to my account: Enc. It’s a module containing a variety of encoders, mainly for string encoding. Yes, I know. Please don’t envy me for being so creative with the name. It’s a gift.
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 Enc are that I’m forgetful and I don’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 XOR 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.
The module includes a very basic command line tool which reads from stdin and writes to stdout. Run the module file with -h to see the currently available encoders:
./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 <encoder> [params] <string from stdin>
Examples:
./enc.rb Std::url <<< '<script>'
./enc.rb Std::url true <<< '<script>'
Please see the YARD documentation for available parameters.
The YARD documentation ist available online at http://courts.github.com/enc, if you don’t want to build it yourself. It has a more detailed description of the different encoders.
2010-03-21 New snippets on github: alarm and bitify
I’ve added two more scripts to my github snippets repository that you may find useful. I use them quite frequently.
bitify
I know, I’m all creative with names, aren’t I ;)? This little script, basically a one-liner, uses bit.ly to shorten a URL on the command line. Because, you know, I hate leaving the command line. Web interfaces are for WIMPs. Together with twidge, it enables me to use twitter and identi.ca from the shell.
alarm
I searched for a good solution to the following problem for quite some time: I am notoriously forgetful. So, besides my trusty remind, I was in search for a simple command line tool to pop up a message at a certain time. Sounds easy, doesn’t it? Well, the problem is the “command line” part. Sure, you can just use the “at” command, but I wanted a popup box, not a message in a terminal I may already have forgotten about.
Fortunately, remind implements something called “daemon mode”. 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’s how alarm was born.
Alarm messages take either an absolute or a relative time and a message. Examples:
alarm ‘12:00 Prepare dinner’
alarm ‘30m Dinner is ready’
I start the remind daemon in my xmonad.hs file as follows:
remind -z ‘-k zenity —info —text=“%s” &’ ~/.alarm_reminders
This pops up a nice message box with zenity when an alarm is due.
2010-03-20 New ical2rem.rb version on github
I finally pushed a new version of ical2rem.rb to github. It’s been a while that I’ve worked on this. I’m using the update I pushed today for quite a while now, I just didn’t came around to actually release it.
It’s a major update in the sense that ical2rem.rb now uses Rick DeNatale’s RiCal for all its VCAL parsing. I switched because VPim didn’t work with Ruby 1.9 at the time and as an Arch Linux user, I made the switch quite early.
So please go and check out the new version on github. Drop me a mail if you find any bugs, I appreciate it.
On a completely unrelated note, I also updated my dotfiles a little and added four new ones: inputrc, irbrc, vimperatorrc and wyrdrc. Have fun.
« previous