From 2424c6d2a4ae3a0c07109fe54712efc39cf8864f Mon Sep 17 00:00:00 2001 From: perdo Date: Tue, 17 Jul 2012 16:11:10 +0000 Subject: [PATCH] Add a check to see if reponse from which we wish to extract links is not nil. --- scripts/http-rfi-spider.nse | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/http-rfi-spider.nse b/scripts/http-rfi-spider.nse index f9923bebf..68cc245f1 100644 --- a/scripts/http-rfi-spider.nse +++ b/scripts/http-rfi-spider.nse @@ -213,11 +213,13 @@ function action(host, port) -- now try inclusion by parameters local injectable = {} -- search for injectable links (as in sql-injection.nse) - local links = httpspider.LinkExtractor:new(r.url, r.response.body, crawler.options):getLinks() - for _,u in ipairs(links) do - local url_parsed = url.parse(u) - if url_parsed.query then - table.insert(injectable, u) + if r.response.status and r.response.body then + local links = httpspider.LinkExtractor:new(r.url, r.response.body, crawler.options):getLinks() + for _,u in ipairs(links) do + local url_parsed = url.parse(u) + if url_parsed.query then + table.insert(injectable, u) + end end end if #injectable > 0 then