Nmap Development mailing list archives

Re: [NSE] rpc library


From: David Fifield <david () bamsoftware com>
Date: Wed, 21 Apr 2010 19:04:48 -0600

On Sun, Apr 18, 2010 at 10:54:05AM +0200, Patrik Karlsson wrote:
Hi Djalal,

I've looked through the code and I'm happy with the changes. Great work!
Good catch with the version mismatch checks in the Dir and GetAttributes functions!

I made some changes to shorten the error messages returned by the Helper class back to the scripts:

| nfs-acls:  
|   /tmp
|     ERROR: rpc.Helper.GetAttributes: Mount query failed: Permission denied.
|   /home/storage/backup
|     uid: 0; gid: 0; mode: drwxr-xr-x (755)
|   /home
|_    uid: 0; gid: 0; mode: drwxr-xr-x (755)

becomes

| nfs-acls:  
|   /tmp
|     ERROR: Mount failed: Permission denied.
|   /home/storage/backup
|     uid: 0; gid: 0; mode: drwxr-xr-x (755)
|   /home
|_    uid: 0; gid: 0; mode: drwxr-xr-x (755)

The long error messages that helps us track down where the error
occurred is printed as a debug message instead.
I'm attaching this patch and unless David or anyone else has any
additional thoughts I say we commit the changes.

For reference, this is what I get with the current scripts and library:

# ./nmap -p 111 192.168.0.190 --script='nfs-*,rpc*' -d2
PORT    STATE SERVICE REASON
111/tcp open  rpcbind syn-ack
| rpcinfo:
|   100000  2            111/tcp  rpcbind
|   100000  2            111/udp  rpcbind
|   100003  2,3         2049/tcp  nfs
|   100003  2,3         2049/udp  nfs
|   100005  1,3          713/udp  mountd
|   100005  1,3         1016/tcp  mountd
|   100011  1,2          647/udp  rquotad
|   100021  0,1,3,4      877/udp  nlockmgr
|   100021  0,1,3,4     1022/tcp  nlockmgr
|   100024  1            905/udp  status
|_  100024  1           1021/tcp  status
| nfs-showmount:
|_  /Users/david 192.168.0.0
| nfs-statfs:
|   /Users/david
|_    ERROR: Mount failed
| nfs-acls:
|   /Users/david
|_    ERROR: Mount failed
| nfs-dirlist:
|   /Users/david
|_    ERROR: Mount failed

Here it is with the new code.

# ./nmap --datadir . -p 111 192.168.0.190 --script='nfs-*,rpc*' -d2
PORT    STATE SERVICE REASON
111/tcp open  rpcbind syn-ack
| rpcinfo:
|   100000  2            111/tcp  rpcbind
|   100000  2            111/udp  rpcbind
|   100003  2,3         2049/tcp  nfs
|   100003  2,3         2049/udp  nfs
|   100005  1,3          613/udp  mountd
|   100005  1,3         1013/tcp  mountd
|   100011  1,2          620/udp  rquotad
|   100021  0,1,3,4      877/udp  nlockmgr
|   100021  0,1,3,4     1022/tcp  nlockmgr
|   100024  1            905/udp  status
|_  100024  1           1021/tcp  status
| nfs-showmount:
|_  /Users/david 192.168.0.0
| nfs-dirlist:
|   /Users/david
|_    ERROR: rpc.Helper.Dir: Mount: Reply state was not Accepted(0) as expected
| nfs-statfs:
|   /Users/david
|_    ERROR: rpc.Helper.ExportStats: Mount: Reply state was not Accepted(0) as expected
| nfs-acls:
|   /Users/david
|_    ERROR: rpc.Helper.GetAttributes: Mount: Reply state was not Accepted(0) as expected

It looks good to me and you can merge it. My suggestion for the error
messages above is to print what the reply state actually is, and not
just say that it was not Accepted.

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: