Thursday, October 29, 2015

Kali - peepingtom + capture.js + phantomjs problems

At the time of this post, I experienced the following problems getting peepingtom and phantom.js up and running:

Step 1:
Compile phantom.js from source.  If you are experiencing problems with the ./build.sh script complaining of out of memory problems, increase your swap space.  Follow the directions on this blog here:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04


Step 2.
Copy the built binary into /usr/bin/phantomjs

Step 3.
Modify capture.js file to the following:


var page = require('webpage').create(),
    url, filename, size;

var args = require('system').args;
url = args[1]
filename = args[2]
// url = phantom.args[0];
// filename = phantom.args[1];
page.viewportSize = { width: 800, height: 600 };
page.clipRect = { top: 0, left: 0, width: 800, height: 600 };
page.open(url, function (status) {
    //if (status !== 'success') {
    //    console.log('Unable to load the address!');
    //} else {
        window.setTimeout(function () {
            page.render(filename);
            phantom.exit();
        }, 200);
    //}
});