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 into None, y and n are converted into bool. Numbers are converted into int. All other values are as-is. Each key has CONFIG_ 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}