Nmap Development mailing list archives
Re: CouchDB scripts
From: David Fifield <david () bamsoftware com>
Date: Fri, 29 Jan 2010 19:18:13 -0700
On Wed, Jan 27, 2010 at 09:17:41PM +0100, Martin Holst Swende wrote:
A Couchdb library and scripts is now finished(at least in alpha). It consists of : * json.lua - library for parsing json * couchdb-databases.nse - script which get database info * couchdb-get-stats.nse - script which get some runtime statistics from the database. Sample output is below (the bottom one may be a bit verbose - perhaps I should compact that a bit. The scripts can be found at the same place (or via hg pull ; hg update). For future reference : would you rather I send files via email ?
Thanks. These scripts will be good ones to have. I tested it against
CouchDB installed fresh from MacPorts. The first time running after
starting the server I see
PORT STATE SERVICE
5984/tcp open unknown
|_couchdb-get-stats:
|_couchdb-databases:
The second and every following time I run the script, I get
PORT STATE SERVICE
5984/tcp open unknown
| couchdb-get-stats:
| httpd_request_methods
| GET
| current = 2
| description = number of HTTP GET requests
| couchdb
| request_time
| current = 39
| description = length of a request inside CouchDB without MochiWeb
| httpd_status_codes
| 200
| current = 2
| description = number of HTTP 200 OK responses
| httpd
| requests
| current = 2
|_ description = number of HTTP requests
|_couchdb-databases:
Do you know what couchdb-get-stats would fail the first time only?
I like that you have split JSON into a separate library. The library is
too verbose with -d. The very low level parsing debug messages like
NSE: Json:Parsed key a
NSE: Json:Parsing node value 1, b:2
NSE: Json:Parsed value 1
NSE: Json:Parsed key b
NSE: Json:Parsing node value 2
NSE: Json:Parsed value 2
should be pushed up to -d4, or removed altogether if they are no longer
needed.
I would like json.qtrim to handle backslash escapes, and signal an error
if it doesn't get a valid quoted string. It looks like fromJson can
silently return bad data in the case of an error. I added these to your
test cases:
'() test ()',
'1 / 2',
'"gaz\\"onk"',
'{foo:"gaz\\"onk", pi:3.14159,hello:{ wo:"rld"}}',
They decode and flatten to, respectively,
() test (),
1 / 2,
gaz\,
{hello={wo=rld,},pi=3.14159,foo=gaz\,}
I would expect an error in the first two cases and
gaz"onk
{hello={wo=rld,},pi=3.14159,foo=gaz"onk,}
for the last two. I like the flatten functionality, but you should make
it return JSON so that the library can be used to encode as well as
decode. If you just want a quick look at a Lua table, use
nsedebug.tostr.
http://nmap.org/nsedoc/lib/nsedebug.html#tostr
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:
- MongoDB scripts Martin Holst Swende (Jan 19)
- Re: MongoDB scripts David Fifield (Jan 25)
- Re: MongoDB scripts Martin Holst Swende (Jan 25)
- Re: MongoDB scripts Martin Holst Swende (Jan 27)
- Re: MongoDB scripts David Fifield (Jan 29)
- Re: CouchDB scripts David Fifield (Jan 29)
- Re: CouchDB scripts Martin Holst Swende (Jan 31)
- Re: CouchDB scripts David Fifield (Feb 01)
- Re: CouchDB scripts David Fifield (Feb 01)
- CouchDB and MongoDB Martin Holst Swende (Feb 03)
- Re: CouchDB and MongoDB David Fifield (Feb 15)
- Re: CouchDB and MongoDB Martin Holst Swende (Feb 22)
- Re: CouchDB and MongoDB David Fifield (Feb 23)
- Re: CouchDB and MongoDB Martin Holst Swende (Feb 27)
- Re: CouchDB and MongoDB David Fifield (Feb 28)
- Re: MongoDB scripts Martin Holst Swende (Jan 25)
- Re: MongoDB scripts David Fifield (Jan 25)
- Re: CouchDB and MongoDB Patrick Donnelly (Feb 28)
