pwnlib.elf.config
— Kernel Config Parsing¶
Kernel-specific ELF functionality
-
pwnlib.elf.config.
parse_kconfig
(data)[source]¶ Parses configuration data from a kernel .config.
Parameters: data (str) – Configuration contents. Returns: 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}