Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: [NSE] mac-geolocation : BSSID (MAC) address based geolocation of WiFi access points
From: Gorjan Petrovski <mogi57 () gmail com>
Date: Sat, 28 May 2011 18:28:45 +0200

On Sat, May 28, 2011 at 10:38 AM, Djalal Harouni <tixxdz () opendz org> wrote:
On 2011-05-27 21:10:55 -0700, Fyodor wrote:
On Fri, May 27, 2011 at 01:57:54PM +0200, Gorjan Petrovski wrote:
* the nmap.registry[host.ip]["mac-geolocation"] array is read for
MACs, which will be filled by snmp-interfaces.nse (with a patch I'm

At first I was going to suggest that you use a name relating to what
is stored in the registry key rather than what script will use the
information.  But, on the other hand, naming it after the script means
that the script is in charge of the value.  So mac-geolocation could
(and maybe should) delete the array values once it is done with them.
That way they don't bloat the registry more and more as the scan
Yes, if this information is just used by hostrule and portrule scripts,
then we should just put it under nmap.registry[host.ip], and make sure
that this table is a weak table [1].
I might have understood this the wrong way, but wouldn't making the
table a weak table be unnecessary? Wouldn't assigning nil to the table
be enough to clear it?
If I understood it correctly, an object is not deleted when there's a
strong reference to it. Is there a possibility of the table being
referenced outside of the scripts that use it?

A better solution would be to
create such a table in nse_main.lua before running the scripts and
convert the appropriate scripts to use it, and if we are not sure if
this table will be collected, then we can make it nil in nse_main.lua
after finishing the host scan.
Wouldn't that just unnecessarily swamp the nse_main.lua with
script-specific code?

Another important point is that we should perhaps document in the NSEDoc
the information stored in the registry, especially the info that is not
collected, perhaps someone will find this useful and will write a
postrule script that will dump it.
It's already included in the description of the script. Did you mean
to include further information (perhaps about deleting the contents of
the table once it's used)?

I might be missing some important bit in your reasoning, Djalal, so it
would be great to have some explanation.

Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]