Updated output for scripts

View: New views
4 Messages — Rating Filter:   Alert me  

Updated output for scripts

by Ron (list) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey guys,

I started working on this last night and just finished. Basically, I
cleaned up and updated the output of every script I've touched. The
current version is in
svn://svn.insecure.org/nmap-exp/ron/nmap-smb

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.

I'm hoping everybody starts using this when they're writing scripts with
multi-line output.

Here is how it looks:
|  smb-check-vulns:
|  |  MS08-067: NOT VULNERABLE
|  |  Conficker: Likely CLEAN
|  |  regsvc DoS: CHECK DISABLED (add '--script-args=unsafe=1' to run)
|_ |_ SMBv2 DoS (CVE-2009-3103): CHECK DISABLED (add
'--script-args=unsafe=1' to run)

|  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
|  |  WINDOWS2003\Guest (RID: 501)
|  |  |  Description: Built-in account for guest access to the
computer/domain
|  |  |_ Flags:       Password not required, Password does not expire,
Account disabled, Normal user account

|  smb-system-info:
|  |  OS Details
|  |  |  Microsoft Windows Server 2003 Service Pack 2 (ServerNT 5.2
build 3790)
|  |  |  Installed on 2009-10-17 20:14:19
|  |  |  Registered to Ron (organization: MJ-12)
|  |  |  Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
|  |  |  Systemroot: C:\WINDOWS
|  |  |_ Page files: C:\pagefile.sys 384 768 (cleared at shutdown => 0)
|  |  Hardware
|  |  |  CPU 0: Intel(R) Core(TM)2 Duo CPU T7500@ 2.20GHz [2194mhz
GenuineIntel]
|  |  |  |_ Identifier 0: x86 Family 6 Model 15 Stepping 11
|  |  |_ Video driver: VMware SVGA II
|  |  Browsers
|  |  |  Internet Explorer 8.0000
|_ |_ |_ Firefox 3.5.4 (en-US)


|  smb-server-stats:
|  |  Server statistics collected since 2009-11-05 08:08:27 (4d11h48m24s):
|  |  |  1388558 bytes (3.58 b/s) sent, 2156012 bytes (5.56 b/s) received
|_ |_ |_ 8772 failed logins, 0 permission errors, 0 system errors, 0
print jobs, 276 files opened


|  smb-enum-domains:
|  |  WINDOWS2003
|  |  |  SID: S-1-5-21-4146152237-3614947961-1862238888
|  |  |  Users: Administrator, ASPNET, Guest, IUSR_WINDOWS2003,
IWAM_WINDOWS2003, ron, SUPPORT_388945a0, test
|  |  |  Creation time: 2009-10-17 12:46:43
|  |  |  Passwords: min length: n/a; min age: n/a; max age: 42 days;
history: n/a
|  |  |_ Account lockout disabled
|  |  Builtin
|  |  |  SID: S-1-5-32
|  |  |  Users: n/a
|  |  |  Creation time: 2009-10-17 12:46:43
|  |  |  Passwords: min length: n/a; min age: n/a; max age: 42 days;
history: n/a
|_ |_ |_ Account lockout disabled


I think they look a lot nicer now.

Any thoughts?

If not, I'll merge this back into the trunk.

Thanks!
Ron

--
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/

Re: Updated output for scripts

by Ron (list) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I made the requested change to remove some of the horizontal space. Here
is how running --script=all against a patch Windows 2003 system looks:


Host script results:
|_smb-brute: guest:<blank> => Password was correct, but user's account
is disabled
| smb-system-info:
|_|_ERROR: NT_STATUS_ACCESS_DENIED
| smb-security-mode:
| | Account that was used for smb scripts: <blank>
| | User-level authentication
| | SMB Security: Challenge/response passwords supported
|_|_Message signing disabled (dangerous, but default)
|_smb-server-stats:
| smb-enum-domains:
|_|_ERROR: NT_STATUS_ACCESS_DENIED (samr.connect4)
| smb-enum-groups:
|_|_ERROR: Couldn't enumerate groups: NT_STATUS_ACCESS_DENIED
(samr.connect4)
|_smb-enum-processes: ERROR: NT_STATUS_ACCESS_DENIED
| smb-os-discovery:
| | OS: Windows Server 2003 3790 Service Pack 2 (Windows Server 2003 5.2)
| | Name: SKULLSECURITY\WINDOWS2003
|_|_System time: 2009-11-14 19:22:34 UTC-6
| smb-enum-users:
|_|_ERROR: Access denied while trying to enumerate users; except against
Windows 2000, Guest or better is typically required
| smb-enum-shares:
| | ERROR: Enumerating shares failed, guessing at common ones
(NT_STATUS_ACCESS_DENIED)
| | ADMIN$ (WARNING: Couldn't get details for share:
NT_STATUS_ACCESS_DENIED)
| | |_Anonymous access: <none>
| | C$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
| | |_Anonymous access: <none>
| | IPC$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|_|_|_Anonymous access: READ
| smb-check-vulns:
| | MS08-067: NOT VULNERABLE
| | Conficker: Likely CLEAN
| | regsvc DoS: CHECK DISABLED (add '--script-args=unsafe=1' to run)
|_|_SMBv2 DoS (CVE-2009-3103): CHECK DISABLED (add
'--script-args=unsafe=1' to run)

And here is the output from a couple scripts running with full output:
| smb-enum-sessions:
| | Users logged in
| | |_WINDOWS2003\ron since 2009-11-06 13:25:28
| | Active SMB sessions
|_|_|_RON is connected from 192.168.102.1 for [just logged in, it's
probably you], idle for [not idle]
| smb-enum-shares:
| | ADMIN$
| | | Type: STYPE_DISKTREE_HIDDEN
| | | Comment: Remote Admin
| | | Users: 0, Max: <unlimited>
| | | Path: C:\WINDOWS
| | | Anonymous access: <none>
| | |_Current user ('ron') access: READ/WRITE
| | C$
| | | Type: STYPE_DISKTREE_HIDDEN
| | | Comment: Default share
| | | Users: 0, Max: <unlimited>
| | | Path: C:\
| | | Anonymous access: <none>
| | |_Current user ('ron') access: READ/WRITE
| | IPC$
| | | Type: STYPE_IPC_HIDDEN
| | | Comment: Remote IPC
| | | Users: 1, Max: <unlimited>
| | | Path:
| | | Anonymous access: READ <not a file share>
|_|_|_Current user ('ron') access: READ <not a file share>



Personally, I think we should stick with the extra whitespace. It feels
too squished together for me.

Thoughts?

Ron

--
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/

Re: Updated output for scripts

by Fyodor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 14, 2009 at 07:26:30PM -0600, Ron wrote:
>
> Personally, I think we should stick with the extra whitespace. It feels
> too squished together for me.
> Thoughts?

It might (or might not) look a bit less squished if the | and _ are
removed from the 2nd level and higher (replaced with spaces).  For
comparison, here is your first example with the three options:

**Removing |_ from levels 2+**
Host script results:
|_smb-brute: guest:<blank> => Password was correct, but user's account is disabled
| smb-system-info:
|_  ERROR: NT_STATUS_ACCESS_DENIED
| smb-security-mode:
|   Account that was used for smb scripts: <blank>
|   User-level authentication
|   SMB Security: Challenge/response passwords supported
|_  Message signing disabled (dangerous, but default)
|_smb-server-stats:
| smb-enum-domains:
|_  ERROR: NT_STATUS_ACCESS_DENIED (samr.connect4)
| smb-enum-groups:
|_  ERROR: Couldn't enumerate groups: NT_STATUS_ACCESS_DENIED (samr.connect4)
|_smb-enum-processes: ERROR: NT_STATUS_ACCESS_DENIED
| smb-os-discovery:
|   OS: Windows Server 2003 3790 Service Pack 2 (Windows Server 2003 5.2)
|   Name: SKULLSECURITY\WINDOWS2003
|_  System time: 2009-11-14 19:22:34 UTC-6
| smb-enum-users:
|_  ERROR: Access denied while trying to enumerate users; except against Windows 2000, Guest or better is typically required
| smb-enum-shares:
|   ERROR: Enumerating shares failed, guessing at common ones (NT_STATUS_ACCESS_DENIED)
|   ADMIN$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|     Anonymous access: <none>
|   C$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|     Anonymous access: <none>
|   IPC$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|_    Anonymous access: READ
| smb-check-vulns:
|   MS08-067: NOT VULNERABLE
|   Conficker: Likely CLEAN
|   regsvc DoS: CHECK DISABLED (add '--script-args=unsafe=1' to run)
|_  SMBv2 DoS (CVE-2009-3103): CHECK DISABLED (add '--script-args=unsafe=1' to run)

**With the |_ (but no extra space)**
Host script results:
|_smb-brute: guest:<blank> => Password was correct, but user's account is disabled
| smb-system-info:
|_|_ERROR: NT_STATUS_ACCESS_DENIED
| smb-security-mode:
| | Account that was used for smb scripts: <blank>
| | User-level authentication
| | SMB Security: Challenge/response passwords supported
|_|_Message signing disabled (dangerous, but default)
|_smb-server-stats:
| smb-enum-domains:
|_|_ERROR: NT_STATUS_ACCESS_DENIED (samr.connect4)
| smb-enum-groups:
|_|_ERROR: Couldn't enumerate groups: NT_STATUS_ACCESS_DENIED (samr.connect4)
|_smb-enum-processes: ERROR: NT_STATUS_ACCESS_DENIED
| smb-os-discovery:
| | OS: Windows Server 2003 3790 Service Pack 2 (Windows Server 2003 5.2)
| | Name: SKULLSECURITY\WINDOWS2003
|_|_System time: 2009-11-14 19:22:34 UTC-6
| smb-enum-users:
|_|_ERROR: Access denied while trying to enumerate users; except against Windows 2000, Guest or better is typically required
| smb-enum-shares:
| | ERROR: Enumerating shares failed, guessing at common ones (NT_STATUS_ACCESS_DENIED)
| | ADMIN$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
| | |_Anonymous access: <none>
| | C$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
| | |_Anonymous access: <none>
| | IPC$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|_|_|_Anonymous access: READ
| smb-check-vulns:
| | MS08-067: NOT VULNERABLE
| | Conficker: Likely CLEAN
| | regsvc DoS: CHECK DISABLED (add '--script-args=unsafe=1' to run)
|_|_SMBv2 DoS (CVE-2009-3103): CHECK DISABLED (add '--script-args=unsafe=1' to run)

**With the extra space ("|_ ")**
Host script results:
|_ smb-brute: guest:<blank> => Password was correct, but user's account is disabled
|  smb-system-info:
|_ |_ ERROR: NT_STATUS_ACCESS_DENIED
|  smb-security-mode:
|  |  Account that was used for smb scripts: <blank>
|  |  User-level authentication
|  |  SMB Security: Challenge/response passwords supported
|_ |_ Message signing disabled (dangerous, but default)
|_ smb-server-stats:
|  smb-enum-domains:
|_ |_ ERROR: NT_STATUS_ACCESS_DENIED (samr.connect4)
|  smb-enum-groups:
|_ |_ ERROR: Couldn't enumerate groups: NT_STATUS_ACCESS_DENIED (samr.connect4)
|_ smb-enum-processes: ERROR: NT_STATUS_ACCESS_DENIED
|  smb-os-discovery:
|  |  OS: Windows Server 2003 3790 Service Pack 2 (Windows Server 2003 5.2)
|  |  Name: SKULLSECURITY\WINDOWS2003
|_ |_ System time: 2009-11-14 19:22:34 UTC-6
|  smb-enum-users:
|_ |_ ERROR: Access denied while trying to enumerate users; except against Windows 2000, Guest or better is typically required
|  smb-enum-shares:
|  |  ERROR: Enumerating shares failed, guessing at common ones (NT_STATUS_ACCESS_DENIED)
|  |  ADMIN$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|  |  |_ Anonymous access: <none>
|  |  C$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|  |  |_ Anonymous access: <none>
|  |  IPC$ (WARNING: Couldn't get details for share: NT_STATUS_ACCESS_DENIED)
|_ |_ |_ Anonymous access: READ
|  smb-check-vulns:
|  |  MS08-067: NOT VULNERABLE
|  |  Conficker: Likely CLEAN
|  |  regsvc DoS: CHECK DISABLED (add '--script-args=unsafe=1' to run)
|_ |_ SMBv2 DoS (CVE-2009-3103): CHECK DISABLED (add '--script-args=unsafe=1' to run)


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

Re: Updated output for scripts

by jah-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

I just wanted to add a vote for the removal extra whitespace and of
pipes from 2nd level and higher output.  To me the extra whitespace is
very wasteful and the pipes are really only helpful when used with the
extra whitespace.
I like that all the smb* scripts will have a consistent output - it's a
good idea.

Regards,

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