Nmap Development mailing list archives

Re: [NSE] rpc library; Portmapper program list stored in the


From: Patrick Donnelly <batrick () batbytes com>
Date: Sun, 25 Apr 2010 20:38:13 -0400

Hi Djalal,

On Sun, Apr 25, 2010 at 8:26 PM, Djalal Harouni <tixxdz () gmail com> wrote:
NSE Question:
 - Is there a trick to remove data from the nmap registry when we don't need it anymore ? to save memory.
 example:
  - we are scanning a big network

  - we are at host 10.10.1.1:
       - rpcinfo script stores some *data* into the nmap.registry['10.10.1.1'][rpc_data]
       - nfs-* scripts use this *data* which is in the nmap.registry['10.10.1.1'][rpc_data]

  - ...

  - we are at host 10.10.1.88:
       - at this time we don't need 10.10.1.1 *data* which is in the nmap.registry['10.10.1.1'][rpc_data]

       Question: is there a function or a trick to remove this *data* *automatically* in order to save memory, when 
we don't need it ?

thx for applying my previous patches :)

The usual way to have Lua automatically free data that is no longer
needed is to use a weak table [1]. The problem we (currently) have is
that Lua is unable to know when a host is no longer being scanned. In
your above example you use the ip address of the host being scanned as
a string. If we instead used a userdata *that NSE holds onto until the
host is no longer being scanned*, then we could use a weak keyed table
so that the rpc_data is collected.

Two points to consider:

o Is this a big enough problem (memory-wise) that NSE needs to solve this issue?
o Can scripts get by with manually deleting (setting registry fields
to nil) old data?

[1] http://www.lua.org/pil/17.html

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

Current thread: