Skip to content

Commit 6b2421e

Browse files
author
RageLtMan
committed
Use OJ's suggestion for fail_with
1 parent 4a79e75 commit 6b2421e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/exploits/windows/local/ps_wmi_exec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ def build_script
120120
def exploit
121121

122122
# Make sure we meet the requirements before running the script
123-
# Shell sessions can't kill PIDs
124-
if !have_powershell?
125-
print_error("Incompatible environment - PowerShell is required")
126-
return
123+
unless have_powershell?
124+
fail_with(Failure::BadConfig, 'PowerShell not found')
127125
end
126+
127+
128128
# SYSTEM doesnt have credentials on remote hosts
129129
if is_system? and datastore['RHOSTS']
130-
print_error("Cannot run as system")
130+
print_error("Cannot run as local system on remote hosts")
131131
return 0
132132
end
133133

@@ -137,7 +137,7 @@ def exploit
137137
print_good script
138138
return
139139
end
140-
#
140+
141141
print_good("#{datastore["RHOSTS"] ? psh_exec(script) : psh_exec(script,true,false)}")
142142
vprint_good('PSH WMI exec is complete.')
143143
end

0 commit comments

Comments
 (0)