Skip to content
Permalink
Browse files
Improve Python API to access to the binary Abstract layer
  • Loading branch information
romainthomas committed Aug 30, 2017
1 parent de17260 commit 0713854
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
@@ -149,6 +149,15 @@ void init_LIEF_Binary_class(py::module& m) {
"Return the content located at virtual address",
"virtual_address"_a, "size"_a)

.def_property_readonly("abstract",
[] (py::object& self) {
auto global = py::dict(py::module::import("__main__").attr("__dict__"));
auto local = py::dict();
local["current_binary"] = self;
return py::eval("super(current_binary.__class__, current_binary)", global, local);
},
"Return the " RST_CLASS_REF(lief.Binary) " object",
py::return_value_policy::reference)

.def("__str__",
[] (const Binary& binary)
@@ -21,7 +21,7 @@ def setUp(self):

@staticmethod
def get_abstract_binary(binary):
return super(binary.__class__, binary)
return binary.abstract

@staticmethod
def get_raw(path):

0 comments on commit 0713854

Please sign in to comment.