From 474add91600e09949c9a2193d98d6ce70ecabc02 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 4 Nov 2015 03:57:18 +0000 Subject: [PATCH] Allow http-ls to work when openssl not present (checksum feature not available) --- scripts/http-ls.nse | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/http-ls.nse b/scripts/http-ls.nse index d8438a942..95a89b8c2 100644 --- a/scripts/http-ls.nse +++ b/scripts/http-ls.nse @@ -2,8 +2,8 @@ local http = require "http" local shortport = require "shortport" local stdnse = require "stdnse" local string = require "string" -local openssl = require "openssl" local ls = require "ls" +local have_ssl, openssl = pcall(require,'openssl') description = [[ Shows the content of an "index" Web page. @@ -20,7 +20,7 @@ categories = {"default", "discovery", "safe"} -- @usage -- nmap -n -p 80 --script http-ls test-debit.free.fr -- --- @args http-ls.checksum compute a checksum for each listed file +-- @args http-ls.checksum compute a checksum for each listed file. Requires OpenSSL. -- (default: false) -- @args http-ls.url base URL path to use (default: /) -- @@ -145,7 +145,7 @@ local function list_files(host, port, url, output, maxdepth, basedir) for fname, date, size in string.gmatch(resp.body, pattern) do local continue = true local directory = isdir(fname, size) - if ls.config('checksum') and not directory then + if have_ssl and ls.config('checksum') and not directory then local checksum = "" local resp = http.get(host, port, url .. fname) if not resp.location and resp.body then