@@ -57,19 +57,17 @@ def initialize(info={})
57
57
end
58
58
59
59
def check
60
- os = sysinfo [ "OS" ]
61
-
62
- if os !~ /windows/i
60
+ if sysinfo [ 'OS' ] !~ /windows/i
63
61
return Exploit ::CheckCode ::Unknown
64
62
end
65
63
66
- if sysinfo [ " Architecture" ] =~ /(wow|x)64/i
64
+ if sysinfo [ ' Architecture' ] =~ /(wow|x)64/i
67
65
arch = ARCH_X86_64
68
- elsif sysinfo [ " Architecture" ] =~ /x86/i
66
+ elsif sysinfo [ ' Architecture' ] =~ /x86/i
69
67
arch = ARCH_X86
70
68
end
71
69
72
- file_path = expand_path ( " %windir%" ) << " \\ system32\\ win32k.sys"
70
+ file_path = expand_path ( ' %windir%' ) << ' \\system32\\win32k.sys'
73
71
major , minor , build , revision , branch = file_version ( file_path )
74
72
vprint_status ( "win32k.sys file version: #{ major } .#{ minor } .#{ build } .#{ revision } branch: #{ branch } " )
75
73
@@ -83,15 +81,15 @@ def exploit
83
81
fail_with ( Failure ::None , 'Session is already elevated' )
84
82
end
85
83
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.' )
88
86
end
89
87
90
- if sysinfo [ " Architecture" ] =~ /wow64/i
88
+ if sysinfo [ ' Architecture' ] =~ /wow64/i
91
89
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
93
91
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
95
93
fail_with ( Failure ::NoTarget , 'Session host is x86, but the target is specified as x64' )
96
94
end
97
95
0 commit comments