From e452b81fb10062f0c97155bcee6098e2a7a9411e Mon Sep 17 00:00:00 2001 From: Etienne Stalmans Date: Tue, 4 Mar 2014 08:49:52 +0200 Subject: [PATCH] style changes as suggested by @jlee-r7 --- lib/msf/core/post/windows/netapi.rb | 60 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/msf/core/post/windows/netapi.rb b/lib/msf/core/post/windows/netapi.rb index f7b359ce90..edc7eb235a 100644 --- a/lib/msf/core/post/windows/netapi.rb +++ b/lib/msf/core/post/windows/netapi.rb @@ -49,14 +49,14 @@ module NetAPI ) case result['return'] - when 0 - hosts = read_server_structs(result['bufptr'], result['totalentries'], domain, server_type) - when ERROR_NO_BROWSER_SERVERS_FOUND - print_error("ERROR_NO_BROWSER_SERVERS_FOUND") - return nil - when ERROR_MORE_DATA - vprint_error("ERROR_MORE_DATA") - return nil + when 0 + hosts = read_server_structs(result['bufptr'], result['totalentries'], domain, server_type) + when ERROR_NO_BROWSER_SERVERS_FOUND + print_error("ERROR_NO_BROWSER_SERVERS_FOUND") + return nil + when ERROR_MORE_DATA + vprint_error("ERROR_MORE_DATA") + return nil end netapi_buffer_free(result['bufptr']) @@ -70,7 +70,7 @@ module NetAPI hosts = [] mem = client.railgun.memread(start_ptr, struct_size*count) - 0.upto(count-1) do |i| + count.times do x = {} x[:version]= mem[(base + 0),4].unpack("V*")[0] nameptr = mem[(base + 4),4].unpack("V*")[0] @@ -98,25 +98,25 @@ module NetAPI ) case result['return'] - when 0 - vprint_error("#{hostname} Session identified") - sessions = read_session_structs(result['bufptr'], result['totalentries'], hostname) - when ERROR_ACCESS_DENIED - vprint_error("#{hostname} Access denied...") - return nil - when 53 - vprint_error("Host not found or did not respond: #{hostname}") - return nil - when 123 - vprint_error("Invalid host: #{hostname}") - return nil - when NERR_UserNotFound - return nil - when ERROR_MORE_DATA - vprint_error("#{hostname} ERROR_MORE_DATA") - else - vprint_error("Unaccounted for error code: #{result['return']}") - return nil + when 0 + vprint_error("#{hostname} Session identified") + sessions = read_session_structs(result['bufptr'], result['totalentries'], hostname) + when ERROR_ACCESS_DENIED + vprint_error("#{hostname} Access denied...") + return nil + when 53 + vprint_error("Host not found or did not respond: #{hostname}") + return nil + when 123 + vprint_error("Invalid host: #{hostname}") + return nil + when NERR_UserNotFound + return nil + when ERROR_MORE_DATA + vprint_error("#{hostname} ERROR_MORE_DATA") + else + vprint_error("Unaccounted for error code: #{result['return']}") + return nil end netapi_buffer_free(result['bufptr']) @@ -129,8 +129,8 @@ module NetAPI struct_size = 16 sessions = [] mem = client.railgun.memread(start_ptr, struct_size*count) - - 0.upto(count-1) do |i| + + count.times do sess = {} cnameptr = mem[(base + 0),4].unpack("V*")[0] usernameptr = mem[(base + 4),4].unpack("V*")[0]