Skip to content

Commit 87fbba3

Browse files
committed
Land rapid7#19405, Minor improvements to lib/msf/core/post/linux/kernel.rb
Merge branch 'land-19405' into upstream-master
2 parents dd3b931 + f5145de commit 87fbba3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/msf/core/post/linux/kernel.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ def kernel_arch
6565
return ARCH_AARCH64 if arch == 'aarch64' || arch == 'arm64'
6666
return ARCH_ARMLE if arch.start_with?'arm'
6767
return ARCH_X86 if arch.end_with?'86'
68+
return ARCH_PPC if arch == 'ppc'
69+
return ARCH_PPC64 if arch == 'ppc64'
70+
return ARCH_PPC64LE if arch == 'ppc64le'
71+
return ARCH_MIPS if arch == 'mips'
72+
return ARCH_MIPS64 if arch == 'mips64'
73+
return ARCH_SPARC if arch == 'sparc'
6874
arch
6975
end
7076

@@ -74,8 +80,8 @@ def kernel_arch
7480
# @return [Array]
7581
#
7682
def kernel_config
77-
return unless cmd_exec('test -r /boot/config-`uname -r` && echo true').include? 'true'
78-
output = cmd_exec("cat /boot/config-`uname -r`").to_s.strip
83+
release = kernel_release
84+
output = read_file("/boot/config-#{release}").to_s.strip
7985
return if output.empty?
8086
config = output.split("\n").map(&:strip).reject(&:empty?).reject {|i| i.start_with? '#'}
8187
config
@@ -250,7 +256,7 @@ def lkrg_installed?
250256
# Returns true if grsecurity is installed
251257
#
252258
def grsec_installed?
253-
cmd_exec('test -c /dev/grsec && echo true').to_s.strip.include? 'true'
259+
File.exists?('/dev/grsec') && File.chardev?('/dev/grsec')
254260
rescue
255261
raise 'Could not determine grsecurity status'
256262
end

0 commit comments

Comments
 (0)