From c3ac9337cc7451904748afc57e4f9cea6779dc50 Mon Sep 17 00:00:00 2001 From: ron Date: Tue, 4 Nov 2008 17:05:18 +0000 Subject: [PATCH] Fixed a bug in the smb session enumeration where users wouldn't get added to the list if we couldn't look up the users' timestamps (which happens with guest accounts for sure) --- scripts/smb-enumsessions.nse | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/smb-enumsessions.nse b/scripts/smb-enumsessions.nse index 1bd40c05e..4b7eacf63 100644 --- a/scripts/smb-enumsessions.nse +++ b/scripts/smb-enumsessions.nse @@ -144,6 +144,7 @@ local function winreg_enum_rids(host) element['sid'] = msrpc.string_to_sid(enumkey_result['name']) -- To get the time the user logged in, we check the 'Volatile Environment' key + -- This can fail with the 'guest' account due to access restrictions status, openkey_result = msrpc.winreg_openkey(smbstate, openhku_result['handle'], element['name'] .. "\\Volatile Environment") if(status ~= false) then local queryinfokey_result, closekey_result @@ -162,8 +163,11 @@ local function winreg_enum_rids(host) end element['changed_date'] = queryinfokey_result['last_changed_date'] - elements[#elements + 1] = element + else + -- Getting extra details failed, but we can still handle this + element['changed_date'] = "" end + elements[#elements + 1] = element end i = i + 1