Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions lib/msf/core/post/linux/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Linux
module Kernel
include ::Msf::Post::Common
include Msf::Post::File
include Msf::Post::Architecture

#
# Returns uname output
Expand Down Expand Up @@ -56,30 +57,7 @@ def kernel_hardware
uname('-m')
end

#
# Returns the kernel hardware architecture
# Based on values from https://en.wikipedia.org/wiki/Uname
#
# @return [String]
#
def kernel_arch
arch = kernel_hardware
return ARCH_X64 if arch == 'x86_64' || arch == 'amd64'
return ARCH_AARCH64 if arch == 'aarch64' || arch == 'arm64'
return ARCH_ARMLE if arch.start_with? 'arm'
return ARCH_X86 if arch.end_with? '86'
return ARCH_PPC if arch == 'ppc'
return ARCH_PPC64 if arch == 'ppc64'
return ARCH_PPC64LE if arch == 'ppc64le'
return ARCH_MIPS if arch == 'mips'
return ARCH_MIPS64 if arch == 'mips64'
return ARCH_SPARC if arch == 'sparc'
return ARCH_RISCV32LE if arch == 'riscv32'
return ARCH_RISCV64LE if arch == 'riscv64'
return ARCH_LOONGARCH64 if arch == 'loongarch64'

arch
end
alias :kernel_arch :get_os_architecture

Comment thread
smcintyre-r7 marked this conversation as resolved.
#
# Returns the kernel boot config with comments removed
Expand Down
Loading