mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 03:11:48 +00:00
Add netbios name lookup caching code in order to avoid multiple lookups for
the same host.ip.
This commit is contained in:
parent
c9c80ffc63
commit
c80a28f5f2
1 changed files with 13 additions and 4 deletions
|
|
@ -278,11 +278,20 @@ function start(host)
|
|||
end
|
||||
|
||||
-- Store the name of the server
|
||||
status, result = netbios.get_server_name(host.ip)
|
||||
if(status == true) then
|
||||
state['name'] = result
|
||||
local nbcache_mutex = nmap.mutex("Netbios lookup mutex")
|
||||
nbcache_mutex "lock"
|
||||
if ( not(host.registry['netbios_name']) ) then
|
||||
status, result = netbios.get_server_name(host.ip)
|
||||
if(status == true) then
|
||||
host.registry['netbios_name'] = result
|
||||
state['name'] = result
|
||||
end
|
||||
else
|
||||
stdnse.print_debug(2, "SMB: Resolved netbios name from cache")
|
||||
state['name'] = host.registry['netbios_name']
|
||||
end
|
||||
|
||||
nbcache_mutex "done"
|
||||
|
||||
stdnse.print_debug(2, "SMB: Starting SMB session for %s (%s)", host.name, host.ip)
|
||||
|
||||
if(port == nil) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue