Nmap Development mailing list archives

Re: autonomous system numbers NSE script


From: Fyodor <fyodor () insecure org>
Date: Sat, 28 Jun 2008 20:33:47 -0700

On Thu, Jun 19, 2008 at 01:56:26AM +0100, jah wrote:
On 18/06/2008 01:40, Michael Pattrick wrote:

As Kris said, I've had the same requirement for whois.nse. 

Hi Jah.  How is whois.nse coming along?  This script was actually the
prime motivator for the NSE mutex system:

http://nmap.org/book/nse-api.html#nse-mutex

Have you had a chance to try updating whois.nse to use mutex so that
it solves the query concurrency problem and we can add it to
nmap/scripts ?  Maybe it could do something like:

1) Check the registry to see if whois information is already available
   for a netblock containing the target IP.  If so, either print that,
   or print a pointer to the IP which was used initially to look up
   the data.  e.g. "Same as ww.x.yyy.z".  If the data can be expressed
   in a few lines, it might be best to just repeat it.  If it takes 10
   lines, we should probably just use the pointer.  If the data isn't
   available, continue.

2) Try to lock a whois.nse-specific mutex.

3) Once you have the mutex locked, you probably need to repeat check
   #1, as the data might have been added while you were waiting on the
   mutex.  If not, continue.

4) Do the whois query, add the information to the registry for the
   given netblock.

5) Unlock the mutex.  Return the data.

The process could possibly be optimized a bit.  This is just an
off-the-cuff proposal.  And you may end up that 64.5.5.10 runs before
64.5.5.9, so .9 ends up with a forward pointer to the .10 results.  I
think that is fine.

Cheers,
-F

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


Current thread: