Sploit!

Description

Grab and eval Ruby code via HTTP. You don’t care about security, right?

This gem is Dr. Nic’s fault. We were looking for an easy way to run Ruby code that was publicly available on a web server, and though we’ve all written something to do this a time or two, we couldn’t find a convenient gem.

I hacked up a quick example:

ruby -rubygems -ropen-uri -e \
  'eval open("http://gist.github.com/raw/473222/snippet.rb").read' \
  jbarnette dr-nic-magic-awesome

…but why use a simple Ruby one-liner when we can go overboard and package it as a gem? While we’re at it, why not add a tiny bit of extra sugar for Gists?

This is not an original idea. It’s been done a ton of times before, but this one is ours. Don’t use it for anything real or it’ll melt your face.

Examples

# eval the contents of a URL
$ sploit http://jbarnette.com/hello.rb

# eval a file in a gist
$ sploit -g 474087 second.rb

# eval the first unnamed file (gistfile1.txt) in a gist
$ sploit -g 47087

Installation

$ gem install sploit

License

Copyright 2010 John Barnette, Dr. Nic Williams

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.