Nmap Development mailing list archives

Re: MongoDB scripts


From: David Fifield <david () bamsoftware com>
Date: Fri, 29 Jan 2010 15:27:57 -0700

On Wed, Jan 27, 2010 at 09:17:41PM +0100, Martin Holst Swende wrote:
Martin Holst Swende wrote:
David Fifield wrote:
Is BSON used in anything besides MongoDB? If not, I think the BSON
functions should be moved into mongodb.lua so that only one new library
is added.
    

It is only used by MongoDB afaik. I put it in a separate library since I
thought it would be 'cleaner' that way, and perhaps other services use
it in the future. But I will move it into mongodb.lua - noone else uses
bson as of yet.

I have put the Bson library code inside the mongodb library now. It
makes a pretty large file....

The name mongodb-query, to me, sounds like it's a script that will run a
general database query. The script really retrieves the server status
and build info. (Even though it does this, if I understand the code
correctly, by sending a couple of special queries.) I suggest renaming
this script to mongodb-info.
    
Done.
  
And what about renaming mongodb-get-tables to mongodb-databases? It is
using the listDatabases command after all. That would fit with my
proposed name mysql-databases for a script by Patrik Karlsson.
    
Done. I also made error handling a bit more robust, I hope .

Thanks! I have committed the scripts in r16647. This is the output I get
from a fresh MacPorts installation of MongoDB:

27017/tcp open  unknown
| mongodb-databases:
|   ok = 1
|   databases
|     1
|       empty = true
|       sizeOnDisk = 1
|       name = local
|     0
|       empty = true
|       sizeOnDisk = 1
|       name = admin
|_  totalSize = 0
| mongodb-info:
|   MongoDB Build info
|     ok = 1
|     bits = 64
|     version = 1.2.1
|     gitVersion = nogitversion
|     sysInfo = Darwin mac-mini.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3 10:37:10 PST 2009; 
root:xnu-1486.2.11~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_41
|   Server status
|     mem
|       resident = 3
|       virtual = 1198
|       mapped = 0
|     ok = 1
|     globalLock
|       ratio = 1.9904059403782e-05
|       lockTime = 1708
|       totalTime = 85811641
|_    uptime = 85

Here's an idea for both of the scripts: When you get a response, you can
set the service version with the set_port_version function.
        http://nmap.org/nsedoc/lib/nmap.html#set_port_version
Then the port name won't be "unknown" in the output. Additionally, with
monogdb-info, you can set the version number. See
        http://nmap.org/book/nse-api.html#scripting-tbl-port-version-values
for the full list of things that can be set.

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: