Skip to content

Commit 28872c7

Browse files
committed
added suport to generate_payload_dll for x64 arch, linux platform
1 parent ccf967f commit 28872c7

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/msf/core/exploit/exe.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,24 @@ def generate_payload_dll(opts = {})
104104
return get_eicar_exe if datastore['EXE::EICAR']
105105

106106
exe_init_options(opts)
107-
108-
# NOTE: Only Windows is supported here.
107+
plat = opts[:platform]
109108
pl = opts[:code]
110109
pl ||= payload.encoded
111110

112111
#Ensure opts[:arch] is an array
113112
opts[:arch] = [opts[:arch]] unless opts[:arch].kind_of? Array
114113

115-
if opts[:arch] and (opts[:arch].index(ARCH_X64) or opts[:arch].index(ARCH_X86_64))
116-
dll = Msf::Util::EXE.to_win64pe_dll(framework, pl, opts)
117-
else
118-
dll = Msf::Util::EXE.to_win32pe_dll(framework, pl, opts)
114+
# NOTE: Only x86_64 linux is supported here.
115+
if (plat.index(Msf::Module::Platform::Linux))
116+
if opts[:arch] and (opts[:arch].index(ARCH_X64) or opts[:arch].index(ARCH_X86_64))
117+
dll = Msf::Util::EXE.to_linux_x64_elf_dll(framework, pl,opts)
118+
end
119+
elsif (plat.index(Msf::Module::Platform::Windows))
120+
if opts[:arch] and (opts[:arch].index(ARCH_X64) or opts[:arch].index(ARCH_X86_64))
121+
dll = Msf::Util::EXE.to_win64pe_dll(framework, pl, opts)
122+
else
123+
dll = Msf::Util::EXE.to_win32pe_dll(framework, pl, opts)
124+
end
119125
end
120126

121127
exe_post_generation(opts)

0 commit comments

Comments
 (0)