Nmap Development mailing list archives
Re: `--script dns-client-subnet-scan' failed to work.
From: Gyanendra Mishra <anomaly.the () gmail com>
Date: Wed, 18 Mar 2015 15:30:57 +0530
Hi, As far as I see it the problem exists because line 327 returns nil instead of an empty list and ipairs cant work on nil values. Simply adding {} after return in line 327 works. Lets see what the main developers have to say.
--- dns-client-subnet-scan.nse 2015-03-18 15:16:53.067082418 +0530 +++ dns-client-subnet-scan-new.nse 2015-03-18 15:17:14.835081502 +0530 @@ -324,7 +324,7 @@ local subnet = { family = nmap.address_family(), address = address, mask = mask } local status, resp = dns.query(domain, {host = nameserver, port=port.number, protocol=port.protocol, retAll=true, subnet=subnet}) if ( not(status) ) then - return + return {} end if ( "table" ~= type(resp) ) then resp = { resp } end return resp
Gyanendra On Wed, Mar 18, 2015 at 8:42 AM, s0h3ck <s0h3ck () gmail com> wrote:
Hi Hongyi (and mentors), Good news, I can reproduce the bug. This means whether we are doing a wrong manipulation or the script is not properly programmed. If a mentor think it's a bug, I would like to give a patch to prove myself as a valuable programmer to Nmap team. I did some test with the -d (debug) option to see what is going behind and I think I know what's wrong. The two critics parts that I doubt is where are gather the local value such as argDomain below the line where are described the categories. The second part I will look is the Generic for inside the action "function". I become more familiar with Lua, but I'm an expert, so I would like to dig something :) Thanks. I appreciate your feedback. s0h3ck. ----------------------------------------------------- With -d (debug) option NSE: Script scanning 27.35.62.19. NSE: Starting runlevel 1 (of 1) scan. NSE: Starting dns-client-subnet-scan against 27.35.62.19:53. Initiating NSE at 23:06 NSE: dns.query() got zero responses attempting to resolve query: www.google.com NSE: dns-client-subnet-scan against 27.35.62.19:53 threw an error! /usr/bin/../share/nmap/scripts/dns-client-subnet-scan.nse:356: bad argument #1 to 'ipairs' (table expected, got no value) stack traceback: [C]: in function 'ipairs' /usr/bin/../share/nmap/scripts/dns-client-subnet-scan.nse:356: in function </usr/bin/../share/nmap/scripts/dns-client-subnet-scan.nse:335> (...tail calls...) Completed NSE at 23:06, 8.00s elapsed Nmap scan report for 27.35.62.19 Host is up, received echo-reply (0.25s latency). Scanned at 2015-03-17 23:06:15 EDT for 11s PORT STATE SERVICE REASON 53/udp open|filtered domain no-response Final times for host: srtt: 252274 rttvar: 252274 to: 1261370 -- View this message in context: http://nmap-dev.996309.n3.nabble.com/script-dns-client-subnet-scan-failed-to-work-tp25994p26000.html Sent from the Nmap - Dev mailing list archive at Nabble.com. _______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
-- Gyanendra Mishra CS Sophomore BITS PILANI, Pilani Campus email-anomaly.the () gmail com
Attachment:
working.patch
Description:
_______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- `--script dns-client-subnet-scan' failed to work. Hongyi Zhao (Mar 16)
- Re: `--script dns-client-subnet-scan' failed to work. s0h3ck (Mar 17)
- Re: `--script dns-client-subnet-scan' failed to work. Gyanendra Mishra (Mar 18)
- Re: `--script dns-client-subnet-scan' failed to work. s0h3ck (Mar 17)