Skip to content

Commit efece12

Browse files
committed
Minor clean ups for ruby strings and check method
1 parent a6467f4 commit efece12

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

modules/exploits/windows/local/ms15_051_client_copy_image.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,17 @@ def initialize(info={})
5757
end
5858

5959
def check
60-
os = sysinfo["OS"]
61-
62-
if os !~ /windows/i
60+
if sysinfo['OS'] !~ /windows/i
6361
return Exploit::CheckCode::Unknown
6462
end
6563

66-
if sysinfo["Architecture"] =~ /(wow|x)64/i
64+
if sysinfo['Architecture'] =~ /(wow|x)64/i
6765
arch = ARCH_X86_64
68-
elsif sysinfo["Architecture"] =~ /x86/i
66+
elsif sysinfo['Architecture'] =~ /x86/i
6967
arch = ARCH_X86
7068
end
7169

72-
file_path = expand_path("%windir%") << "\\system32\\win32k.sys"
70+
file_path = expand_path('%windir%') << '\\system32\\win32k.sys'
7371
major, minor, build, revision, branch = file_version(file_path)
7472
vprint_status("win32k.sys file version: #{major}.#{minor}.#{build}.#{revision} branch: #{branch}")
7573

@@ -83,15 +81,15 @@ def exploit
8381
fail_with(Failure::None, 'Session is already elevated')
8482
end
8583

86-
if check == Exploit::CheckCode::Safe
87-
fail_with(Failure::NotVulnerable, "Exploit not available on this system.")
84+
if check == Exploit::CheckCode::Safe || check == Exploit::CheckCode::Unknown
85+
fail_with(Failure::NotVulnerable, 'Exploit not available on this system.')
8886
end
8987

90-
if sysinfo["Architecture"] =~ /wow64/i
88+
if sysinfo['Architecture'] =~ /wow64/i
9189
fail_with(Failure::NoTarget, 'Running against WOW64 is not supported')
92-
elsif sysinfo["Architecture"] =~ /x64/ && target.arch.first == ARCH_X86
90+
elsif sysinfo['Architecture'] =~ /x64/ && target.arch.first == ARCH_X86
9391
fail_with(Failure::NoTarget, 'Session host is x64, but the target is specified as x86')
94-
elsif sysinfo["Architecture"] =~ /x86/ && target.arch.first == ARCH_X86_64
92+
elsif sysinfo['Architecture'] =~ /x86/ && target.arch.first == ARCH_X86_64
9593
fail_with(Failure::NoTarget, 'Session host is x86, but the target is specified as x64')
9694
end
9795

0 commit comments

Comments
 (0)