Path: blob/master/lib/msf/util/exe/linux.rb
36037 views
module Msf::Util::EXE::Linux12include Msf::Util::EXE::Linux::Common3include Msf::Util::EXE::Linux::Aarch644include Msf::Util::EXE::Linux::Armle5include Msf::Util::EXE::Linux::Armbe6include Msf::Util::EXE::Linux::Loongarch647include Msf::Util::EXE::Linux::Mips648include Msf::Util::EXE::Linux::Mipsbe9include Msf::Util::EXE::Linux::Mipsle10include Msf::Util::EXE::Linux::Ppc11include Msf::Util::EXE::Linux::Ppc6412include Msf::Util::EXE::Linux::Ppce500v213include Msf::Util::EXE::Linux::Riscv32le14include Msf::Util::EXE::Linux::Riscv32le15include Msf::Util::EXE::Linux::X6416include Msf::Util::EXE::Linux::X8617include Msf::Util::EXE::Linux::Zarch1819def self.included(base)20base.extend(ClassMethods)21end2223module ClassMethods24def to_executable_linux(framework, arch, code, fmt = 'elf', opts = {})2526elf_formats = ['elf','elf-so']27elf_fmt = 'elf'28elf_fmt = fmt if elf_formats.include?(fmt)2930elf = to_executable_linux_x86(framework, code, elf_fmt, opts) if arch.index(ARCH_X86)31elf = to_executable_linux_x64(framework, code, elf_fmt,opts) if arch.index(ARCH_X64)32elf = to_executable_linux_armle(framework, code, elf_fmt,opts) if arch.index(ARCH_ARMLE)33elf = to_executable_linux_armbe(framework, code, elf_fmt,opts) if arch.index(ARCH_ARMBE)34elf = to_executable_linux_aarch64(framework, code, elf_fmt,opts) if arch.index(ARCH_AARCH64)35elf = to_executable_linux_mipsbe(framework, code, elf_fmt,opts) if arch.index(ARCH_MIPSBE)36elf = to_executable_linux_mipsle(framework, code, elf_fmt,opts) if arch.index(ARCH_MIPSLE)37elf = to_executable_linux_mips64(framework, code, elf_fmt,opts) if arch.index(ARCH_MIPS64)38elf = to_executable_linux_ppc(framework, code, elf_fmt,opts) if arch.index(ARCH_PPC)39elf = to_executable_linux_ppc64(framework, code, elf_fmt,opts) if arch.index(ARCH_PPC64LE)40elf = to_executable_linux_ppce500v2(framework, code, elf_fmt,opts) if arch.index(ARCH_PPCE500V2)41elf = to_executable_linux_riscv32le(framework, code,elf_fmt, opts) if arch.index(ARCH_RISCV32LE)42elf = to_executable_linux_riscv64le(framework, code, elf_fmt,opts) if arch.index(ARCH_RISCV64LE)43elf = to_executable_linux_zarch(framework, code, elf_fmt,opts) if arch.index(ARCH_ZARCH)44elf = to_executable_linux_loongarch64(framework, code, elf_fmt,opts) if arch.index(ARCH_LOONGARCH64)4546return elf if elf_formats.include?(fmt) # Returning only the elf47end4849def to_executable_linux_x64(framework, code, fmt = 'elf', opts = {})50return to_linux_x64_elf(framework, code, opts) if fmt == 'elf'51return to_linux_x64_elf_dll(framework, code, opts) if fmt == 'elf-so'52end5354def to_executable_linux_x86(framework, code, fmt = 'exe', opts = {})55return to_linux_x86_elf(framework, code, opts) if fmt == 'elf'56return to_linux_x86_elf_dll(framework, code, opts) if fmt == 'elf-so'57end5859def to_executable_linux_armle(framework, code, fmt = 'elf', opts = {})60return to_linux_armle_elf(framework, code, opts) if fmt == 'elf'61return to_linux_armle_elf_dll(framework, code, opts) if fmt == 'elf-so'62end6364def to_executable_linux_armbe(framework, code, fmt = 'elf', opts = {})65return to_linux_armbe_elf(framework, code, opts) if fmt == 'elf'66end6768def to_executable_linux_aarch64(framework, code, fmt = 'elf', opts = {})69return to_linux_aarch64_elf(framework, code, opts) if fmt == 'elf'70return to_linux_aarch64_elf_dll(framework, code, opts) if fmt == 'elf-so'71end7273def to_executable_linux_mipsbe(framework, code, fmt = 'elf', opts = {})74return to_linux_mipsbe_elf(framework, code, opts) if fmt == 'elf'75end7677def to_executable_linux_mipsle(framework, code, fmt = 'elf', opts = {})78return to_linux_mipsle_elf(framework, code, opts) if fmt == 'elf'79end8081def to_executable_linux_mips64(framework, code, fmt = 'elf', opts = {})82return to_linux_mips64_elf(framework, code, opts) if fmt == 'elf'83end8485def to_executable_linux_ppc(framework, code, fmt = 'elf', opts = {})86return to_linux_ppc_elf(framework, code, opts) if fmt == 'elf'87end8889def to_executable_linux_ppc64(framework, code, fmt = 'elf', opts = {})90return to_linux_ppc64_elf(framework, code, opts) if fmt == 'elf'91end9293def to_executable_linux_ppce500v2(framework, code, fmt = 'elf', opts = {})94return to_linux_ppce500v2_elf(framework, code, opts) if fmt == 'elf'95end9697def to_executable_linux_riscv32le(framework, code, fmt = 'elf', opts = {})98return to_linux_riscv32le_elf(framework, code, opts) if fmt == 'elf'99return to_linux_riscv32le_elf_dll(framework, code, opts) if fmt == 'elf-so'100end101102def to_executable_linux_riscv64le(framework, code, fmt = 'elf', opts = {})103return to_linux_riscv64le_elf(framework, code, opts) if fmt == 'elf'104return to_linux_riscv64le_elf_dll(framework, code, opts) if fmt == 'elf-so'105end106107def to_executable_linux_zarch(framework, code, fmt = 'elf', opts = {})108return to_linux_zarch_elf(framework, code, opts) if fmt == 'elf'109end110111def to_executable_linux_loongarch64(framework, code, fmt = 'elf', opts = {})112return to_linux_loongarch64_elf(framework, code, opts) if fmt == 'elf'113return to_linux_loongarch64_elf_dll(framework, code, opts) if fmt == 'elf-so'114end115end116117class << self118include ClassMethods119end120end121122123