Nmap Development mailing list archives

Re: Updated output for scripts


From: Fyodor <fyodor () insecure org>
Date: Tue, 10 Nov 2009 18:03:31 -0800

On Tue, Nov 10, 2009 at 09:22:17AM -0600, Ron wrote:

I wrote a function in stdnse.lua called format_output(). It basically
takes a table and converts it to a human-readable string. The (HUGE)
advantage to using this is that everything is formatted basically the
same. Previously, among my own scripts, all of which were written by me,
there were all kinds of different indenting methods. Now, everything
looks the same.

Thanks Ron, I agree that consistency is important!  Also, I have one
minor comment regarding the format:

|  smb-enum-users:
|  |  WINDOWS2003\Administrator (RID: 500)
|  |  |  Description: Built-in account for administering the computer/domain
|  |  |_ Flags:       Password does not expire, Normal user account
|  |  WINDOWS2003\ASPNET (RID: 1008)
|  |  |  Full name:   ASP.NET Machine Account
|  |  |  Description: Account used for running the ASP.NET worker process (aspnet_wp.exe)
|  |  |_ Flags:       Password not required, Password does not expire, Normal user account

Perhaps this amount of initial whitespace is excessive, particularly
when you get several levels deep.  Maybe this would be better?

| smb-enum-users:
| | WINDOWS2003\Administrator (RID: 500)
| | | Description: Built-in account for administering the computer/domain
| | |_Flags:       Password does not expire, Normal user account
| | WINDOWS2003\ASPNET (RID: 1008)
| | | Full name:   ASP.NET Machine Account
| | | Description: Account used for running the ASP.NET worker process (aspnet_wp.exe)
| | |_Flags:       Password not required, Password does not expire, Normal user account

Or perhaps it would be even better with the "|" replaced by a space
for levels 2 and greater:

| smb-enum-users:
|   WINDOWS2003\Administrator (RID: 500)
|     Description: Built-in account for administering the computer/domain
|     Flags:       Password does not expire, Normal user account
|   WINDOWS2003\ASPNET (RID: 1008)
|     Full name:   ASP.NET Machine Account
|     Description: Account used for running the ASP.NET worker process (aspnet_wp.exe)
|     Flags:       Password not required, Password does not expire, Normal user account

Personally, I think I like this last one (#3) best.

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


Current thread: