Advertisement
Guest User

nmap_http_screenshot

a guest
Feb 8th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. description = [[
  2.         Gets a screenshot if webserver is present
  3. ]]
  4.  
  5. author = "Anon"
  6. license = "GPLv2"
  7. categories = {"discovery", "safe"}
  8. local shortport = require "shortport"
  9. local stdnse = require "stdnse"
  10. portrule = shortport.http
  11. action = function(host, port)
  12.         local ssl = port.version.service_tunnel
  13.         local prefix = "http"
  14.         local filename = "screenshot-nmap-" .. host.targetname .. ":" .. port.number .. ".png"
  15.  
  16.         if ssl == "ssl" then
  17.                 prefix = "https"
  18.         end
  19.         if port.number == 443 then
  20.                 prefix = "https"
  21.         end
  22.  
  23.         local cmd = "cutycapt --url=" .. prefix .. "://" .. host.targetname .. ":" .. port.number .. " --out='" .. filename .. "' 2> /dev/null   >/dev/null"
  24.         local ret = os.execute(cmd)
  25.         local result = "failed (verify cutycapt is in your path)"
  26.         if ret then
  27.                 result = "Saved to " .. filename
  28.         end
  29.         return stdnse.format_output(true,  result)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement