From f5cae99a2a5b088c944dfaebe8df07bf3bf12281 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 12 Jan 2010 17:53:01 +0000 Subject: [PATCH] Check that nmap.registry.args exists before trying to access nmap.registry.args["http.useragent"]. The args table doesn't exist during --script-updatedb. The bug was found by Tom Sellers and fixed by Jah. --- CHANGELOG | 3 ++- nselib/http.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f613d2bdb..894a1290e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,7 +7,8 @@ o A new script argument, http.useragent, gives the ability to modify the User-Agent header sent by NSE from its default of "Mozilla/5.0 (compatible; Nmap Scripting Engine; http://nmap.org/book/nse.html)". You can set it to the empty string to disable the User-Agent - entirely. [David] + entirely. A bug was found and fixed by Tom Sellers and Jah, + respectively. [David] o [Nmat] The --ssl, --output, and --hex-dump options now work with --exec and --sh-exec. This is done by forking a separate process to diff --git a/nselib/http.lua b/nselib/http.lua index 8363ff541..d1cdfc91f 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -42,7 +42,7 @@ local have_ssl = (nmap.have_ssl() and pcall(require, "openssl")) local USER_AGENT do - local arg = nmap.registry.args["http.useragent"] + local arg = nmap.registry.args and nmap.registry.args["http.useragent"] if arg and arg == "" then USER_AGENT = nil elseif arg then