Installing http-screenshot.nse – Nmap Script to Screenshot Web Services

Ryan Linn from SpiderLabs has released an excellent Nmap script which takes screenshots of web services. However, the original blog post is no longer accurate and some tweaks are needed to get the script working. I’ve included updated instructions below:

1) The Nmap script requires wkhtmltoimage to take screenshots. First, install a dependency of wkhtmltoimage:
$ sudo apt-get install xfonts-75dpi

2) Navigate to the wkhtmltoimage website (http://wkhtmltopdf.org/downloads.html) and download the appropriate package for your system. In this case, I’m installing on an Ubuntu 14.04 machine:
$ wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-i386.deb
$ sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-i386.deb

3) Download the Nmap script and move it to the appropriate location:
$ git clone git://github.com/SpiderLabs/Nmap-Tools.git
$ cd Nmap-Tools/NSE/
$ sudo cp http-screenshot.nse /usr/share/nmap/scripts/
$ sudo nmap --script-updatedb

4) We need to change a line within the Nmap script, or it will throw the error, “failed (verify wkhtmltoimage-i386 is in your path)”:
$ sudoedit /usr/share/nmap/scripts/http-screenshot.nse

5) Change line 51 within http-screenshot.nse:
From:
local cmd = "wkhtmltoimage-i386 -n " .. prefix .. "://" .. host.ip .. ":" .. port.number .. " " .. filename .. " 2> /dev/null >/dev/null"
To:
local cmd = "wkhtmltoimage -n " .. prefix .. "://" .. host.ip .. ":" .. port.number .. " " .. filename .. " 2> /dev/null >/dev/null"

The script should now function properly.

Leave a Reply

Your email address will not be published. Required fields are marked *