diff --git a/scripts/address-info.nse b/scripts/address-info.nse index b7a26f5..b518219 100644 --- a/scripts/address-info.nse +++ b/scripts/address-info.nse @@ -99,15 +99,14 @@ local function matches(addr, pattern) end local function get_manuf(mac) - if not nmap.registry.mac then + if not nmap.registry.mac_prefixes then local catch = function() return end local try = nmap.new_try(catch) -- Create the table in the registry so we can share between scripts - nmap.registry.mac = {} - nmap.registry.mac.prefixes = try(datafiles.parse_mac_prefixes()) + nmap.registry.mac_prefixes = try(datafiles.parse_mac_prefixes()) end local prefix = string.upper(string.format("%02x%02x%02x", mac[1], mac[2], mac[3])) - local manuf = nmap.registry.mac.prefixes[prefix] or "Unknown" + local manuf = nmap.registry.mac_prefixes[prefix] or "Unknown" return manuf end diff --git a/scripts/lltd-discovery.nse b/scripts/lltd-discovery.nse index 2c5054c..8436072 100644 --- a/scripts/lltd-discovery.nse +++ b/scripts/lltd-discovery.nse @@ -68,17 +68,16 @@ local function get_mac_addr( mac ) local catch = function() return end local try = nmap.new_try(catch) -- Build the MAC prefix lookup table - if not nmap.registry.lltd_discovery then + if not nmap.registry.mac_prefixes then -- Create the table in the registry so we can share between script instances - nmap.registry.lltd_discovery = {} - nmap.registry.lltd_discovery.mac_prefixes = try(datafiles.parse_mac_prefixes()) + nmap.registry.mac_prefixes = try(datafiles.parse_mac_prefixes()) end if mac:len() ~= 6 then return "Unknown" else local prefix = string.upper(string.format("%02x%02x%02x", mac:byte(1), mac:byte(2), mac:byte(3))) - local manuf = nmap.registry.lltd_discovery.mac_prefixes[prefix] or "Unknown" + local manuf = nmap.registry.mac_prefixes[prefix] or "Unknown" return string.format("%02x:%02x:%02x:%02x:%02x:%02x (%s)", mac:byte(1), mac:byte(2), mac:byte(3), mac:byte(4), mac:byte(5), mac:byte(6), manuf ) end end diff --git a/scripts/nbstat.nse b/scripts/nbstat.nse index 10fc82c..da13979 100644 --- a/scripts/nbstat.nse +++ b/scripts/nbstat.nse @@ -101,17 +101,16 @@ action = function(host) end -- Build the MAC prefix lookup table - if not nmap.registry.nbstat then + if not nmap.registry.mac_prefixes then -- Create the table in the registry so we can share between script instances - nmap.registry.nbstat = {} - nmap.registry.nbstat.mac_prefixes = try(datafiles.parse_mac_prefixes()) + nmap.registry.mac_prefixes = try(datafiles.parse_mac_prefixes()) end -- Format the Mac address in the standard way if(#statistics >= 6) then -- MAC prefixes are matched on the first three bytes, all uppercase prefix = string.upper(string.format("%02x%02x%02x", statistics:byte(1), statistics:byte(2), statistics:byte(3))) - manuf = nmap.registry.nbstat.mac_prefixes[prefix] + manuf = nmap.registry.mac_prefixes[prefix] if manuf == nil then manuf = "unknown" end diff --git a/scripts/snmp-interfaces.nse b/scripts/snmp-interfaces.nse index 3604fb9..b3b3bd1 100644 --- a/scripts/snmp-interfaces.nse +++ b/scripts/snmp-interfaces.nse @@ -185,17 +185,16 @@ function get_mac_addr( mac ) local catch = function() return end local try = nmap.new_try(catch) -- Build the MAC prefix lookup table - if not nmap.registry.snmp_interfaces then + if not nmap.registry.mac_prefixes then -- Create the table in the registry so we can share between script instances - nmap.registry.snmp_interfaces = {} - nmap.registry.snmp_interfaces.mac_prefixes = try(datafiles.parse_mac_prefixes()) + nmap.registry.mac_prefixes = try(datafiles.parse_mac_prefixes()) end if mac:len() ~= 6 then return "Unknown" else local prefix = string.upper(string.format("%02x%02x%02x", mac:byte(1), mac:byte(2), mac:byte(3))) - local manuf = nmap.registry.snmp_interfaces.mac_prefixes[prefix] or "Unknown" + local manuf = nmap.registry.mac_prefixes[prefix] or "Unknown" return string.format("%02x:%02x:%02x:%02x:%02x:%02x (%s)", mac:byte(1), mac:byte(2), mac:byte(3), mac:byte(4), mac:byte(5), mac:byte(6), manuf ) end end