pwnlib.elf.config
— 内核配置解析¶
Kernel-specific ELF functionality
-
pwnlib.elf.config.
parse_kconfig
(data)[源代码]¶ Parses configuration data from a kernel .config.
参数: data (str) – Configuration contents. 返回: A dict
mapping configuration options. “Not set” is converted intoNone
,y
andn
are converted intobool
. Numbers are converted intoint
. All other values are as-is. Each key hasCONFIG_
stripped from the beginning.Examples
>>> parse_kconfig('FOO=3') {'FOO': 3} >>> parse_kconfig('FOO=y') {'FOO': True} >>> parse_kconfig('FOO=n') {'FOO': False} >>> parse_kconfig('FOO=bar') {'FOO': 'bar'} >>> parse_kconfig('# FOO is not set') {'FOO': None}