Land #11064, Add Msf::Post::Linux::Kernel.kernel_config method

master
Brent Cook 2018-12-06 20:52:12 -06:00
commit f4282bfb56
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
1 changed files with 21 additions and 0 deletions

View File

@ -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
#