1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-18 12:19:02 +00:00

Fixed a bug that would make the smb-system-info script fail, due to a trailing

zero terminator in the processor count, resulting in a failure to convert the
string to a number.
This commit is contained in:
patrik
2012-06-15 21:43:41 +00:00
parent c80a28f5f2
commit be0ebe8859

View File

@@ -129,7 +129,10 @@ local function get_info_registry(host)
result['status-processor_level'], result['processor_level'] = reg_get_value(smbstate, openhklm_result['handle'], "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "PROCESSOR_LEVEL")
result['status-processor_revision'], result['processor_revision'] = reg_get_value(smbstate, openhklm_result['handle'], "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "PROCESSOR_REVISION")
for i = 0, result['number_of_processors'] - 1, 1 do
-- remove trailing zero terminator
local num_procs = result['number_of_processors']:match("^[^%z]*")
for i = 0, tonumber(num_procs) - 1, 1 do
result['status-~mhz'..i], result['~mhz' .. i] = reg_get_value(smbstate, openhklm_result['handle'], "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\" .. i, "~MHz")
result['status-identifier'..i], result['identifier' .. i] = reg_get_value(smbstate, openhklm_result['handle'], "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\" .. i, "Identifier")
result['status-processornamestring'..i], result['processornamestring' .. i] = reg_get_value(smbstate, openhklm_result['handle'], "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\" .. i, "ProcessorNameString")
@@ -201,7 +204,9 @@ action = function(host)
local hardware = {}
hardware['name'] = "Hardware"
for i = 0, result['number_of_processors'] - 1, 1 do
-- remove trailing zero terminator
local num_procs = result['number_of_processors']:match("^[^%z]*")
for i = 0, tonumber(num_procs) - 1, 1 do
if(result['status-processornamestring'..i] == false) then
result['status-processornamestring'..i] = "Unknown"
end