@@ -194,6 +194,21 @@ def self.to_executable(framework, arch, plat, code = '', opts = {})
194194 end
195195 # XXX: Add remaining MIPSLE systems here
196196 end
197+
198+ if arch . index ( ARCH_RISCV32LE )
199+ if plat . index ( Msf ::Module ::Platform ::Linux )
200+ return to_linux_riscv32le_elf ( framework , code )
201+ end
202+ # TODO: Add remaining RISCV32LE systems here
203+ end
204+
205+ if arch . index ( ARCH_RISCV64LE )
206+ if plat . index ( Msf ::Module ::Platform ::Linux )
207+ return to_linux_riscv64le_elf ( framework , code )
208+ end
209+ # TODO: Add remaining RISCV64LE systems here
210+ end
211+
197212 nil
198213 end
199214
@@ -1239,6 +1254,50 @@ def self.to_linux_mipsbe_elf(framework, code, opts = {})
12391254 to_exe_elf ( framework , opts , "template_mipsbe_linux.bin" , code , true )
12401255 end
12411256
1257+ # Create a RISC-V 64-bit LE Linux ELF containing the payload provided in +code+
1258+ #
1259+ # @param framework [Msf::Framework]
1260+ # @param code [String]
1261+ # @param opts [Hash]
1262+ # @option [String] :template
1263+ # @return [String] Returns an elf
1264+ def self . to_linux_riscv64le_elf ( framework , code , opts = { } )
1265+ to_exe_elf ( framework , opts , "template_riscv64le_linux.bin" , code )
1266+ end
1267+
1268+ # Create a RISC-V 64-bit LE Linux ELF_DYN containing the payload provided in +code+
1269+ #
1270+ # @param framework [Msf::Framework]
1271+ # @param code [String]
1272+ # @param opts [Hash]
1273+ # @option [String] :template
1274+ # @return [String] Returns an elf
1275+ def self . to_linux_riscv64le_elf_dll ( framework , code , opts = { } )
1276+ to_exe_elf ( framework , opts , "template_riscv64le_linux_dll.bin" , code )
1277+ end
1278+
1279+ # Create a RISC-V 32-bit LE Linux ELF containing the payload provided in +code+
1280+ #
1281+ # @param framework [Msf::Framework]
1282+ # @param code [String]
1283+ # @param opts [Hash]
1284+ # @option [String] :template
1285+ # @return [String] Returns an elf
1286+ def self . to_linux_riscv32le_elf ( framework , code , opts = { } )
1287+ to_exe_elf ( framework , opts , "template_riscv32le_linux.bin" , code )
1288+ end
1289+
1290+ # Create a RISC-V 32-bit LE Linux ELF_DYN containing the payload provided in +code+
1291+ #
1292+ # @param framework [Msf::Framework]
1293+ # @param code [String]
1294+ # @param opts [Hash]
1295+ # @option [String] :template
1296+ # @return [String] Returns an elf
1297+ def self . to_linux_riscv32le_elf_dll ( framework , code , opts = { } )
1298+ to_exe_elf ( framework , opts , "template_riscv32le_linux_dll.bin" , code )
1299+ end
1300+
12421301 # self.to_exe_vba
12431302 #
12441303 # @param exes [String]
@@ -2125,6 +2184,10 @@ def self.to_executable_fmt(framework, arch, plat, code, fmt, exeopts)
21252184 to_linux_mipsbe_elf ( framework , code , exeopts )
21262185 when ARCH_MIPSLE
21272186 to_linux_mipsle_elf ( framework , code , exeopts )
2187+ when ARCH_RISCV32LE
2188+ to_linux_riscv32le_elf ( framework , code , exeopts )
2189+ when ARCH_RISCV64LE
2190+ to_linux_riscv64le_elf ( framework , code , exeopts )
21282191 end
21292192 elsif plat && plat . index ( Msf ::Module ::Platform ::BSD )
21302193 case arch
@@ -2153,6 +2216,10 @@ def self.to_executable_fmt(framework, arch, plat, code, fmt, exeopts)
21532216 to_linux_armle_elf_dll ( framework , code , exeopts )
21542217 when ARCH_AARCH64
21552218 to_linux_aarch64_elf_dll ( framework , code , exeopts )
2219+ when ARCH_RISCV32LE
2220+ to_linux_riscv32le_elf_dll ( framework , code , exeopts )
2221+ when ARCH_RISCV64LE
2222+ to_linux_riscv64le_elf_dll ( framework , code , exeopts )
21562223 end
21572224 end
21582225 when 'macho' , 'osx-app'
0 commit comments