Nmap Development mailing list archives

Re: [NSE] Patch for mongodb.lua


From: Martin Holst Swende <martin () swende se>
Date: Tue, 18 Oct 2011 21:11:55 +0200

On 10/17/2011 08:21 PM, Thomas Buchanan wrote:
Hello,

I was testing out the mongodb scripts on my local Ubuntu box, and found that
mongodb.lua (used by mongodb-info.nse) was crashing with a 'nil' table index
as shown below:

# ./nmap -sT -v -d --script-trace --script=mongodb-info -p 27017,28017
localhost
Starting Nmap 5.61TEST2 ( http://nmap.org ) at 2011-10-17 13:03 CDT
<...>
NSE: Starting mongodb-info against 127.0.0.1:27017.
<...>
NSE: MngoDb: Read element name 'localTime' (type:9), data left: 668
NSE: Bson-ERR:Getter for 9 not implemented
NSE: MngoDb:Parsed (nil='nil'), data left : 668
NSE: mongodb-info against 127.0.0.1:27017 threw an error!
/home/thomas/dev/svn/nmap/nselib/mongodb.lua:232: table index is nil
stack traceback:
    /home/thomas/dev/svn/nmap/nselib/mongodb.lua:232: in function
'_elements_to_dict'
    /home/thomas/dev/svn/nmap/nselib/mongodb.lua:278: in function 'fromBson'
    /home/thomas/dev/svn/nmap/nselib/mongodb.lua:572: in function 'query'
    /home/thomas/dev/svn/nmap/scripts/mongodb-info.nse:76: in function
</home/thomas/dev/svn/nmap/scripts/mongodb-info.nse:56>
    (tail call): ?
<more output>

Looking at the BSON documentation, it seems data type 9 is a timestamp
value, 8 bytes in length, so I put together the following simple patch which
makes the script work for me.
Good work!
/Martin


Nmap scan report for localhost (127.0.0.1)
<...>
PORT      STATE SERVICE REASON
27017/tcp open  unknown syn-ack
| mongodb-info:
|   MongoDB Build info
<snip all other output>

Thanks,

Thomas


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

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


Current thread: