Land #11064, Add Msf::Post::Linux::Kernel.kernel_config method
commit
f4282bfb56
|
@ -54,6 +54,27 @@ module Kernel
|
|||
uname('-m')
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the kernel boot config
|
||||
#
|
||||
# @return [Array]
|
||||
#
|
||||
def kernel_config
|
||||
return unless cmd_exec('test -r /boot/config-`uname -r` && echo true').include? 'true'
|
||||
|
||||
output = cmd_exec("cat /boot/config-`uname -r`").to_s.strip
|
||||
|
||||
return if output.empty?
|
||||
|
||||
config = output.split("\n").map(&:strip).reject(&:empty?).reject {|i| i.start_with? '#'}
|
||||
|
||||
return if config.empty?
|
||||
|
||||
config
|
||||
rescue
|
||||
raise 'Could not retrieve kernel config'
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the kernel modules
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue