Python

Metadata

class lief.objc.Metadata

Bases: object

This class is the main interface to inspect Objective-C metadata

It can be instantiated using the function lief.MachO.Binary.objc_metadata

property classes Iterator[lief.objc.Class | None]

Return an iterator over the different Objective-C classes (@interface).

get_class(self, name: str) lief.objc.Class | None

Try to find the Objective-C class with the given mangled name.

get_protocol(self, name: str) lief.objc.Protocol | None

Try to find the Objective-C class with the given mangled name.

property protocols Iterator[lief.objc.Protocol | None]

Return an iterator over the Objective-C protocols declared in this binary (@protocol).

to_decl(self) str

Generate a header-like of all the Objective-C metadata identified in the binary.


Class

class lief.objc.Class

Bases: object

This class represents an Objective-C class (@interface)

property demangled_name str

Demangled name of the class

property is_meta bool
property ivars Iterator[lief.objc.IVar | None]

Iterator over the different instance variables defined in this class.

property methods Iterator[lief.objc.Method | None]

Iterator over the different methods defined by this class.

property name str

Name of the class

property properties Iterator[lief.objc.Property | None]

Iterator over the properties of this class.

property protocols Iterator[lief.objc.Protocol | None]

Iterator over the different protocols implemented by this class.

property super_class lief.objc.Class | None

Parent class in case of inheritance


Protocol

class lief.objc.Protocol

Bases: object

This class represents an Objective-C @protocol

property mangled_name str

Mangled name of the protocol

property optional_methods Iterator[lief.objc.Method | None]

Iterator over the methods that could be overridden

property properties Iterator[lief.objc.Property | None]

Iterator over the properties defined in this protocol

property required_methods Iterator[lief.objc.Method | None]

Iterator over the methods of this protocol that must be implemented


Method

class lief.objc.Method

Bases: object

This class represents an Objective-C Method.

property address int

Virtual address where this method is implemented in the binary

property is_instance bool

Whether it’s an instance method or not.

property mangled_type str

Prototype of the method in its mangled representation (e.g. @16@0:8)

property name str

Name of the method


IVar

class lief.objc.IVar

Bases: object

This class represents an instance variable (ivar)

property mangled_type str

Type of the instance var in its mangled representation (e.g. [29i])

property name str

Name of the instance variable


Property

class lief.objc.Property

Bases: object

This class represents a @property in Objective-C

property attribute str

(raw) property’s attributes (e.g. T@"NSString",C,D,N)

property name str

Name of the property