Module: Msf::Util::EXE::Linux::ClassMethods

Included in:
Msf::Util::EXE::Linux
Defined in:
lib/msf/util/exe/linux.rb

Instance Method Summary collapse

Instance Method Details

#to_executable_linux(framework, arch, code, fmt = 'elf', opts = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/msf/util/exe/linux.rb', line 25

def to_executable_linux(framework, arch, code, fmt = 'elf', opts = {})
  
  elf_formats = ['elf','elf-so']
  elf_fmt = 'elf'
  elf_fmt = fmt if elf_formats.include?(fmt)

  elf = to_executable_linux_x86(framework, code, elf_fmt, opts) if arch.index(ARCH_X86)
  elf = to_executable_linux_x64(framework, code, elf_fmt,opts) if arch.index(ARCH_X64)
  elf = to_executable_linux_armle(framework, code, elf_fmt,opts) if arch.index(ARCH_ARMLE)
  elf = to_executable_linux_armbe(framework, code, elf_fmt,opts) if arch.index(ARCH_ARMBE)
  elf = to_executable_linux_aarch64(framework, code, elf_fmt,opts) if arch.index(ARCH_AARCH64)
  elf = to_executable_linux_mipsbe(framework, code, elf_fmt,opts) if arch.index(ARCH_MIPSBE)
  elf = to_executable_linux_mipsle(framework, code, elf_fmt,opts) if arch.index(ARCH_MIPSLE)
  elf = to_executable_linux_mips64(framework, code, elf_fmt,opts) if arch.index(ARCH_MIPS64)
  elf = to_executable_linux_ppc(framework, code, elf_fmt,opts) if arch.index(ARCH_PPC)
  elf = to_executable_linux_ppc64(framework, code, elf_fmt,opts) if arch.index(ARCH_PPC64LE)
  elf = to_executable_linux_ppce500v2(framework, code, elf_fmt,opts) if arch.index(ARCH_PPCE500V2)
  elf = to_executable_linux_riscv32le(framework, code,elf_fmt, opts) if arch.index(ARCH_RISCV32LE)
  elf = to_executable_linux_riscv64le(framework, code, elf_fmt,opts) if arch.index(ARCH_RISCV64LE)
  elf = to_executable_linux_zarch(framework, code, elf_fmt,opts) if arch.index(ARCH_ZARCH)
  elf = to_executable_linux_loongarch64(framework, code, elf_fmt,opts) if arch.index(ARCH_LOONGARCH64)

  return elf if elf_formats.include?(fmt) # Returning only the elf
end

#to_executable_linux_aarch64(framework, code, fmt = 'elf', opts = {}) ⇒ Object



69
70
71
72
# File 'lib/msf/util/exe/linux.rb', line 69

def to_executable_linux_aarch64(framework, code, fmt = 'elf', opts = {})
  return to_linux_aarch64_elf(framework, code, opts) if fmt == 'elf'
  return to_linux_aarch64_elf_dll(framework, code, opts) if fmt == 'elf-so'
end

#to_executable_linux_armbe(framework, code, fmt = 'elf', opts = {}) ⇒ Object



65
66
67
# File 'lib/msf/util/exe/linux.rb', line 65

def to_executable_linux_armbe(framework, code, fmt = 'elf', opts = {})
  return to_linux_armbe_elf(framework, code, opts) if fmt == 'elf'
end

#to_executable_linux_armle(framework, code, fmt = 'elf', opts = {}) ⇒ Object



60
61
62
63
# File 'lib/msf/util/exe/linux.rb', line 60

def to_executable_linux_armle(framework, code, fmt = 'elf', opts = {})
  return to_linux_armle_elf(framework, code, opts) if fmt == 'elf'
  return to_linux_armle_elf_dll(framework, code, opts) if fmt == 'elf-so'
end

#to_executable_linux_loongarch64(framework, code, fmt = 'elf', opts = {}) ⇒ Object



112
113
114
115
# File 'lib/msf/util/exe/linux.rb', line 112

def to_executable_linux_loongarch64(framework, code, fmt = 'elf', opts = {})
  return to_linux_loongarch64_elf(framework, code, opts) if fmt == 'elf'
  return to_linux_loongarch64_elf_dll(framework, code, opts) if fmt == 'elf-so'
end

#to_executable_linux_mips64(framework, code, fmt = 'elf', opts = {}) ⇒ Object



82
83
84
# File 'lib/msf/util/exe/linux.rb', line 82

def to_executable_linux_mips64(framework, code, fmt = 'elf', opts = {})
  return to_linux_mips64_elf(framework, code, opts) if fmt == 'elf'
end

#to_executable_linux_mipsbe(framework, code, fmt = 'elf', opts = {}) ⇒ Object



74
75
76
# File 'lib/msf/util/exe/linux.rb', line 74

def to_executable_linux_mipsbe(framework, code, fmt = 'elf', opts = {})
  return to_linux_mipsbe_elf(framework, code, opts) if fmt == 'elf'
end

#to_executable_linux_mipsle(framework, code, fmt = 'elf', opts = {}) ⇒ Object



78
79
80
# File 'lib/msf/util/exe/linux.rb', line 78

def to_executable_linux_mipsle(framework, code, fmt = 'elf', opts = {})
  return to_linux_mipsle_elf(framework, code, opts) if fmt == 'elf'
end

#to_executable_linux_ppc(framework, code, fmt = 'elf', opts = {}) ⇒ Object



86
87
88
# File 'lib/msf/util/exe/linux.rb', line 86

def to_executable_linux_ppc(framework, code, fmt = 'elf', opts = {})
  return to_linux_ppc_elf(framework, code, opts) if fmt == 'elf'
end

#to_executable_linux_ppc64(framework, code, fmt = 'elf', opts = {}) ⇒ Object



90
91
92
# File 'lib/msf/util/exe/linux.rb', line 90

def to_executable_linux_ppc64(framework, code, fmt = 'elf', opts = {})
  return to_linux_ppc64_elf(framework, code, opts) if fmt == 'elf'
end

#to_executable_linux_ppce500v2(framework, code, fmt = 'elf', opts = {}) ⇒ Object



94
95
96
# File 'lib/msf/util/exe/linux.rb', line 94

def to_executable_linux_ppce500v2(framework, code, fmt = 'elf', opts = {})
  return to_linux_ppce500v2_elf(framework, code, opts) if fmt == 'elf'
end

#to_executable_linux_riscv32le(framework, code, fmt = 'elf', opts = {}) ⇒ Object



98
99
100
101
# File 'lib/msf/util/exe/linux.rb', line 98

def to_executable_linux_riscv32le(framework, code, fmt = 'elf', opts = {})
  return to_linux_riscv32le_elf(framework, code, opts) if fmt == 'elf'
  return to_linux_riscv32le_elf_dll(framework, code, opts) if fmt == 'elf-so'
end

#to_executable_linux_riscv64le(framework, code, fmt = 'elf', opts = {}) ⇒ Object



103
104
105
106
# File 'lib/msf/util/exe/linux.rb', line 103

def to_executable_linux_riscv64le(framework, code, fmt = 'elf', opts = {})
  return to_linux_riscv64le_elf(framework, code, opts) if fmt == 'elf'
  return to_linux_riscv64le_elf_dll(framework, code, opts) if fmt == 'elf-so'
end

#to_executable_linux_x64(framework, code, fmt = 'elf', opts = {}) ⇒ Object



50
51
52
53
# File 'lib/msf/util/exe/linux.rb', line 50

def to_executable_linux_x64(framework, code, fmt = 'elf', opts = {})
  return to_linux_x64_elf(framework, code, opts) if fmt == 'elf'
  return to_linux_x64_elf_dll(framework, code, opts) if fmt == 'elf-so'
end

#to_executable_linux_x86(framework, code, fmt = 'exe', opts = {}) ⇒ Object



55
56
57
58
# File 'lib/msf/util/exe/linux.rb', line 55

def to_executable_linux_x86(framework, code, fmt = 'exe', opts = {})
  return to_linux_x86_elf(framework, code, opts) if fmt == 'elf'
  return to_linux_x86_elf_dll(framework, code, opts) if fmt == 'elf-so'
end

#to_executable_linux_zarch(framework, code, fmt = 'elf', opts = {}) ⇒ Object



108
109
110
# File 'lib/msf/util/exe/linux.rb', line 108

def to_executable_linux_zarch(framework, code, fmt = 'elf', opts = {})
  return to_linux_zarch_elf(framework, code, opts) if fmt == 'elf'
end