Nmap Development mailing list archives
Re: Leading newlines in script output
From: David Fifield <david () bamsoftware com>
Date: Sun, 3 Oct 2010 15:45:04 -0700
On Sun, Oct 03, 2010 at 04:05:50PM +0100, Djalal Harouni wrote:
On 2010-09-29 22:04:38 -0700, David Fifield wrote:On Wed, Sep 29, 2010 at 09:34:50PM -0500, Kris Katterjohn wrote:-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/29/2010 09:29 PM, David Fifield wrote:The code in formatScriptOutput strips leading newlines from the output (and my fix keeps it this way). I'm sure many script writers have been annoyed by this. To force the first line of output to be on a line after the script id, we have things like this: scripts/asn-query.nse: return (" \n%s"):format( table.concat( output, "\n" ) ) scripts/citrix-brute-xml.nse: return " \n" .. result scripts/qscan.nse: return " \n" .. report(stats) This trick of starting the output with whitespace to fool the newline remover is also used in stdnse.format_output. I can't think of a reason why we want newlines removed. Let's get rid of it?Sounds good to me!All done. I also updated " \n" in scripts where I found it.Thx for this change. When testing dns-zone-transfer and nfs* scripts I've found that some scripts that use the tab library to arrange their output, will have an extra empty line between each row when dumping the output. Current output of dns-zone-transfer: | dns-zone-transfer: | | Domains Added Targets | Node Names 159 | | | | DNS Records Added Targets | | A 32 | | MX 9 | | NS 4 | | SOA 1 | | CNAME 160 | |_Total new targets added to Nmap scan queue: 365. (Other scripts are also affected).
I can't reproduce this with dns-zone-transfer. The change I made shouldn't have affected this. Can you post an exact command line or XML output? Are you running in Zenmap maybe? We've had reports of blank lines in Zenmap output but I've never been able to reproduce that personally either. Sometimes scripts that use tab.lua look like they are using extra blank lines because there is blank space at the ends of lines. The extra blanks wrap and make it look like another line. David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: Leading newlines in script output Djalal Harouni (Oct 03)
- Re: Leading newlines in script output David Fifield (Oct 03)
- Re: Leading newlines in script output Djalal Harouni (Oct 31)
- Re: Leading newlines in script output David Fifield (Nov 01)
- Re: Leading newlines in script output Djalal Harouni (Oct 31)
- Re: Leading newlines in script output David Fifield (Oct 03)