Skip to content

Commit 870669b

Browse files
committed
handle exception in getsystem module
1 parent e70402a commit 870669b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/post/windows/escalate/getsystem.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def unsupported
3939

4040
def run
4141

42-
tech = datastore['TECHNIQUE'].to_i
42+
technique = datastore['TECHNIQUE'].to_i
4343

4444
unsupported if client.platform !~ /win32|win64/i
4545

@@ -48,11 +48,11 @@ def run
4848
return
4949
end
5050

51-
result = client.priv.getsystem( tech )
52-
if result and result[0]
53-
print_good( "Obtained SYSTEM via technique #{result[1]}" )
54-
else
55-
print_error( "Failed to obtain SYSTEM access" )
51+
begin
52+
result = client.priv.getsystem(technique)
53+
print_good("Obtained SYSTEM via technique #{result[1]}")
54+
rescue Rex::Post::Meterpreter::RequestError => e
55+
print_error("Failed to obtain SYSTEM access")
5656
end
5757
end
5858

0 commit comments

Comments
 (0)