Python

Formats specific

Demangling

lief.demangle(mangled: str) str | None

Demangle the given input.

Warning

This function only works with the extended version of LIEF

Logging

lief.logging.set_level(level: lief.logging.LEVEL) None

Change logging level

lief.logging.enable() None

Enable the logger globally

lief.logging.disable() None

Disable the logger globally

lief.logging.set_path(path: str) None

Change the logger as a file-base logging and set its path

Logging levels

class lief.logging.LEVEL

Bases: object

CRITICAL = lief._lief.logging.LEVEL.CRITICAL
DEBUG = lief._lief.logging.LEVEL.DEBUG
ERROR = lief._lief.logging.LEVEL.ERROR
INFO = lief._lief.logging.LEVEL.INFO
OFF = lief._lief.logging.LEVEL.OFF
TRACE = lief._lief.logging.LEVEL.TRACE
WARN = lief._lief.logging.LEVEL.WARN

Error Handling

class lief.lief_errors

Bases: object

asn1_bad_tag = lief._lief.lief_errors.asn1_bad_tag
build_error = lief._lief.lief_errors.build_error
conversion_error = lief._lief.lief_errors.conversion_error
corrupted = lief._lief.lief_errors.corrupted
data_too_large = lief._lief.lief_errors.data_too_large
file_error = lief._lief.lief_errors.file_error
file_format_error = lief._lief.lief_errors.file_format_error
not_found = lief._lief.lief_errors.not_found
not_implemented = lief._lief.lief_errors.not_implemented
not_supported = lief._lief.lief_errors.not_supported
parsing_error = lief._lief.lief_errors.parsing_error
read_error = lief._lief.lief_errors.read_error
read_out_of_bound = lief._lief.lief_errors.read_out_of_bound
require_extended_version = lief._lief.lief_errors.require_extended_version
class lief.ok_t

Bases: object

Opaque value returned when a void function is executed successfully.

class lief.ok_error_t

Bases: object

Return either: ok_t (success) or lief_errors (error)

property error lief.lief_errors
property is_error bool
property is_value bool
property value lief.ok_t

See also the section Error Handling

Exceptions

LIEF no longer uses exceptions which have been replaced with the ResultOrError idiom.

See: