Nmap Development mailing list archives

Re: Test library


From: Patrik Karlsson <patrik () cqure net>
Date: Sat, 22 Dec 2012 09:16:29 -0500

Thanks David.
I will take your suggestions in to account when continuing my work on this.

//Patrik


On Thu, Dec 20, 2012 at 1:35 AM, David Fifield <david () bamsoftware com>wrote:

On Mon, Dec 17, 2012 at 09:40:36PM -0500, Patrik Karlsson wrote:
All,

I've started some work on a Nmap testlib some time ago.
It does work and does some of what I hoped to achieve at the moment,
however, it's far from complete.
I thought I throw it out here to see the response and to determine
whether
it's worth to continue working on.
It currently works by overriding the "normal" socket calls and thereby
allows a test section to feed messages to both the send and receive
functions. This is all happening in the Lua space and should be
"transparent" to the script itself.

I've committed, at least I hope I did (me and git are not friends yet) my
code to a topic branch at github over here;
https://github.com/nevdull77/nmap/tree/testlib

It currently has the testlib library with the patching of the socket code
and two scripts making use of it; http-title and vnc-info.

It looks pretty nice to me. What's in testlib is really a generic mock
socket class. I think that "testlib" should be more general and a mock
socket should be one of the things it provides. There are probably some
scripts that need other forms of input, for example the current time
(like http-date which computes a delta) or other information about the
port.

It would be nice if there were a standard function name, for example
setup_test, that the NSE engine could call in each script that has it
defined. Then scripts wouldn't have to do their own argument checking.
setup_test would create the mock objects and everything else that is
needed, and then NSE would run the action.

David Fifield




-- 
Patrik Karlsson
http://www.cqure.net
http://twitter.com/nevdull77
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: