LIEF exposes a demangling API for the following formats:
Input
lief.demangle("?h@@YAXH@Z")
Result
void __cdecl h(int)
Input
lief.demangle("_RNvCskwGfYPst2Cb_3foo16example_function")
Result
foo::example_function
Input
lief.demangle("_ZTSN3lld13SpecificAllocINS_4coff9TpiSourceEEE")
Result
typeinfo name for lld::SpecificAlloc<lld::coff::TpiSource>
Input
lief.demangle("_$s10Foundation4DataV15_RepresentationON")
Result
type metadata for Foundation.Data._Representation
Warning
doxygenfunction: Cannot find function “LIEF::demangle” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
Demangle the given input.
Warning
This function only works with the extended version of LIEF
To check if the current build is an extended version you can use:
Warning
doxygenfunction: Cannot find function “LIEF::is_extended” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
In C++ you can also check if the LIEF_EXTENDED
is defined:
#include <LIEF/config.hpp>
#if defined(LIEF_EXTENDED)
// Extended version
#else
// Regular version
#endif
To get details about the version of the current extended build:
Warning
doxygenfunction: Cannot find function “LIEF::extended_version_info” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
Return the Android code associated with a ANDROID_VERSIONS
.
For example: Nougat
Return the ANDROID_VERSIONS
as a string..
For example: 7.0.1
Bases: Enum
Warning
doxygenfunction: Cannot find function “LIEF::Android::code_name” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
Warning
doxygenfunction: Cannot find function “LIEF::Android::version_string” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
Warning
doxygenenum: Cannot find enum “LIEF::Android::ANDROID_VERSIONS” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
Disable nanobind warnings about leaked objects. For instance:
nanobind: leaked 45 instances!
nanobind: leaked 25 types!
- leaked type "lief._lief.FORMATS"
- ... skipped remainder
nanobind: leaked 201 functions!
- leaked function ""
- leaked function "export_symbol"
- ... skipped remainder
nanobind: this is likely caused by a reference counting issue in the binding code.
The lief.dump()
utility can be used to pretty dump a buffer.
For instance:
pe = lief.PE.parse("some.exe")
text = pe.get_section(".text")
print(lief.dump(text.content))
Hexdump the provided buffer:
+---------------------------------------------------------------------+
| 88 56 05 00 00 00 00 00 00 00 00 00 22 58 05 00 | .V.........."X.. |
| 10 71 02 00 78 55 05 00 00 00 00 00 00 00 00 00 | .q..xU.......... |
| 68 5c 05 00 00 70 02 00 00 00 00 00 00 00 00 00 | h\...p.......... |
| 00 00 00 00 00 00 00 00 00 00 00 00 | ............ |
+---------------------------------------------------------------------+
Warning
doxygenfunction: Cannot find function “LIEF::dump” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
Warning
doxygenfunction: Cannot find function “LIEF::dump” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml
Warning
doxygenfunction: Cannot find function “LIEF::dump” in doxygen xml output for project “lief” from directory: /builds/LIEF/lief/build/doxygen/xml