Nmap Development mailing list archives

Re: Leading newlines in script output


From: Djalal Harouni <tixxdz () gmail com>
Date: Sun, 3 Oct 2010 16:05:50 +0100

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).

-- 
tixxdz
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: