Skip to content

Commit 3a481c8

Browse files
committed
Merge branch 'feature/winrm_compat_mode' of git://github.com/dmaloney-r7/metasploit-framework into dmaloney-r7-feature/winrm_compat_mode
2 parents b465d20 + 5856874 commit 3a481c8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

modules/exploits/windows/winrm/winrm_script_exec.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def initialize(info = {})
5656

5757
register_options(
5858
[
59-
OptBool.new('FORCE_VBS', [ true, 'Force the module to use the VBS CmdStager', false])
59+
OptBool.new('FORCE_VBS', [ true, 'Force the module to use the VBS CmdStager', false]),
60+
OptString.new('USERNAME', [ true, 'A specific username to authenticate as' ]),
61+
OptString.new('PASSWORD', [ true, 'A specific password to authenticate with' ]),
6062
], self.class
6163
)
6264

@@ -82,6 +84,10 @@ def exploit
8284
unless check == Msf::Exploit::CheckCode::Vulnerable
8385
return
8486
end
87+
unless valid_login?
88+
print_error "Login Failure. Recheck your credentials"
89+
return
90+
end
8591
if powershell2?
8692
path = upload_script
8793
return if path.nil?
@@ -243,4 +249,13 @@ def powershell2?
243249
return false
244250
end
245251

252+
def valid_login?
253+
data = winrm_wql_msg("Select Name,Status from Win32_Service")
254+
resp,c = send_request_ntlm(data)
255+
unless resp.code == 200
256+
return false
257+
end
258+
return true
259+
end
260+
246261
end

0 commit comments

Comments
 (0)