Nmap Development mailing list archives
[RFC] NSE nmap.registry cleanup
From: Daniel Miller <bonsaiviking () gmail com>
Date: Tue, 31 Jul 2012 16:58:12 -0500
List,I've attached 5 patches that all do about the same thing, but to various scripts and libraries. Basically, I wanted to audit the use of the nmap.registry, since the documentation [1] states that per-host registries should be used as often as possible to conserve memory across long scans. Most of these uses were in the form of nmap.registry[host.ip][keyname] = value, or nmap.registry[SCRIPT_NAME][host.ip] = value.
The less-straightforward patches are:0003: snmp-interfaces used to store MAC addresses for mac-geolocation to use. mac-geolocation doesn't exist anymore since Google removed the service it depended on, so I stripped all registry use out.
0004: netbios.lua used nmap.registry["netbios_names_" .. host] to cache results, since its functions required an IP or hostname argument, not a host table. I changed these to accept either an IP or a host table, since broadcast-netbios-master-browser only has IP info available. The library now uses host registry when available, but checks the global registry if the first check fails.
One possible (non-default) candidate for reducing memory is reverse-index, which stores a table of IP, port, protocol, and status in the registry where just the IP would be sufficient to generate the output. I left it alone because 1. it is not a default script and 2. the extra information may be used for future expansions of the script.
I am willing to commit any or all of these patches, as I have tested them myself and found no problems. Any comments or further testing is much appreciated, though.
Dan [1] http://nmap.org/book/nse-api.html#nse-api-registry
Attachment:
0002-Make-path-mtu.nse-use-host-not-nmap-registry.patch
Description:
Attachment:
0001-Make-cvs-scripts-use-host-not-nmap-registry.patch
Description:
Attachment:
0003-Remove-mac-geolocation-info-from-snmp-interfaces.patch
Description:
Attachment:
0004-Make-netbios.lua-use-host-registry.-Functions-now-ca.patch
Description:
Attachment:
0005-Make-smbauth.lua-use-host-not-nmap-registry.patch
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [RFC] NSE nmap.registry cleanup Daniel Miller (Jul 31)
- Re: [RFC] NSE nmap.registry cleanup David Fifield (Aug 07)
- Re: [RFC] NSE nmap.registry cleanup Daniel Miller (Aug 07)
- Re: [RFC] NSE nmap.registry cleanup David Fifield (Aug 07)