From 870669bdf7b2b4523a8d69e787cb6df5e1a85999 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Mon, 15 Aug 2016 23:51:05 -0500 Subject: [PATCH] handle exception in getsystem module --- modules/post/windows/escalate/getsystem.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/post/windows/escalate/getsystem.rb b/modules/post/windows/escalate/getsystem.rb index e7bebe5ad6..d05983e780 100644 --- a/modules/post/windows/escalate/getsystem.rb +++ b/modules/post/windows/escalate/getsystem.rb @@ -39,7 +39,7 @@ class MetasploitModule < Msf::Post def run - tech = datastore['TECHNIQUE'].to_i + technique = datastore['TECHNIQUE'].to_i unsupported if client.platform !~ /win32|win64/i @@ -48,11 +48,11 @@ class MetasploitModule < Msf::Post return end - result = client.priv.getsystem( tech ) - if result and result[0] - print_good( "Obtained SYSTEM via technique #{result[1]}" ) - else - print_error( "Failed to obtain SYSTEM access" ) + begin + result = client.priv.getsystem(technique) + print_good("Obtained SYSTEM via technique #{result[1]}") + rescue Rex::Post::Meterpreter::RequestError => e + print_error("Failed to obtain SYSTEM access") end end