Nmap Development mailing list archives
Re: stdnse.format_output causing scripts to appear with blank output
From: Ron <ron () skullsecurity net>
Date: Mon, 1 Feb 2010 09:23:21 -0600
On Sun, 31 Jan 2010 12:40:24 -0700 David Fifield <david () bamsoftware com> wrote:
There is a problem with stdnse.format_output as it is used in scripts. When it gets passed an empty table, it returns the empty string. When a script returns the empty string, it shows up in the output table with no output. See citrix-enum-apps-xml and citrix-enum-servers-xml here. $ nmap --datadir . --script=safe scanme.nmap.org Starting Nmap 5.20 ( http://nmap.org ) at 2010-01-31 12:27 MST Nmap scan report for scanme.nmap.org (64.13.134.52) Host is up (0.072s latency). Not shown: 994 filtered ports PORT STATE SERVICE 25/tcp closed smtp 53/tcp open domain 70/tcp closed gopher 80/tcp open http |_citrix-enum-apps-xml: |_citrix-enum-servers-xml: | http-headers: | Date: Sun, 31 Jan 2010 19:28:13 GMT | Server: Apache/2.2.3 (CentOS) | Accept-Ranges: bytes | Content-Length: 739 | Connection: close | Content-Type: text/html; charset=UTF-8 | |_ (Request type: HEAD) |_http-date: Sun, 31 Jan 2010 19:28:14 GMT; +1s from local time. |_html-title: Go ahead and ScanMe! 113/tcp closed auth 31337/tcp closed Elite In r16655 I made it so that top-level calls to stdnse.format_output will return nil, not the empty string. I did a quick grep of scripts and all of them seem to return the result of stdnse.format_output directly, and won't have a problem if the result they return is not a string. Are there any problems with doing this? David Fifield
Hi David, I just took the time to review that change, and it looks good to me (though I didn't test it). You actually fixed it the same way I would have -- by adding a second function that is called by the first. I was having a lot of trouble with the recursive nature, and that completely fixes it. Thanks! -- Ron Bowes http://www.skullsecurity.org _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- stdnse.format_output causing scripts to appear with blank output David Fifield (Jan 31)
- Re: stdnse.format_output causing scripts to appear with blank output Ron (Feb 01)