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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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