pwnlib.constants — Easy access to header file constants

Module containing constants extracted from header files.

The purpose of this module is to provide quick access to constants from different architectures and operating systems.

Example

>>> print constants.freebsd.SYS_stat
188
>>> print constants.linux.i386.SYS_stat
106
>>> print constants.linux.amd64.SYS_stat
4

The submodule freebsd contains all constants for FreeBSD, while the constants for Linux have been split up by architecture.

The variables of the submodules will be “lifted up” by setting the pwnlib.context.arch or pwnlib.context.os in a manner similar to what happens in pwnlib.shellcraft.

Example

>>> with context.local(os = 'freebsd'):
...     print constants.SYS_stat
188
>>> with context.local(os = 'linux', arch = 'i386'):
...     print constants.SYS_stat
106
>>> with context.local(os = 'linux', arch = 'amd64'):
...     print constants.SYS_stat
4