The Puppet Master

November 20, 2011

So far we have talked about issues on the client side of a “puppet”. We also need a “puppeteer” in form of a server where to send data we collect (user credentials, cookies, etc.). Since the userscripts are written in JavaScript, we’ve decided to have the server also running JavaScript.

Introducing Akshell..

Akshell is a server engine for applications implemented in JavaScript. It is similar to the currently popular Node.js, but it also provides a full online IDE and FREE APPLICATION HOSTING. Just try it!

Our server is live at http://puppetmaster.akshell.com/.

Akshell offers a fully featured REST framework, mashup (template based) page construction and integrated database backend with a convenient ORM in JavaScript. A simple file server in Akshell looks like this:

require('ak').setup();

// Main page handler
var IndexHandler = Handler.subclass(
  {
    get: function (request) {
      return render('index.html');
    }
  });

// Serves single files
var FileHandler = Handler.subclass(
  {
    get: function (request) {
      file = request.path;
      if (fs.code.isFile(file)) {
        return new Response(
          content = fs.code.read(file),
          status = http.OK,
          headers = {'Content-Type': 'application/octet-stream', 
                     'Content-Disposition': 'attachment'}
        );
      }
      return new Response(content = '', status = http.NOT_FOUND);
    }
  });

// URL Mapper
exports.root = new URLMap(
  // main
  IndexHandler, 'index',

  // files
  ['puppeteer.exe', FileHandler],
  ['exploit.js', FileHandler],
  ['Main.class', FileHandler],
  ['puppet.user.js', FileHandler]
);


Leave a Reply