Earlier, I had posted about Snipt.org and a WordPress plugin that “embeds” code from it.
The Action, Part 2: Gaming the Service for the Fun of I.T.
Of course, if somebody is allowing you to embed code from a remote location in a faithful manner, the natural next step would be to strip out the display code and then include the code directly into your enclosing Web app, to run whatever you wish. Obviously, source code that requires compilation (as opposed to server-based dynamic language runtime engines/cores that are already installed on your Web server’s host) will not work if you try to embedding it directly into mere Web scripts. On the other hand, you can always force dynamic reloads across various server-side platforms, like JSP and ASP types. Or, if you’ve got a sourceloader available (say, something you’ve been using for C, C++, Java, or a .NET language), so you can fetch the snippets and extract the code and compile them and either force a rebuild or just use reflection in your parent code to fold the snippets into place.
The obvious advantages of this are, heh-heh-heh, obvious. If you need malicious code to bypass protections layered somewhere due to sandboxing of remote compiled code, or remote invoked dynamic code, you can allow your otherwise innocuous code to fetch your wicked-cool-nasties, then reformat them for usage, and then have at it! Or, on the flipside, if you have code that needs to change rapidly and not be present with the rest of the (parent) code, you can do that by taking advantage of the publicly available service, using basic HTTP calls instead of having to support something a bit heavier (and proprietary, or requiring additional libraries).
The Challenge: The Art and Life of Hacking
But let’s also look at the more fun aspects of this… A couple of decades ago, I had a bit of fun with those “small” Core Wars games that popped up every so often. And later, several years ago, when I was building groups of developers to work cohesively as teams, I used the RoboWar/Robocode simulators to have the guys and gals put up their bots into the ‘arena. Now, with something like Snipt.org combining Twitter and the code embedding feature (with the execution of the scrubbed code, of course), we can have social networked code gaming, with CI servers happily crunching away on frequently (and probably erratically) updated source code on the Snipt.org servers and uploading the resultant bots into multiple arena servers around the world. And now, many other non-traditional client formats can participate: smartphones, networked PDAs, hacked game consoles with Web browsers, et al. Good times, folks!
So, I’m proposing to enterprising developers (and yes, architects) out there to try this Robocode-type scenario:
- Create an open specification that describes the warfare allowed in a shared arena system, and set up the game objectives and constraints;
- Create the APIs that use the embedding feature to extract snippets stored on Snipt.org (and any other snippet repository, presumably) and allow R/W to the snippets as needed… offering multiple language implementations to maximize developer coverage;
- Set up some servers to handle the continuous workflow of your choice;
- Assemble your teams for some friendly competition;
- Launch your games and set up a public site displaying the real-time results of the warfare.
Wouldn’t it be fun to have some folks hacking away on their smartphones battling it out with some Linux-PS2 hackers and PC gamers half a world away? Or some military developers coding on their decomissioned workstations against grade school children practicing their CS skills on school computers?