diff --git a/vendor/lief/api/python/ART/CMakeLists.txt b/vendor/lief/api/python/ART/CMakeLists.txt deleted file mode 100644 index 422be7e..0000000 --- a/vendor/lief/api/python/ART/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -set(LIEF_PYTHON_ART_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyART.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyEnums.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyUtils.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyFile.cpp" -) - -set(LIEF_PYTHON_ART_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyART.hpp") - -source_group("Source Files\\ART" FILES ${LIEF_PYTHON_ART_SRC}) -source_group("Header Files\\ART" FILES ${LIEF_PYTHON_ART_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_ART_SRC}" "${LIEF_PYTHON_ART_HDR}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/../") - - diff --git a/vendor/lief/api/python/ART/objects/pyFile.cpp b/vendor/lief/api/python/ART/objects/pyFile.cpp deleted file mode 100644 index ddd6a46..0000000 --- a/vendor/lief/api/python/ART/objects/pyFile.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/ART/File.hpp" -#include "LIEF/ART/hash.hpp" - -#include "pyART.hpp" - -namespace LIEF { -namespace ART { - -template -using no_const_getter = T (File::*)(void); - -template -using no_const_func = T (File::*)(P); - -template -using getter_t = T (File::*)(void) const; - -template -using setter_t = void (File::*)(T); - -template<> -void create(py::module& m) { - - // File object - py::class_(m, "File", "ART File representation") - - .def_property_readonly("header", - static_cast>(&File::header), - "Return the ART " RST_CLASS_REF(lief.ART.Header) "", - py::return_value_policy::reference) - - .def("__eq__", &File::operator==) - .def("__ne__", &File::operator!=) - .def("__hash__", - [] (const File& file) { - return Hash::hash(file); - }) - - .def("__str__", - [] (const File& file) - { - std::ostringstream stream; - stream << file; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ART/objects/pyHeader.cpp b/vendor/lief/api/python/ART/objects/pyHeader.cpp deleted file mode 100644 index 4aab5fc..0000000 --- a/vendor/lief/api/python/ART/objects/pyHeader.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/ART/Header.hpp" -#include "LIEF/ART/hash.hpp" - -#include "pyART.hpp" - -namespace LIEF { -namespace ART { - -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - -template<> -void create
(py::module& m) { - - py::class_(m, "Header", "ART Header representation") - .def_property_readonly("magic", - static_cast>(&Header::magic) - ) - .def_property_readonly("version", - static_cast>(&Header::version) - ) - .def_property_readonly("image_begin", - static_cast>(&Header::image_begin) - ) - .def_property_readonly("image_size", - static_cast>(&Header::image_size) - ) - .def_property_readonly("oat_checksum", - static_cast>(&Header::oat_checksum) - ) - .def_property_readonly("oat_file_begin", - static_cast>(&Header::oat_file_begin) - ) - .def_property_readonly("oat_file_end", - static_cast>(&Header::oat_file_end) - ) - .def_property_readonly("oat_data_end", - static_cast>(&Header::oat_data_end) - ) - .def_property_readonly("patch_delta", - static_cast>(&Header::patch_delta) - ) - .def_property_readonly("image_roots", - static_cast>(&Header::image_roots) - ) - .def_property_readonly("pointer_size", - static_cast>(&Header::pointer_size) - ) - .def_property_readonly("compile_pic", - static_cast>(&Header::compile_pic) - ) - .def_property_readonly("nb_sections", - static_cast>(&Header::nb_sections) - ) - .def_property_readonly("nb_methods", - static_cast>(&Header::nb_methods) - ) - .def_property_readonly("boot_image_begin", - static_cast>(&Header::boot_image_begin) - ) - .def_property_readonly("boot_image_size", - static_cast>(&Header::boot_image_size) - ) - .def_property_readonly("boot_oat_begin", - static_cast>(&Header::boot_oat_begin) - ) - .def_property_readonly("boot_oat_size", - static_cast>(&Header::boot_oat_size) - ) - .def_property_readonly("storage_mode", - static_cast>(&Header::storage_mode) - ) - .def_property_readonly("data_size", - static_cast>(&Header::data_size) - ) - - .def("__eq__", &Header::operator==) - .def("__ne__", &Header::operator!=) - .def("__hash__", - [] (const Header& header) { - return Hash::hash(header); - }) - - .def("__str__", - [] (const Header& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); -} -} -} - - diff --git a/vendor/lief/api/python/ART/objects/pyParser.cpp b/vendor/lief/api/python/ART/objects/pyParser.cpp deleted file mode 100644 index 2f06e5b..0000000 --- a/vendor/lief/api/python/ART/objects/pyParser.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyART.hpp" - -#include "LIEF/ART/Parser.hpp" - -#include - -namespace LIEF { -namespace ART { - -template<> -void create(py::module& m) { - - // Parser (Parser) - m.def("parse", - static_cast (*) (const std::string&)>(&Parser::parse), - "Parse the given filename and return an " RST_CLASS_REF(lief.ART.File) " object", - "filename"_a, - py::return_value_policy::take_ownership); - - m.def("parse", - static_cast (*) (std::vector, const std::string&)>(&Parser::parse), - "Parse the given raw data and return an " RST_CLASS_REF(lief.ART.File) " object", - "raw"_a, "name"_a = "", - py::return_value_policy::take_ownership); - - - m.def("parse", - [] (py::object byteio, const std::string& name) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str))}; - - return LIEF::ART::Parser::parse(std::move(raw), name); - }, - "io"_a, "name"_a = "", - py::return_value_policy::take_ownership); -} - -} -} diff --git a/vendor/lief/api/python/ART/pyART.cpp b/vendor/lief/api/python/ART/pyART.cpp deleted file mode 100644 index ba9ee17..0000000 --- a/vendor/lief/api/python/ART/pyART.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyART.hpp" - - -namespace LIEF { -namespace ART { -void init_python_module(py::module& m) { - py::module LIEF_ART_module = m.def_submodule("ART", "Python API for ART format"); - - init_enums(LIEF_ART_module); - init_objects(LIEF_ART_module); - init_utils(LIEF_ART_module); -} - - -void init_objects(py::module& m) { - CREATE(Parser, m); - CREATE(File, m); - CREATE(Header, m); -} - -} -} diff --git a/vendor/lief/api/python/ART/pyART.hpp b/vendor/lief/api/python/ART/pyART.hpp deleted file mode 100644 index f61510a..0000000 --- a/vendor/lief/api/python/ART/pyART.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ART_H_ -#define PY_LIEF_ART_H_ - -#include "LIEF/ART.hpp" - -#include "pyLIEF.hpp" - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - - -namespace LIEF { -namespace ART { - -template -void create(py::module&); - -void init_python_module(py::module& m); - -void init_objects(py::module&); - -void init_enums(py::module&); - -void init_utils(py::module&); - - -SPECIALIZE_CREATE(Parser); -SPECIALIZE_CREATE(File); -SPECIALIZE_CREATE(Header); - -} -} - - -#endif diff --git a/vendor/lief/api/python/ART/pyEnums.cpp b/vendor/lief/api/python/ART/pyEnums.cpp deleted file mode 100644 index 205d667..0000000 --- a/vendor/lief/api/python/ART/pyEnums.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyART.hpp" -#include "LIEF/ART/enums.hpp" -#include "LIEF/ART/EnumToString.hpp" - -#define PY_ENUM(x) to_string(x), x - -namespace LIEF { -namespace ART { -void init_enums(py::module& m) { - - py::enum_(m, "STORAGE_MODES") - .value(PY_ENUM(STORAGE_MODES::STORAGE_UNCOMPRESSED)) - .value(PY_ENUM(STORAGE_MODES::STORAGE_LZ4)) - .value(PY_ENUM(STORAGE_MODES::STORAGE_LZ4HC)); - -} -} -} diff --git a/vendor/lief/api/python/ART/pyUtils.cpp b/vendor/lief/api/python/ART/pyUtils.cpp deleted file mode 100644 index 69ff112..0000000 --- a/vendor/lief/api/python/ART/pyUtils.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyART.hpp" - -#include "LIEF/ART/utils.hpp" - -namespace LIEF { -namespace ART { - -void init_utils(py::module& m) { - - m.def("is_art", - static_cast(&is_art), - "Check if the **file** given in parameter is an ART", - "path"_a); - - m.def("is_art", - static_cast&)>(&is_art), - "Check if the **raw data** given in parameter is a ART", - "raw"_a); - - m.def("version", - static_cast(&version), - "Return the ART version of the **file** given in parameter", - "file"_a); - - m.def("version", - static_cast&)>(&version), - "Return the ART version of the **raw data** given in parameter", - "raw"_a); - - - m.def("android_version", - &android_version, - "Return the " RST_CLASS_REF(lief.Android.ANDROID_VERSIONS) " associated with the given ART version ", - "art_version"_a); -} - -} -} - diff --git a/vendor/lief/api/python/Abstract/CMakeLists.txt b/vendor/lief/api/python/Abstract/CMakeLists.txt deleted file mode 100644 index 6075ed8..0000000 --- a/vendor/lief/api/python/Abstract/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ - -set(LIEF_PYTHON_ABSTRACT_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyAbstract.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBinary.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySection.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbol.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocation.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyFunction.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyEnums.cpp" -) - - -set(LIEF_PYTHON_ABSTRACT_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyAbstract.hpp" -) - -source_group("Source Files\\Abstract" FILES ${LIEF_PYTHON_ABSTRACT_SRC}) -source_group("Header Files\\Abstract" FILES ${LIEF_PYTHON_ABSTRACT_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_ABSTRACT_SRC}" "${LIEF_PYTHON_ABSTRACT_HDR}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}") - - diff --git a/vendor/lief/api/python/Abstract/objects/pyBinary.cpp b/vendor/lief/api/python/Abstract/objects/pyBinary.cpp deleted file mode 100644 index 25c4ec7..0000000 --- a/vendor/lief/api/python/Abstract/objects/pyBinary.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyAbstract.hpp" -#include "pyIterators.hpp" -#include "pyErr.hpp" -#include "LIEF/Abstract/Binary.hpp" - - -#define PY_ENUM(x) LIEF::to_string(x), x - -namespace LIEF { - -template -using getter_t = T (Binary::*)(void) const; - -template -using setter_t = void (Binary::*)(T); - -template -using it_t = T (Binary::*)(void); - -template -using no_const_func = T (Binary::*)(P); - -template<> -void create(py::module& m) { - py::class_ pybinary(m, "Binary", - R"delim( - File format abstract representation. - - This object represents the abstraction of an executable file format. - It enables to access common features (like the :attr:`~lief.Binary.entrypoint`) regardless - of the concrete format (e.g. :attr:`lief.ELF.Binary.entrypoint`) - )delim"); - - py::enum_(pybinary, "VA_TYPES") - .value(PY_ENUM(Binary::VA_TYPES::AUTO)) - .value(PY_ENUM(Binary::VA_TYPES::VA)) - .value(PY_ENUM(Binary::VA_TYPES::RVA)); - - init_ref_iterator(pybinary, "it_sections"); - init_ref_iterator(pybinary, "it_symbols"); - init_ref_iterator(pybinary, "it_relocations"); - - pybinary - .def_property_readonly("format", - &Binary::format, - "File format " RST_CLASS_REF(lief.EXE_FORMATS) " of the underlying binary.") - - .def_property_readonly("is_pie", - &Binary::is_pie, - "Check if the binary is position independent") - - .def_property_readonly("has_nx", - &Binary::has_nx, - "Check if the binary has ``NX`` protection (non executable stack)") - - .def_property("name", - static_cast>(&Binary::name), - static_cast>(&Binary::name), - "Binary's name") - - .def_property_readonly("header", - &Binary::header, - "Binary's abstract header (" RST_CLASS_REF(lief.Header) ")") - - .def_property_readonly("entrypoint", - &Binary::entrypoint, - "Binary's entrypoint") - - .def("remove_section", - static_cast(&Binary::remove_section), - "Remove the section with the given name", - "name"_a, "clear"_a = false) - - .def_property_readonly("sections", - static_cast>(&Binary::sections), - "Return an iterator over the binary's abstract sections (" RST_CLASS_REF(lief.Section) ")", - py::return_value_policy::reference_internal) - - .def_property_readonly("relocations", - static_cast>(&Binary::relocations), - "Return an iterator over abstract " RST_CLASS_REF(lief.Relocation) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("exported_functions", - &Binary::exported_functions, - "Return the binary's exported " RST_CLASS_REF(lief.Function) "") - - .def_property_readonly("imported_functions", - &Binary::imported_functions, - "Return the binary's imported " RST_CLASS_REF(lief.Function) " (name)") - - .def_property_readonly("libraries", - [] (const Binary& binary) { - const std::vector& imported_libraries = binary.imported_libraries(); - std::vector imported_libraries_encoded; - imported_libraries_encoded.reserve(imported_libraries.size()); - - std::transform( - std::begin(imported_libraries), std::end(imported_libraries), - std::back_inserter(imported_libraries_encoded), - &safe_string_converter); - return imported_libraries_encoded; - }, - "Return binary's imported libraries (name)") - - .def_property_readonly("symbols", - static_cast>(&Binary::symbols), - "Return an iterator over the binary's abstract " RST_CLASS_REF(lief.Symbol) "", - py::return_value_policy::reference_internal) - - .def("has_symbol", - &Binary::has_symbol, - "Check if a " RST_CLASS_REF(lief.Symbol) " with the given name exists", - "symbol_name"_a) - - .def("get_symbol", - static_cast>(&Binary::get_symbol), - R"delim( - Return the :class:`~lief.Symbol` from the given ``name``. - - If the symbol can't be found, it returns None. - )delim", - "symbol_name"_a, - py::return_value_policy::reference_internal) - - .def("get_function_address", - [] (const Binary& self, const std::string& name) { - return error_or(&Binary::get_function_address, self, name); - }, - "Return the address of the given function name", - "function_name"_a) - - .def("patch_address", - static_cast&, Binary::VA_TYPES)>(&Binary::patch_address), - R"delim( - Patch the address with the given list of bytes. - The virtual address is specified in the first argument and the content in the second (as a list of bytes). - - If the underlying binary is a PE, one can specify if the virtual address is a :attr:`~lief.Binary.VA_TYPES.RVA` or - a :attr:`~lief.Binary.VA_TYPES.VA`. By default, it is set to :attr:`~lief.Binary.VA_TYPES.AUTO`. - )delim", - "address"_a, "patch_value"_a, "va_type"_a = Binary::VA_TYPES::AUTO) - - .def("patch_address", - static_cast(&Binary::patch_address), - R"delim( - Patch the address with the given integer value. - The virtual address is specified in the first argument, the integer in the second and the integer's size of in third one. - - If the underlying binary is a PE, one can specify if the virtual address is a :attr:`~lief.Binary.VA_TYPES.RVA` or - a :attr:`~lief.Binary.VA_TYPES.VA`. By default, it is set to :attr:`~lief.Binary.VA_TYPES.AUTO`. - )delim", - "address"_a, "patch_value"_a, "size"_a = 8, "va_type"_a = Binary::VA_TYPES::AUTO) - - - .def("get_content_from_virtual_address", - &Binary::get_content_from_virtual_address, - R"delim( - Return the content located at the provided virtual address. - The virtual address is specified in the first argument and size to read (in bytes) in the second. - - If the underlying binary is a PE, one can specify if the virtual address is a :attr:`~lief.Binary.VA_TYPES.RVA` or - a :attr:`~lief.Binary.VA_TYPES.VA`. By default, it is set to :attr:`~lief.Binary.VA_TYPES.AUTO`. - )delim", - "virtual_address"_a, "size"_a, "va_type"_a = Binary::VA_TYPES::AUTO) - - .def_property_readonly("abstract", - [m] (py::object& self) { - self.attr("__class__") = m.attr("Binary"); - return self; - }, - R"delim( - Return the abstract representation of the current binary (:class:`lief.Binary`) - - .. warning:: - - Getting this property modifies the ``__class__`` attribute such as - the current binary looks like a :class:`lief.Binary`. - - To get back to the original binary, one needs to access :attr:`lief.Binary.concrete` - )delim", - py::return_value_policy::reference) - - - .def_property_readonly("concrete", - [m] (py::object& self) { - self.attr("__class__") = py::cast(self.cast()).attr("__class__"); - return self; - }, - R"delim( - The *concrete* representation of the binary. Basically, this property cast a :class:`lief.Binary` - into a :class:`lief.PE.Binary`, :class:`lief.ELF.Binary` or :class:`lief.MachO.Binary`. - - See also: :attr:`lief.Binary.abstract` - )delim", - py::return_value_policy::reference) - - .def_property_readonly("ctor_functions", - &Binary::ctor_functions, - "Constructor functions that are called prior to any other functions") - - .def("xref", - &Binary::xref, - "Return all **virtual addresses** that *use* the ``address`` given in parameter", - "virtual_address"_a) - - .def("offset_to_virtual_address", - [] (const Binary& self, uint64_t offset, uint64_t slide) { - return error_or(&Binary::offset_to_virtual_address, self, offset, slide); - }, - "Convert an offset into a virtual address.", - "offset"_a, "slide"_a = 0) - - .def_property_readonly("imagebase", - &Binary::imagebase, - "Default image base (i.e. if the ASLR is not enabled)") - - .def("__str__", - [] (const Binary& binary) - { - std::ostringstream stream; - stream << binary; - std::string str = stream.str(); - return str; - }); - -} - -} - diff --git a/vendor/lief/api/python/Abstract/objects/pyFunction.cpp b/vendor/lief/api/python/Abstract/objects/pyFunction.cpp deleted file mode 100644 index 7b7646a..0000000 --- a/vendor/lief/api/python/Abstract/objects/pyFunction.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyAbstract.hpp" -#include "LIEF/Abstract/Symbol.hpp" - -#include -#include - -#define PY_ENUM(x) LIEF::to_string(x), x - -namespace LIEF { - -template -using getter_t = T (Function::*)(void) const; - -template -using setter_t = void (Function::*)(T); - -template<> -void create(py::module& m) { - - py::class_ pyfunction(m, "Function", - R"delim( - Class which represents a Function in an executable file format. - )delim"); - - py::enum_(pyfunction, "FLAGS") - .value(PY_ENUM(Function::FLAGS::IMPORTED)) - .value(PY_ENUM(Function::FLAGS::EXPORTED)) - .value(PY_ENUM(Function::FLAGS::CONSTRUCTOR)) - .value(PY_ENUM(Function::FLAGS::DESTRUCTOR)) - .value(PY_ENUM(Function::FLAGS::DEBUG)); - - pyfunction - .def(py::init()) - .def(py::init()) - .def(py::init()) - .def(py::init()) - - .def("add", - &Function::add, - "Add the given " RST_CLASS_REF(lief.Function.FLAGS) "", - "flag"_a) - - .def_property_readonly("flags", - &Function::flags, - "Function flags as a list of " RST_CLASS_REF(lief.Function.FLAGS) "") - - .def_property("address", - static_cast>(&Function::address), - static_cast>(&Function::address), - "Function's address") - - .def("__str__", - [] (const Function& f) { - std::ostringstream stream; - stream << f; - std::string str = stream.str(); - return str; - }); -} - -} diff --git a/vendor/lief/api/python/Abstract/objects/pyHeader.cpp b/vendor/lief/api/python/Abstract/objects/pyHeader.cpp deleted file mode 100644 index 932efd0..0000000 --- a/vendor/lief/api/python/Abstract/objects/pyHeader.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include "pyAbstract.hpp" -#include "LIEF/Abstract/Header.hpp" - -namespace LIEF { -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - -template<> -void create
(py::module& m) { - py::class_(m, "Header") - .def(py::init()) - - .def_property("architecture", - static_cast>(&Header::architecture), - static_cast>(&Header::architecture), - "Target architecture (" RST_CLASS_REF(lief.ARCHITECTURES) ")") - - .def_property("modes", - static_cast&>>(&Header::modes), - static_cast&>>(&Header::modes), - "Target " RST_CLASS_REF(lief.MODES) " (32-bits, 64-bits...)") - - .def_property("entrypoint", - static_cast>(&Header::entrypoint), - static_cast>(&Header::entrypoint), - "Binary entrypoint") - - .def_property("object_type", - static_cast>(&Header::object_type), - static_cast>(&Header::object_type), - "Type of the binary (executable, library...)\n" - "See: " RST_CLASS_REF(lief.OBJECT_TYPES) "") - - .def_property("endianness", - static_cast>(&Header::endianness), - static_cast>(&Header::endianness), - "Binary endianness\n" - "See: " RST_CLASS_REF(lief.ENDIANNESS) "") - - .def_property_readonly("is_32", - &Header::is_32, - "``True`` if the binary targets a ``32-bits`` architecture") - - .def_property_readonly("is_64", - &Header::is_64, - "``True`` if the binary targets a ``64-bits`` architecture") - - - .def("__str__", - [] (const Header& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); -} -} diff --git a/vendor/lief/api/python/Abstract/objects/pyParser.cpp b/vendor/lief/api/python/Abstract/objects/pyParser.cpp deleted file mode 100644 index cc95b13..0000000 --- a/vendor/lief/api/python/Abstract/objects/pyParser.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyAbstract.hpp" - -#include "LIEF/Abstract/Parser.hpp" - -#include -#include - -namespace LIEF { -template<> -void create(py::module& m) { - - m.def("parse", - [] (py::bytes bytes, const std::string& name) { - std::string raw_str = bytes; - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str)) - }; - std::unique_ptr binary; - std::exception_ptr ep; - Py_BEGIN_ALLOW_THREADS - try { - binary = Parser::parse(std::move(raw), name); - } catch (...) { - ep = std::current_exception(); - } - Py_END_ALLOW_THREADS - if (ep) std::rethrow_exception(ep); - return binary; - }, - R"delim( - Parse a binary supported by LIEF from the given bytes and return either: - - - :class:`lief.ELF.Binary` - - :class:`lief.PE.Binary` - - :class:`lief.MachO.Binary` - - depending on the given binary format. - )delim", - "raw"_a, "name"_a = "", - py::return_value_policy::take_ownership); - - m.def("parse", - [] (const std::string& filepath) { - std::unique_ptr binary; - std::exception_ptr ep; - Py_BEGIN_ALLOW_THREADS - try { - binary = Parser::parse(filepath); - } catch (...) { - ep = std::current_exception(); - } - Py_END_ALLOW_THREADS - if (ep) std::rethrow_exception(ep); - return binary; - }, - R"delim( - Parse a binary from the given file path and return either: - - - :class:`lief.ELF.Binary` - - :class:`lief.PE.Binary` - - :class:`lief.MachO.Binary` - - depending on the given binary format. - )delim", - "filepath"_a, - py::return_value_policy::take_ownership); - - m.def("parse", - [](const std::vector& raw, const std::string& name) { - std::unique_ptr binary; - std::exception_ptr ep; - Py_BEGIN_ALLOW_THREADS - try { - binary = Parser::parse(raw, name); - } catch (...) { - ep = std::current_exception(); - } - Py_END_ALLOW_THREADS - if (ep) std::rethrow_exception(ep); - return binary; - }, - R"delim( - Parse a binary supported by LIEF from the given list of bytes and return either: - - - :class:`lief.ELF.Binary` - - :class:`lief.PE.Binary` - - :class:`lief.MachO.Binary` - - depending on the given binary format. - )delim", - "raw"_a, "name"_a = "", - py::return_value_policy::take_ownership); - - - - m.def("parse", - [] (py::object byteio, const std::string& name) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str)) - }; - - std::unique_ptr binary; - std::exception_ptr ep; - Py_BEGIN_ALLOW_THREADS - try { - binary = Parser::parse(std::move(raw), name); - } catch (...) { - ep = std::current_exception(); - } - Py_END_ALLOW_THREADS - if (ep) std::rethrow_exception(ep); - return binary; - }, - R"delim( - Parse a binary supported by LIEF from the given Python IO interface and return either: - - - :class:`lief.ELF.Binary` - - :class:`lief.PE.Binary` - - :class:`lief.MachO.Binary` - - depending on the given binary format. - )delim", - "io"_a, "name"_a = "", - py::return_value_policy::take_ownership); -} -} diff --git a/vendor/lief/api/python/Abstract/objects/pyRelocation.cpp b/vendor/lief/api/python/Abstract/objects/pyRelocation.cpp deleted file mode 100644 index 05d511d..0000000 --- a/vendor/lief/api/python/Abstract/objects/pyRelocation.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include "pyAbstract.hpp" - -#include "LIEF/Abstract/hash.hpp" - -#include "LIEF/Abstract/Relocation.hpp" - -namespace LIEF { -template -using getter_t = T (Relocation::*)(void) const; - -template -using setter_t = void (Relocation::*)(T); - -template<> -void create(py::module& m) { - py::class_(m, "Relocation", - R"delim( - Class which represents an abstracted Relocation - )delim") - .def(py::init(), - "Default constructor") - - .def(py::init(), - "Constructor from an :attr:`~lief.Relocation.address` and a :attr:`~lief.Relocation.size`", - "address"_a, "size"_a) - - .def_property("address", - static_cast>(&Relocation::address), - static_cast>(&Relocation::address), - "Relocation's address") - - .def_property("size", - static_cast>(&Relocation::size), - static_cast>(&Relocation::size), - "Relocation's size (in **bits**)") - - .def("__eq__", &Relocation::operator==) - .def("__ne__", &Relocation::operator!=) - .def("__hash__", - [] (const Relocation& relocation) { - return AbstractHash::hash(relocation); - }) - - .def("__str__", - [] (const Relocation& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} -} diff --git a/vendor/lief/api/python/Abstract/objects/pySection.cpp b/vendor/lief/api/python/Abstract/objects/pySection.cpp deleted file mode 100644 index 92f0a4b..0000000 --- a/vendor/lief/api/python/Abstract/objects/pySection.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include "pyAbstract.hpp" -#include "LIEF/Abstract/Section.hpp" - -namespace LIEF { -template -using getter_t = T (Section::*)(void) const; - -template -using setter_t = void (Section::*)(T); - -template<> -void create
(py::module& m) { - py::class_(m, "Section", - R"delim( - Class which represents an abstracted section - )delim") - .def(py::init(), - "Default constructor") - - .def(py::init(), - "Constructor from section name", - "name"_a) - - .def_property("name", - [] (const Section& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&Section::name), - "Section's name") - - .def_property_readonly("fullname", - &Section::fullname, - "Return the **fullname** of the section including the trailing bytes") - - .def_property("size", - static_cast>(&Section::size), - static_cast>(&Section::size), - "Section's size") - - .def_property("offset", - static_cast>(&Section::offset), - static_cast>(&Section::offset), - "Section's file offset") - - .def_property("virtual_address", - static_cast>(&Section::virtual_address), - static_cast>(&Section::virtual_address), - "Section's virtual address") - - .def_property("content", - [] (const Section& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast&>>(&Section::content), - "Section's content") - - .def_property_readonly("entropy", - &Section::entropy, - "Section's entropy") - - .def("search", - static_cast(&Section::search), - "Look for **integer** within the current section", - "number"_a, "pos"_a = 0, "size"_a = 0) - - .def("search", - static_cast(&Section::search), - "Look for **string** within the current section", - "str"_a, "pos"_a = 0) - - .def("search_all", - static_cast (Section::*)(uint64_t, size_t) const>(&Section::search_all), - "Look for **all** integers within the current section", - "number"_a, "size"_a = 0) - - .def("search_all", - static_cast (Section::*)(const std::string&) const>(&Section::search_all), - "Look for all **strings** within the current section", - "str"_a) - - .def("__str__", - [] (const Section& section) - { - std::ostringstream stream; - stream << section; - std::string str = stream.str(); - return str; - }); -} -} diff --git a/vendor/lief/api/python/Abstract/objects/pySymbol.cpp b/vendor/lief/api/python/Abstract/objects/pySymbol.cpp deleted file mode 100644 index 1a81c89..0000000 --- a/vendor/lief/api/python/Abstract/objects/pySymbol.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyAbstract.hpp" -#include "LIEF/Abstract/Symbol.hpp" - -#include -#include - -namespace LIEF { - -template -using getter_t = T (Symbol::*)(void) const; - -template -using setter_t = void (Symbol::*)(T); - -template<> -void create(py::module& m) { - - py::class_(m, "Symbol", - R"delim( - This class represents a symbol in an executable format. - )delim") - .def(py::init()) - - .def_property("name", - [] (const Symbol& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&Symbol::name), - "Symbol's name") - - .def_property("value", - static_cast>(&Symbol::value), - static_cast>(&Symbol::value), - "Symbol's value") - - .def_property("size", - static_cast>(&Symbol::size), - static_cast>(&Symbol::size), - "Symbol's size") - - .def("__str__", - [] (const Symbol& symbol) - { - std::ostringstream stream; - stream << symbol; - std::string str = stream.str(); - return str; - }); -} - -} diff --git a/vendor/lief/api/python/Abstract/pyAbstract.cpp b/vendor/lief/api/python/Abstract/pyAbstract.cpp deleted file mode 100644 index 7e177e9..0000000 --- a/vendor/lief/api/python/Abstract/pyAbstract.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyLIEF.hpp" -#include "pyAbstract.hpp" -namespace LIEF { - -void init_python_module(py::module& m) { - init_enums(m); - init_objects(m); -} - -void init_objects(py::module& m) { - CREATE(Header, m); - CREATE(Binary, m); - CREATE(Section, m); - CREATE(Symbol, m); - CREATE(Parser, m); - CREATE(Relocation, m); - CREATE(Function, m); -} - - -} - diff --git a/vendor/lief/api/python/Abstract/pyAbstract.hpp b/vendor/lief/api/python/Abstract/pyAbstract.hpp deleted file mode 100644 index 813530d..0000000 --- a/vendor/lief/api/python/Abstract/pyAbstract.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ABSTRACT_H_ -#define PY_LIEF_ABSTRACT_H_ - -#include "pyLIEF.hpp" -#include "LIEF/Abstract.hpp" - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - -namespace LIEF { -template -void create(py::module&); - -void init_python_module(py::module& m); -void init_objects(py::module&); -void init_enums(py::module&); - -SPECIALIZE_CREATE(Header); -SPECIALIZE_CREATE(Binary); -SPECIALIZE_CREATE(Section); -SPECIALIZE_CREATE(Symbol); -SPECIALIZE_CREATE(Parser); -SPECIALIZE_CREATE(Relocation); -SPECIALIZE_CREATE(Function); -} -#endif diff --git a/vendor/lief/api/python/Abstract/pyEnums.cpp b/vendor/lief/api/python/Abstract/pyEnums.cpp deleted file mode 100644 index 40a1c6c..0000000 --- a/vendor/lief/api/python/Abstract/pyEnums.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyAbstract.hpp" -#include "LIEF/Abstract/enums.hpp" -#include "LIEF/Abstract/EnumToString.hpp" - -#define PY_ENUM(x) LIEF::to_string(x), x -namespace LIEF { - -void init_enums(py::module& m) { - py::enum_(m, "EXE_FORMATS") - .value(PY_ENUM(EXE_FORMATS::FORMAT_UNKNOWN)) - .value(PY_ENUM(EXE_FORMATS::FORMAT_ELF)) - .value(PY_ENUM(EXE_FORMATS::FORMAT_PE)) - .value(PY_ENUM(EXE_FORMATS::FORMAT_MACHO)); - - py::enum_(m, "OBJECT_TYPES") - .value(PY_ENUM(OBJECT_TYPES::TYPE_NONE)) - .value(PY_ENUM(OBJECT_TYPES::TYPE_EXECUTABLE)) - .value(PY_ENUM(OBJECT_TYPES::TYPE_LIBRARY)) - .value(PY_ENUM(OBJECT_TYPES::TYPE_OBJECT)); - - py::enum_(m, "ARCHITECTURES") - .value(PY_ENUM(ARCHITECTURES::ARCH_NONE)) - .value(PY_ENUM(ARCHITECTURES::ARCH_ARM)) - .value(PY_ENUM(ARCHITECTURES::ARCH_ARM64)) - .value(PY_ENUM(ARCHITECTURES::ARCH_MIPS)) - .value(PY_ENUM(ARCHITECTURES::ARCH_X86)) - .value(PY_ENUM(ARCHITECTURES::ARCH_PPC)) - .value(PY_ENUM(ARCHITECTURES::ARCH_SPARC)) - .value(PY_ENUM(ARCHITECTURES::ARCH_SYSZ)) - .value(PY_ENUM(ARCHITECTURES::ARCH_XCORE)) - .value(PY_ENUM(ARCHITECTURES::ARCH_INTEL)) - .value(PY_ENUM(ARCHITECTURES::ARCH_RISCV)); - - py::enum_(m, "MODES") - .value(PY_ENUM(MODES::MODE_NONE)) - .value(PY_ENUM(MODES::MODE_16)) - .value(PY_ENUM(MODES::MODE_32)) - .value(PY_ENUM(MODES::MODE_64)) - .value(PY_ENUM(MODES::MODE_ARM)) - .value(PY_ENUM(MODES::MODE_THUMB)) - .value(PY_ENUM(MODES::MODE_MCLASS)) - .value(PY_ENUM(MODES::MODE_MICRO)) - .value(PY_ENUM(MODES::MODE_MIPS3)) - .value(PY_ENUM(MODES::MODE_MIPS32R6)) - .value(PY_ENUM(MODES::MODE_MIPSGP64)) - .value(PY_ENUM(MODES::MODE_V7)) - .value(PY_ENUM(MODES::MODE_V8)) - .value(PY_ENUM(MODES::MODE_V9)) - .value(PY_ENUM(MODES::MODE_MIPS32)) - .value(PY_ENUM(MODES::MODE_MIPS64)); - - py::enum_(m, "ENDIANNESS") - .value(PY_ENUM(ENDIANNESS::ENDIAN_NONE)) - .value(PY_ENUM(ENDIANNESS::ENDIAN_BIG)) - .value(PY_ENUM(ENDIANNESS::ENDIAN_LITTLE)); -} -} diff --git a/vendor/lief/api/python/CMakeLists.txt b/vendor/lief/api/python/CMakeLists.txt deleted file mode 100644 index 2e652c1..0000000 --- a/vendor/lief/api/python/CMakeLists.txt +++ /dev/null @@ -1,214 +0,0 @@ -cmake_minimum_required(VERSION 3.1) - -# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: -if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") - cmake_policy(SET CMP0135 NEW) -endif() - -include(ExternalProject) -include(CheckCXXCompilerFlag) -include(CheckCCompilerFlag) - - -macro(ADD_FLAG_IF_SUPPORTED flag name) - CHECK_C_COMPILER_FLAG("${flag}" "C_SUPPORTS_${name}") - CHECK_CXX_COMPILER_FLAG("${flag}" "CXX_SUPPORTS_${name}") - - if (C_SUPPORTS_${name}) - target_compile_options(pyLIEF PRIVATE ${flag}) - endif() - - if (CXX_SUPPORTS_${name}) - target_compile_options(pyLIEF PRIVATE ${flag}) - endif() -endmacro() - -add_library(lief_pybind11 INTERFACE) - -if (LIEF_EXTERNAL_PYBIND11) - find_package(pybind11 REQUIRED) - find_package(PythonLibsNew MODULE REQUIRED) - target_link_libraries(lief_pybind11 INTERFACE pybind11::module) - get_target_property(PYBIND_INC_DIR pybind11::module INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(lief_pybind11 SYSTEM INTERFACE ${PYBIND_INC_DIR} ${Python_INCLUDE_DIRS}) -else() - find_package(PythonLibsNew MODULE REQUIRED) - set(PYBIND11_VERSION 2.9.2) - set(PYBIND11_SHA256 SHA256=d1646e6f70d8a3acb2ddd85ce1ed543b5dd579c68b8fb8e9638282af20edead8) - set(PYBIND11_URL "${THIRD_PARTY_DIRECTORY}/pybind11-${PYBIND11_VERSION}.zip" CACHE STRING "URL to the Pybind11 repo") - ExternalProject_Add(lief_pybind11_project - URL ${PYBIND11_URL} - URL_HASH ${PYBIND11_SHA256} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "") - add_dependencies(lief_pybind11 lief_pybind11_project) - ExternalProject_get_property(lief_pybind11_project SOURCE_DIR) - target_include_directories(lief_pybind11 SYSTEM INTERFACE "${SOURCE_DIR}/include") -endif() - -message(STATUS "Python version: ${PYTHON_VERSION}") -message(STATUS "Python lib: ${PYTHON_LIBRARY}") -message(STATUS "Python include: ${PYTHON_INCLUDE_DIR}") -message(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}") - - -# Define source files -set(LIEF_PYTHON_BASIC_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/pyLIEF.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyUtils.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyExceptions.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyLogger.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyHash.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyObject.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyErr.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/encoding.cpp" -) - -list(APPEND LIEF_PYTHON_BASIC_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/pyJson.cpp") - -set(LIEF_PYTHON_SRC - ${LIEF_PYTHON_BASIC_SRC} -) - -set(LIEF_PYTHON_BASIC_HDR - "${CMAKE_CURRENT_SOURCE_DIR}/pyErr.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyIterators.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/pyLIEF.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/enums_wrapper.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/encoding.hpp" -) - -set(LIEF_PYTHON_HDR - ${LIEF_PYTHON_BASIC_HDR} -) - -source_group("Header Files" FILES ${LIEF_PYTHON_BASIC_HDR}) - -add_library(pyLIEF SHARED ${LIEF_PYTHON_SRC} ${LIEF_PYTHON_HDR}) - -target_include_directories(pyLIEF PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/" - "${CMAKE_CURRENT_SOURCE_DIR}/../../src" -) - -target_include_directories(pyLIEF SYSTEM PRIVATE - "${PYTHON_INCLUDE_DIR}" - "${PYBIND11_SOURCE_DIR}/include") - -include("${CMAKE_CURRENT_SOURCE_DIR}/Abstract/CMakeLists.txt") - -if(LIEF_ELF) - include("${CMAKE_CURRENT_SOURCE_DIR}/ELF/CMakeLists.txt") -endif() - -if(LIEF_PE) - include("${CMAKE_CURRENT_SOURCE_DIR}/PE/CMakeLists.txt") -endif() - -if(LIEF_MACHO) - include("${CMAKE_CURRENT_SOURCE_DIR}/MachO/CMakeLists.txt") -endif() - -if(LIEF_OAT) - include("${CMAKE_CURRENT_SOURCE_DIR}/OAT/CMakeLists.txt") -endif() - -if(LIEF_DEX) - include("${CMAKE_CURRENT_SOURCE_DIR}/DEX/CMakeLists.txt") -endif() - -if(LIEF_VDEX) - include("${CMAKE_CURRENT_SOURCE_DIR}/VDEX/CMakeLists.txt") -endif() - -if(LIEF_ART) - include("${CMAKE_CURRENT_SOURCE_DIR}/ART/CMakeLists.txt") -endif() - -include("${CMAKE_CURRENT_SOURCE_DIR}/platforms/CMakeLists.txt") - - -target_compile_features(pyLIEF PRIVATE cxx_attribute_deprecated) - -set_target_properties(pyLIEF PROPERTIES - POSITION_INDEPENDENT_CODE ON - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON - CXX_VISIBILITY_PRESET hidden - C_VISIBILITY_PRESET hidden -) - -if (MSVC) - set_property(TARGET pyLIEF PROPERTY LINK_FLAGS /NODEFAULTLIB:MSVCRT) -endif() - -set_target_properties(pyLIEF PROPERTIES PYTHON_VERSION ${PYTHON_VERSION}) -set(PYLIEF_DEPS_LIBRARIES LIB_LIEF) - -if(LIEF_COVERAGE) - target_compile_options(pyLIEF PRIVATE -g -O0 --coverage -fprofile-arcs -ftest-coverage) - set(PYLIEF_DEPS_LIBRARIES ${PYLIEF_DEPS_LIBRARIES} gcov) -endif() - - -ADD_FLAG_IF_SUPPORTED("-Wno-macro-redefined" NO_MACRO_REDEFINED) -ADD_FLAG_IF_SUPPORTED("-Wno-deprecated-declarations" NO_DEPRECATED_DECLARATIONS) - -set_target_properties(pyLIEF PROPERTIES PREFIX "" OUTPUT_NAME "lief") -target_link_libraries(pyLIEF PRIVATE lief_pybind11) - -if(APPLE) - set_target_properties(pyLIEF PROPERTIES - MACOSX_RPATH ON - LINK_FLAGS "-undefined dynamic_lookup " - ) -endif() - -set_target_properties(pyLIEF PROPERTIES PREFIX "") -if (UNIX) - # Even on osx (c.f. EXT_SUFFIX from sysconfig) - set_target_properties(pyLIEF PROPERTIES SUFFIX ".so") -elseif(WIN32) - set_target_properties(pyLIEF PROPERTIES SUFFIX ".pyd") -endif() - -get_target_property(suffix pyLIEF SUFFIX) -set(LIEF_LIBRARY_NAME "lief${suffix}") - -if (WIN32) - set(PYLIEF_DEPS_LIBRARIES ${PYLIEF_DEPS_LIBRARIES} ${PYTHON_LIBRARIES}) -endif() - -target_link_libraries(pyLIEF PUBLIC ${PYLIEF_DEPS_LIBRARIES}) - - -if (CMAKE_BUILD_TYPE MATCHES Release AND UNIX AND NOT APPLE) - add_custom_command( - TARGET pyLIEF - COMMENT "Strip LIEF Python bindings" - POST_BUILD - COMMAND ${CMAKE_STRIP} --strip-all $ - ) -endif() - -if (CMAKE_BUILD_TYPE MATCHES Release AND APPLE) - add_custom_command( - TARGET pyLIEF - COMMENT "Strip LIEF Python bindings" - POST_BUILD - COMMAND ${CMAKE_STRIP} -x -S $ - ) -endif() - -add_custom_command(TARGET pyLIEF POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${PROJECT_BINARY_DIR}/api/python/lief -) - -if (MSVC) - add_custom_command(TARGET pyLIEF POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR} - ) -endif() - diff --git a/vendor/lief/api/python/DEX/CMakeLists.txt b/vendor/lief/api/python/DEX/CMakeLists.txt deleted file mode 100644 index 1b3a507..0000000 --- a/vendor/lief/api/python/DEX/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -set(LIEF_PYTHON_DEX_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyDEX.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyEnums.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyUtils.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyFile.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyClass.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyField.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyMethod.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyCodeInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyMapList.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyMapItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyType.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyPrototype.cpp" -) - -set(LIEF_PYTHON_DEX_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyDEX.hpp") - -source_group("Source Files\\DEX" FILES ${LIEF_PYTHON_DEX_SRC}) -source_group("Header Files\\DEX" FILES ${LIEF_PYTHON_DEX_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_DEX_SRC}" "${LIEF_PYTHON_DEX_HDR}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/../") - - diff --git a/vendor/lief/api/python/DEX/objects/pyClass.cpp b/vendor/lief/api/python/DEX/objects/pyClass.cpp deleted file mode 100644 index c736ecf..0000000 --- a/vendor/lief/api/python/DEX/objects/pyClass.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/Class.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyIterators.hpp" -#include "pyDEX.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (Class::*)(void) const; - -template -using no_const_getter_t = T (Class::*)(void); - -template -using setter_t = void (Class::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ cls(m, "Class", "DEX Class representation"); - - init_ref_iterator(cls, "it_methods"); - init_ref_iterator(cls, "it_fields"); - - init_ref_iterator(cls, "it_named_methods"); - init_ref_iterator(cls, "it_named_fields"); - - cls - .def_property_readonly("fullname", - &Class::fullname, - "Mangled class name (e.g. ``Lcom/example/android/MyActivity;``)") - - .def_property_readonly("pretty_name", - &Class::pretty_name, - "Demangled class name (e.g. ``com.example.android.MyActivity``)") - - .def_property_readonly("name", - &Class::name, - "Class name (e.g. ``MyActivity``)") - - .def_property_readonly("source_filename", - &Class::source_filename, - "Original filename") - - .def_property_readonly("package_name", - &Class::package_name, - "Package Name (e.g. ``com.example.android``)") - - .def_property_readonly("has_parent", - &Class::has_parent, - "True if the current class extends another one") - - .def_property_readonly("parent", - static_cast>(&Class::parent), - "" RST_CLASS_REF(lief.DEX.Class) " parent class") - - .def_property_readonly("methods", - static_cast>(&Class::methods), - "Iterator over " RST_CLASS_REF(lief.DEX.Method) " implemented in this class") - - .def("get_method", - static_cast(&Class::methods), - "Iterator over " RST_CLASS_REF(lief.DEX.Method) " (s) having the given name", - "name"_a) - - .def_property_readonly("fields", - static_cast>(&Class::fields), - "Iterator over " RST_CLASS_REF(lief.DEX.Field) " in this class") - - .def("get_field", - static_cast(&Class::fields), - "Iterator over " RST_CLASS_REF(lief.DEX.Field) " (s) having the given name", - "name"_a) - - .def_property_readonly("access_flags", - static_cast>(&Class::access_flags), - "List of " RST_CLASS_REF(lief.DEX.ACCESS_FLAGS) "") - - .def_property_readonly("dex2dex_info", - &Class::dex2dex_info, - "De-optimize information") - - .def_property_readonly("index", - &Class::index, - "Original index in the DEX class pool") - - .def("has", - static_cast(&Class::has), - "Check if the given " RST_CLASS_REF(lief.DEX.ACCESS_FLAGS) " is present", - "flag"_a) - - - .def("__eq__", &Class::operator==) - .def("__ne__", &Class::operator!=) - .def("__hash__", - [] (const Class& cls) { - return Hash::hash(cls); - }) - - .def("__str__", - [] (const Class& cls) { - std::ostringstream stream; - stream << cls; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyCodeInfo.cpp b/vendor/lief/api/python/DEX/objects/pyCodeInfo.cpp deleted file mode 100644 index d5740e5..0000000 --- a/vendor/lief/api/python/DEX/objects/pyCodeInfo.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/CodeInfo.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyDEX.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (CodeInfo::*)(void) const; - -template -using no_const_getter_t = T (CodeInfo::*)(void); - -template -using setter_t = void (CodeInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "CodeInfo", "DEX CodeInfo representation") - - .def("__eq__", &CodeInfo::operator==) - .def("__ne__", &CodeInfo::operator!=) - .def("__hash__", - [] (const CodeInfo& cinfo) { - return Hash::hash(cinfo); - }) - - .def("__str__", - [] (const CodeInfo& cinfo) { - std::ostringstream stream; - stream << cinfo; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyField.cpp b/vendor/lief/api/python/DEX/objects/pyField.cpp deleted file mode 100644 index 6d64ece..0000000 --- a/vendor/lief/api/python/DEX/objects/pyField.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "LIEF/DEX/Field.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyDEX.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (Field::*)(void) const; - -template -using no_const_getter_t = T (Field::*)(void); - -template -using setter_t = void (Field::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "Field", "DEX Field representation") - .def_property_readonly("name", - &Field::name, - "Field's name") - - .def_property_readonly("index", - &Field::index, - "Original DEX file index of the field") - - .def_property_readonly("has_class", - &Field::has_class, - "True if a class is associated with this field") - - .def_property_readonly("cls", - static_cast>(&Field::cls), - "" RST_CLASS_REF(lief.DEX.Class) " associated with this field") - - .def_property_readonly("is_static", - &Field::is_static, - "True if the field is static") - - .def_property_readonly("type", - static_cast>(&Field::type), - "" RST_CLASS_REF(lief.DEX.Type) " of this field", py::return_value_policy::reference) - - .def_property_readonly("access_flags", - static_cast>(&Field::access_flags), - "List of " RST_CLASS_REF(lief.DEX.ACCESS_FLAGS) "") - - .def("has", - static_cast(&Field::has), - "Check if the given " RST_CLASS_REF(lief.DEX.ACCESS_FLAGS) " is present", - "flag"_a) - - .def("__eq__", &Field::operator==) - .def("__ne__", &Field::operator!=) - .def("__hash__", - [] (const Field& fld) { - return Hash::hash(fld); - }) - - .def("__str__", - [] (const Field& fld) { - std::ostringstream stream; - stream << fld; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyFile.cpp b/vendor/lief/api/python/DEX/objects/pyFile.cpp deleted file mode 100644 index 03cdb0a..0000000 --- a/vendor/lief/api/python/DEX/objects/pyFile.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/File.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyIterators.hpp" -#include "pyDEX.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (File::*)(void) const; - -template -using no_const_getter_t = T (File::*)(void); - -template -using setter_t = void (File::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ file(m, "File", "DEX File representation"); - - init_ref_iterator(file, "it_classes"); - init_ref_iterator(file, "it_methods"); - init_ref_iterator(file, "it_strings"); - init_ref_iterator(file, "it_types"); - init_ref_iterator(file, "it_prototypes"); - init_ref_iterator(file, "it_fields"); - - file - .def_property_readonly("version", - &File::version, - "Dex version") - - .def_property_readonly("header", - static_cast>(&File::header), - "Dex File " RST_CLASS_REF(lief.DEX.Header) "", - py::return_value_policy::reference) - - .def_property_readonly("classes", - static_cast>(&File::classes), - "Iterator over Dex " RST_CLASS_REF(lief.DEX.Class) "") - - .def("has_class", - &File::has_class, - "Check if a class with a name given in parameter exists", - "classname"_a) - - .def("get_class", - static_cast(&File::get_class), - "classname"_a, - py::return_value_policy::reference) - - .def("get_class", - static_cast(&File::get_class), - "classname"_a, - py::return_value_policy::reference) - - .def_property_readonly("methods", - static_cast>(&File::methods), - "Iterator over Dex " RST_CLASS_REF(lief.DEX.Method) "") - - .def_property_readonly("fields", - static_cast>(&File::fields), - "Iterator over Dex " RST_CLASS_REF(lief.DEX.Field) "") - - .def_property_readonly("strings", - static_cast>(&File::strings), - "Iterator over Dex strings") - - .def_property_readonly("types", - static_cast>(&File::types), - "Iterator over Dex " RST_CLASS_REF(lief.DEX.Type) "") - - .def_property_readonly("prototypes", - static_cast>(&File::prototypes), - "Iterator over Dex " RST_CLASS_REF(lief.DEX.Prototype) "") - - .def_property_readonly("map", - static_cast>(&File::map), - "Dex " RST_CLASS_REF(lief.DEX.MapList) "") - - .def("raw", - &File::raw, - "Original raw file", - "deoptimize"_a = true) - - .def_property("name", - static_cast>(&File::name), - static_cast>(&File::name), - "Name of the dex file") - - .def_property("location", - static_cast>(&File::location), - static_cast>(&File::location), - "Original location of the dex file") - - //.def_property_readonly("dex2dex_info", - // &File::dex2dex_info) - - .def_property_readonly("dex2dex_json_info", - &File::dex2dex_json_info) - - .def("save", - &File::save, - "Save the **original** file into the file given in first parameter", - "output"_a = "", "deoptimize"_a = true) - - .def("__eq__", &File::operator==) - .def("__ne__", &File::operator!=) - .def("__hash__", - [] (const File& file) { - return Hash::hash(file); - }) - - .def("__str__", - [] (const File& file) { - std::ostringstream stream; - stream << file; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyHeader.cpp b/vendor/lief/api/python/DEX/objects/pyHeader.cpp deleted file mode 100644 index 9df26eb..0000000 --- a/vendor/lief/api/python/DEX/objects/pyHeader.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/Header.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyDEX.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - -template<> -void create
(py::module& m) { - - py::class_(m, "Header", "DEX Header") - - .def_property_readonly("magic", - static_cast>(&Header::magic), - "Magic value") - - .def_property_readonly("checksum", - static_cast>(&Header::checksum), - "Checksum value of the rest of the file (without " RST_ATTR_REF(lief.DEX.Header.magic) ")") - - .def_property_readonly("signature", - static_cast>(&Header::signature), - "SHA-1 signature of the rest of the file (without " RST_ATTR_REF(lief.DEX.Header.magic) " and " RST_ATTR_REF(lief.DEX.Header.checksum) ")") - - .def_property_readonly("file_size", - static_cast>(&Header::file_size), - "Size of the current DEX file") - - .def_property_readonly("header_size", - static_cast>(&Header::header_size), - "Size of this header. Should be ``0x70``") - - .def_property_readonly("endian_tag", - static_cast>(&Header::endian_tag), - "Endianness tag. Should be ``ENDIAN_CONSTANT``") - - .def_property_readonly("map_offset", - static_cast>(&Header::map), - "Offset from the start of the file to the map item") - - .def_property_readonly("strings", - static_cast>(&Header::strings), - "String identifiers") - - .def_property_readonly("link", - static_cast>(&Header::link), - "Link (raw data)") - - .def_property_readonly("types", - static_cast>(&Header::types), - "Type identifiers") - - .def_property_readonly("prototypes", - static_cast>(&Header::prototypes), - "Prototypes identifiers") - - .def_property_readonly("fields", - static_cast>(&Header::fields), - "Fields identifiers") - - .def_property_readonly("methods", - static_cast>(&Header::methods), - "Methods identifiers") - - .def_property_readonly("classes", - static_cast>(&Header::classes), - "Classess identifiers") - - .def_property_readonly("data", - static_cast>(&Header::data), - "Raw data. Should be align on 32-bits") - - .def_property_readonly("nb_classes", - static_cast>(&Header::nb_classes), - "Number of classes in the current DEX") - - .def_property_readonly("nb_methods", - static_cast>(&Header::nb_methods), - "Number of methods in the current DEX") - - .def("__eq__", &Header::operator==) - .def("__ne__", &Header::operator!=) - .def("__hash__", - [] (const Header& header) { - return Hash::hash(header); - }) - - .def("__str__", - [] (const Header& header) { - std::ostringstream stream; - stream << header; - return stream.str(); - }); - -} - -} -} - - diff --git a/vendor/lief/api/python/DEX/objects/pyMapItem.cpp b/vendor/lief/api/python/DEX/objects/pyMapItem.cpp deleted file mode 100644 index 0116a88..0000000 --- a/vendor/lief/api/python/DEX/objects/pyMapItem.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/MapItem.hpp" -#include "LIEF/DEX/hash.hpp" -#include "LIEF/DEX/EnumToString.hpp" - -#include "pyDEX.hpp" - -namespace LIEF { -namespace DEX { - -#define PY_ENUM(x) to_string(x), x - -template -using getter_t = T (MapItem::*)(void) const; - -template -using no_const_getter_t = T (MapItem::*)(void); - -template -using setter_t = void (MapItem::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ mapitem(m, "MapItem", "DEX MapItem representation"); - - py::enum_(mapitem, "TYPES") - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::HEADER)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::STRING_ID)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::TYPE_ID)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::PROTO_ID)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::FIELD_ID)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::METHOD_ID)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::CLASS_DEF)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::CALL_SITE_ID)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::METHOD_HANDLE)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::MAP_LIST)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::TYPE_LIST)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::ANNOTATION_SET_REF_LIST)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::ANNOTATION_SET)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::CLASS_DATA)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::CODE)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::STRING_DATA)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::DEBUG_INFO)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::ANNOTATION)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::ENCODED_ARRAY)) - .value(PY_ENUM(LIEF::DEX::MapItem::TYPES::ANNOTATIONS_DIRECTORY)); - - mapitem - .def_property_readonly("type", - static_cast>(&MapItem::type), - "" RST_CLASS_REF(lief.DEX.MapItem.TYPES) " of the item") - - .def_property_readonly("offset", - static_cast>(&MapItem::offset), - "Offset from the start of the file to the items in question") - - .def_property_readonly("size", - static_cast>(&MapItem::size), - "count of the number of items to be found at the indicated offset") - - .def("__eq__", &MapItem::operator==) - .def("__ne__", &MapItem::operator!=) - .def("__hash__", - [] (const MapItem& mlist) { - return Hash::hash(mlist); - }) - - .def("__str__", - [] (const MapItem& mlist) { - std::ostringstream stream; - stream << mlist; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyMapList.cpp b/vendor/lief/api/python/DEX/objects/pyMapList.cpp deleted file mode 100644 index 1dfc114..0000000 --- a/vendor/lief/api/python/DEX/objects/pyMapList.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/MapList.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyDEX.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (MapList::*)(void) const; - -template -using no_const_getter_t = T (MapList::*)(void); - -template -using setter_t = void (MapList::*)(T); - - -template<> -void create(py::module& m) { - - init_ref_iterator(m, "lief.DEX.MapList.it_items_t"); - - py::class_(m, "MapList", "DEX MapList representation") - .def_property_readonly("items", - static_cast>(&MapList::items), - "Iterator over " RST_CLASS_REF(lief.DEX.MapItem) "") - - .def("has", - &MapList::has, - "Check if the given " RST_CLASS_REF(lief.DEX.MapItem.TYPES) " is present", - "type"_a) - - .def("get", - static_cast(&MapList::get), - "Return the " RST_CLASS_REF(lief.DEX.MapItem.TYPES) " from " - "the given " RST_CLASS_REF(lief.DEX.MapItem.TYPES) "", - "type"_a, - py::return_value_policy::reference) - - .def("__getitem__", - static_cast(&MapList::get)) - - .def("__eq__", &MapList::operator==) - .def("__ne__", &MapList::operator!=) - .def("__hash__", - [] (const MapList& mlist) { - return Hash::hash(mlist); - }) - - .def("__str__", - [] (const MapList& mlist) { - std::ostringstream stream; - stream << mlist; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyMethod.cpp b/vendor/lief/api/python/DEX/objects/pyMethod.cpp deleted file mode 100644 index 2811747..0000000 --- a/vendor/lief/api/python/DEX/objects/pyMethod.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/Method.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyDEX.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (Method::*)(void) const; - -template -using no_const_getter_t = T (Method::*)(void); - -template -using setter_t = void (Method::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "Method", "DEX Method representation") - .def_property_readonly("name", - &Method::name, - "Method's name") - - .def_property_readonly("index", - &Method::index, - "Original DEX file index of the method") - - .def_property_readonly("has_class", - &Method::has_class, - "True if a class is associated with this method") - - .def_property_readonly("cls", - static_cast>(&Method::cls), - "" RST_CLASS_REF(lief.DEX.Class) " associated with this method") - - .def_property_readonly("code_offset", - static_cast>(&Method::code_offset), - "Offset to the Dalvik Bytecode") - - .def_property_readonly("bytecode", - static_cast>(&Method::bytecode), - "Dalvik Bytecode as a list of bytes") - - .def_property_readonly("is_virtual", - &Method::is_virtual, - "True if the method is a virtual (not **private**, **static**, **final**, **constructor**)") - - .def_property_readonly("prototype", - static_cast>(&Method::prototype), - "" RST_CLASS_REF(lief.DEX.Prototype) " of this method") - - .def_property_readonly("access_flags", - static_cast>(&Method::access_flags), - "List of " RST_CLASS_REF(lief.DEX.ACCESS_FLAGS) "") - - .def("has", - static_cast(&Method::has), - "Check if the given " RST_CLASS_REF(lief.DEX.ACCESS_FLAGS) " is present", - "flag"_a) - - .def("insert_dex2dex_info", - &Method::insert_dex2dex_info, - "Insert de-optimization information", - "pc"_a, "index"_a) - - .def("__eq__", &Method::operator==) - .def("__ne__", &Method::operator!=) - .def("__hash__", - [] (const Method& cls) { - return Hash::hash(cls); - }) - - .def("__str__", - [] (const Method& cls) { - std::ostringstream stream; - stream << cls; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyParser.cpp b/vendor/lief/api/python/DEX/objects/pyParser.cpp deleted file mode 100644 index 7f360ce..0000000 --- a/vendor/lief/api/python/DEX/objects/pyParser.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyDEX.hpp" - -#include "LIEF/DEX/Parser.hpp" - -#include - -namespace LIEF { -namespace DEX { - -template<> -void create(py::module& m) { - - m.def("parse", - static_cast (*) (const std::string&)>(&Parser::parse), - "Parse the given filename and return a " RST_CLASS_REF(lief.DEX.File) " object", - "filename"_a, - py::return_value_policy::take_ownership); - - m.def("parse", - static_cast(*)(std::vector, const std::string&)>(&Parser::parse), - "Parse the given raw data and return a " RST_CLASS_REF(lief.DEX.File) " object", - "raw"_a, "name"_a = "", - py::return_value_policy::take_ownership); - - - m.def("parse", - [] (py::object byteio, const std::string& name) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str))}; - - return LIEF::DEX::Parser::parse(std::move(raw), name); - }, - "io"_a, "name"_a = "", - py::return_value_policy::take_ownership); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyPrototype.cpp b/vendor/lief/api/python/DEX/objects/pyPrototype.cpp deleted file mode 100644 index ca47d91..0000000 --- a/vendor/lief/api/python/DEX/objects/pyPrototype.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/Prototype.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "pyDEX.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (Prototype::*)(void) const; - -template -using no_const_getter_t = T (Prototype::*)(void); - -template -using setter_t = void (Prototype::*)(T); - - -template<> -void create(py::module& m) { - - init_ref_iterator(m, "lief.DEX.Prototype.it_params"); - - py::class_(m, "Prototype", "DEX Prototype representation") - .def_property_readonly("return_type", - static_cast>(&Prototype::return_type), - "" RST_CLASS_REF(lief.DEX.Type) " returned", - py::return_value_policy::reference) - - .def_property_readonly("parameters_type", - static_cast>(&Prototype::parameters_type), - "Iterator over parameters " RST_CLASS_REF(lief.DEX.Type) "") - - .def("__eq__", &Prototype::operator==) - .def("__ne__", &Prototype::operator!=) - .def("__hash__", - [] (const Prototype& ptype) { - return Hash::hash(ptype); - }) - - .def("__str__", - [] (const Prototype& ptype) { - std::ostringstream stream; - stream << ptype; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/objects/pyType.cpp b/vendor/lief/api/python/DEX/objects/pyType.cpp deleted file mode 100644 index 1247c24..0000000 --- a/vendor/lief/api/python/DEX/objects/pyType.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/DEX/Type.hpp" -#include "LIEF/DEX/hash.hpp" - -#include "LIEF/DEX/EnumToString.hpp" - -#include "pyDEX.hpp" - -#define PY_ENUM(x) to_string(x), x - -namespace LIEF { -namespace DEX { - -template -using getter_t = T (Type::*)(void) const; - -template -using no_const_getter_t = T (Type::*)(void); - -template -using setter_t = void (Type::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ pytype(m, "Type", "DEX Type representation"); - - py::enum_(pytype, "TYPES") - .value(PY_ENUM(Type::TYPES::UNKNOWN)) - .value(PY_ENUM(Type::TYPES::ARRAY)) - .value(PY_ENUM(Type::TYPES::PRIMITIVE)) - .value(PY_ENUM(Type::TYPES::CLASS)); - - py::enum_(pytype, "PRIMITIVES") - .value(PY_ENUM(Type::PRIMITIVES::VOID_T)) - .value(PY_ENUM(Type::PRIMITIVES::BOOLEAN)) - .value(PY_ENUM(Type::PRIMITIVES::BYTE)) - .value(PY_ENUM(Type::PRIMITIVES::SHORT)) - .value(PY_ENUM(Type::PRIMITIVES::CHAR)) - .value(PY_ENUM(Type::PRIMITIVES::INT)) - .value(PY_ENUM(Type::PRIMITIVES::LONG)) - .value(PY_ENUM(Type::PRIMITIVES::FLOAT)) - .value(PY_ENUM(Type::PRIMITIVES::DOUBLE)); - - - pytype - .def_property_readonly("type", - &Type::type, - "" RST_CLASS_REF(lief.DEX.Type.TYPES) " of this object") - - .def_property_readonly("value", - [] (Type& type) -> py::object { - switch (type.type()) { - case Type::TYPES::ARRAY: - { - return py::cast(type.array()); - } - - case Type::TYPES::CLASS: - { - return py::cast(type.cls(), py::return_value_policy::reference); - } - - case Type::TYPES::PRIMITIVE: - { - return py::cast(type.primitive()); - } - - case Type::TYPES::UNKNOWN: - default: - { - return py::none{}; - } - } - }, - "Depending on the " RST_CLASS_REF(lief.DEX.Type.TYPES) ", return " - " " RST_CLASS_REF(lief.DEX.Class) " or " RST_CLASS_REF(lief.DEX.Type.PRIMITIVES) " or array", - py::return_value_policy::reference) - - .def_property_readonly("dim", - &Type::dim, - "If the current type is an array, return its dimension otherwise 0") - - .def_property_readonly("underlying_array_type", - static_cast>(&Type::underlying_array_type), - "Underlying type of the array", - py::return_value_policy::reference) - - .def_static("pretty_name", - &Type::pretty_name, - "Pretty name of primitives", - "primitive"_a) - - .def("__eq__", &Type::operator==) - .def("__ne__", &Type::operator!=) - .def("__hash__", - [] (const Type& type) { - return Hash::hash(type); - }) - - .def("__str__", - [] (const Type& type) { - std::ostringstream stream; - stream << type; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/DEX/pyDEX.cpp b/vendor/lief/api/python/DEX/pyDEX.cpp deleted file mode 100644 index 8016053..0000000 --- a/vendor/lief/api/python/DEX/pyDEX.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyDEX.hpp" - - -namespace LIEF { -namespace DEX { -void init_python_module(py::module& m) { - py::module LIEF_DEX_module = m.def_submodule("DEX", "Python API for DEX format"); - - init_enums(LIEF_DEX_module); - init_objects(LIEF_DEX_module); - init_utils(LIEF_DEX_module); -} - - -void init_objects(py::module& m) { - CREATE(Parser, m); - CREATE(File, m); - CREATE(Header, m); - CREATE(Class, m); - CREATE(Method, m); - CREATE(Field, m); - CREATE(Prototype, m); - CREATE(Type, m); - CREATE(MapList, m); - CREATE(MapItem, m); - CREATE(CodeInfo, m); -} - -} -} diff --git a/vendor/lief/api/python/DEX/pyDEX.hpp b/vendor/lief/api/python/DEX/pyDEX.hpp deleted file mode 100644 index b742e97..0000000 --- a/vendor/lief/api/python/DEX/pyDEX.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_DEX_H_ -#define PY_LIEF_DEX_H_ - -#include "LIEF/DEX.hpp" - -#include "pyLIEF.hpp" - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - - -namespace LIEF { -namespace DEX { - -template -void create(py::module&); - -void init_python_module(py::module& m); - -void init_objects(py::module&); - -void init_enums(py::module&); - -void init_utils(py::module&); - - -SPECIALIZE_CREATE(Parser); -SPECIALIZE_CREATE(File); -SPECIALIZE_CREATE(Header); -SPECIALIZE_CREATE(Class); -SPECIALIZE_CREATE(Method); -SPECIALIZE_CREATE(Field); -SPECIALIZE_CREATE(Prototype); -SPECIALIZE_CREATE(Type); -SPECIALIZE_CREATE(MapList); -SPECIALIZE_CREATE(MapItem); -SPECIALIZE_CREATE(CodeInfo); - -} -} - - -#endif diff --git a/vendor/lief/api/python/DEX/pyEnums.cpp b/vendor/lief/api/python/DEX/pyEnums.cpp deleted file mode 100644 index 30f332f..0000000 --- a/vendor/lief/api/python/DEX/pyEnums.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyDEX.hpp" -#include "LIEF/DEX/enums.hpp" -#include "LIEF/DEX/EnumToString.hpp" - -#define PY_ENUM(x) to_string(x), x - -namespace LIEF { -namespace DEX { -void init_enums(py::module& m) { - - py::enum_(m, "ACCESS_FLAGS") - .value(PY_ENUM(ACCESS_FLAGS::ACC_UNKNOWN)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_PUBLIC)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_PRIVATE)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_PROTECTED)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_STATIC)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_FINAL)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_SYNCHRONIZED)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_VOLATILE)) - .value("BRIDGE", ACCESS_FLAGS::ACC_BRIDGE) - .value("TRANSIENT", ACCESS_FLAGS::ACC_TRANSIENT) - .value(PY_ENUM(ACCESS_FLAGS::ACC_VARARGS)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_NATIVE)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_INTERFACE)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_ABSTRACT)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_STRICT)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_SYNTHETIC)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_ANNOTATION)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_ENUM)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_CONSTRUCTOR)) - .value(PY_ENUM(ACCESS_FLAGS::ACC_DECLARED_SYNCHRONIZED)); - -} -} -} diff --git a/vendor/lief/api/python/DEX/pyUtils.cpp b/vendor/lief/api/python/DEX/pyUtils.cpp deleted file mode 100644 index 997d75d..0000000 --- a/vendor/lief/api/python/DEX/pyUtils.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyDEX.hpp" - -#include "LIEF/DEX/utils.hpp" - -namespace LIEF { -namespace DEX { - -void init_utils(py::module& m) { - - m.def("is_dex", - static_cast(&is_dex), - "Check if the **file** given in parameter is a DEX", - "path"_a); - - m.def("is_dex", - static_cast&)>(&is_dex), - "Check if the **raw data** given in parameter is a DEX", - "raw"_a); - - m.def("version", - static_cast(&version), - "Return the DEX version of the **file** given in parameter", - "file"_a); - - m.def("version", - static_cast&)>(&version), - "Return the DEX version of the **raw data** given in parameter", - "raw"_a); - -} - -} -} - diff --git a/vendor/lief/api/python/ELF/CMakeLists.txt b/vendor/lief/api/python/ELF/CMakeLists.txt deleted file mode 100644 index bdf609c..0000000 --- a/vendor/lief/api/python/ELF/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -set(LIEF_PYTHON_ELF_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyELF.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbolVersionAuxRequirement.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbolVersion.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicEntryRunPath.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbolVersionRequirement.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBinary.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbolVersionDefinition.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbolVersionAux.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicEntryArray.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicEntryFlags.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySegment.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySection.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicEntryRpath.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocation.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicSharedObject.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicEntryLibrary.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbol.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyGnuHash.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySysvHash.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBuilder.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyEnums.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pySizes.cpp" -) - -set(LIEF_PYTHON_ELF_NOTE - "${CMAKE_CURRENT_LIST_DIR}/objects/pyNote.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyNoteDetails.cpp" -) - -list(APPEND LIEF_PYTHON_ELF_SRC ${LIEF_PYTHON_ELF_NOTE}) - -include("${CMAKE_CURRENT_LIST_DIR}/objects/NoteDetails/CMakeLists.txt") - -set(LIEF_PYTHON_ELF_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyELF.hpp") - -source_group("Source Files\\ELF" FILES ${LIEF_PYTHON_ELF_SRC}) -source_group("Header Files\\ELF" FILES ${LIEF_PYTHON_ELF_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_ELF_SRC}" "${LIEF_PYTHON_ELF_HDR}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}") - - diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/CMakeLists.txt b/vendor/lief/api/python/ELF/objects/NoteDetails/CMakeLists.txt deleted file mode 100644 index 2f6b234..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(LIEF_PYTHON_ELF_NOTE_DETAILS_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyAndroidNote.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyNoteAbi.cpp" -) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_ELF_NOTE_DETAILS_SRC}") - -include("${CMAKE_CURRENT_LIST_DIR}/core/CMakeLists.txt") - - - diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/core/CMakeLists.txt b/vendor/lief/api/python/ELF/objects/NoteDetails/core/CMakeLists.txt deleted file mode 100644 index 6040dae..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/core/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(LIEF_PYTHON_ELF_NOTE_DETAILS_CORE - "${CMAKE_CURRENT_LIST_DIR}/pyCorePrPsInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyCoreFile.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyCoreFileEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyCorePrStatus.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyCoreAuxv.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyCoreSigInfo.cpp" -) -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_ELF_NOTE_DETAILS_CORE}") - - - diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreAuxv.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreAuxv.cpp deleted file mode 100644 index a3a1bb6..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreAuxv.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails/core/CoreAuxv.hpp" - -#include "LIEF/ELF/EnumToString.hpp" - -#include "enums_wrapper.hpp" - -#define PY_ENUM(x) LIEF::ELF::to_string(x), x - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (CoreAuxv::*)(void) const; - -template -using setter_t = void (CoreAuxv::*)(T); - -template<> -void create(py::module& m) { - - py::class_ cls(m, "CoreAuxv"); - - cls - .def_property("values", - static_cast>(&CoreAuxv::values), - static_cast>(&CoreAuxv::values), - "Current values as a dictionarry for which keys are AUXV types") - - .def("get", - [] (const CoreAuxv& status, AUX_TYPE atype) -> py::object { - bool error; - uint64_t val = status.get(atype, &error); - if (error) { - return py::none(); - } - return py::int_(val); - }, - "Return the type value", - "type"_a) - - .def("set", - &CoreAuxv::set, - "Set type value", - "type"_a, "value"_a) - - .def("has", - &CoreAuxv::has, - "Check if a value is associated with the given type", - "type"_a) - - .def("__getitem__", - &CoreAuxv::operator[], - "", - py::return_value_policy::copy) - - .def("__setitem__", - [] (CoreAuxv& status, AUX_TYPE atype, uint64_t val) { - status.set(atype, val); - }, - "") - - .def("__contains__", - &CoreAuxv::has, - "") - - .def("__eq__", &CoreAuxv::operator==) - .def("__ne__", &CoreAuxv::operator!=) - .def("__hash__", - [] (const CoreAuxv& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const CoreAuxv& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); - - - LIEF::enum_(cls, "TYPES") - .value(PY_ENUM(AUX_TYPE::AT_NULL)) - .value(PY_ENUM(AUX_TYPE::AT_IGNORE)) - .value(PY_ENUM(AUX_TYPE::AT_EXECFD)) - .value(PY_ENUM(AUX_TYPE::AT_PHDR)) - .value(PY_ENUM(AUX_TYPE::AT_PHENT)) - .value(PY_ENUM(AUX_TYPE::AT_PHNUM)) - .value(PY_ENUM(AUX_TYPE::AT_PAGESZ)) - .value(PY_ENUM(AUX_TYPE::AT_BASE)) - .value(PY_ENUM(AUX_TYPE::AT_FLAGS)) - .value(PY_ENUM(AUX_TYPE::AT_ENTRY)) - .value(PY_ENUM(AUX_TYPE::AT_NOTELF)) - .value(PY_ENUM(AUX_TYPE::AT_UID)) - .value(PY_ENUM(AUX_TYPE::AT_EUID)) - .value(PY_ENUM(AUX_TYPE::AT_GID)) - .value(PY_ENUM(AUX_TYPE::AT_EGID)) - .value(PY_ENUM(AUX_TYPE::AT_CLKTCK)) - .value(PY_ENUM(AUX_TYPE::AT_PLATFORM)) - .value(PY_ENUM(AUX_TYPE::AT_HWCAP)) - .value(PY_ENUM(AUX_TYPE::AT_HWCAP2)) - .value(PY_ENUM(AUX_TYPE::AT_FPUCW)) - .value(PY_ENUM(AUX_TYPE::AT_DCACHEBSIZE)) - .value(PY_ENUM(AUX_TYPE::AT_ICACHEBSIZE)) - .value(PY_ENUM(AUX_TYPE::AT_UCACHEBSIZE)) - .value(PY_ENUM(AUX_TYPE::AT_IGNOREPPC)) - .value(PY_ENUM(AUX_TYPE::AT_SECURE)) - .value(PY_ENUM(AUX_TYPE::AT_BASE_PLATFORM)) - .value(PY_ENUM(AUX_TYPE::AT_RANDOM)) - .value(PY_ENUM(AUX_TYPE::AT_EXECFN)) - .value(PY_ENUM(AUX_TYPE::AT_SYSINFO)) - .value(PY_ENUM(AUX_TYPE::AT_SYSINFO_EHDR)) - .value(PY_ENUM(AUX_TYPE::AT_L1I_CACHESHAPE)) - .value(PY_ENUM(AUX_TYPE::AT_L1D_CACHESHAPE)); - - -} -} // namespace ELF -} // namespace LIEF diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreFile.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreFile.cpp deleted file mode 100644 index e0ac513..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreFile.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails/core/CoreFile.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (CoreFile::*)(void) const; - -template -using setter_t = void (CoreFile::*)(T); - -template<> -void create(py::module& m) { - - py::bind_vector(m, "CoreFile.files_t"); - - py::class_(m, "CoreFile") - - .def_property("files", - static_cast>(&CoreFile::files), - static_cast>(&CoreFile::files), - "List of files mapped in core. (list of " RST_CLASS_REF(lief.ELF.CoreFileEntry) ")") - - .def("__len__", - &CoreFile::count, - "Number of files mapped in core" - ) - - .def("__iter__", - [] (const CoreFile& f) { - return py::make_iterator(std::begin(f), std::end(f)); - }, - py::keep_alive<0, 1>()) - - .def("__eq__", &CoreFile::operator==) - .def("__ne__", &CoreFile::operator!=) - .def("__hash__", - [] (const CoreFile& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const CoreFile& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreFileEntry.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreFileEntry.cpp deleted file mode 100644 index 74d9d49..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreFileEntry.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include - -#include "pyELF.hpp" -#include "LIEF/ELF/NoteDetails/core/CoreFile.hpp" - -namespace LIEF { -namespace ELF { - -template<> -void create(py::module& m) { - - py::class_(m, "CoreFileEntry") - - .def_readwrite("start", &CoreFileEntry::start, - "Start address of mapped file") - - .def_readwrite("end", &CoreFileEntry::end, - "End address of mapped file") - - .def_readwrite("file_ofs", &CoreFileEntry::file_ofs, - "Offset (in core) of mapped file") - - .def_readwrite("path", &CoreFileEntry::path, - "Path of mapped file") - - - .def("__str__", - [] (const CoreFileEntry& entry) - { - std::ostringstream stream; - stream << entry; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCorePrPsInfo.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCorePrPsInfo.cpp deleted file mode 100644 index bcd9bea..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCorePrPsInfo.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails/core/CorePrPsInfo.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (CorePrPsInfo::*)(void) const; - -template -using setter_t = void (CorePrPsInfo::*)(T); - -template<> -void create(py::module& m) { - - py::class_(m, "CorePrPsInfo") - - .def_property("file_name", - static_cast>(&CorePrPsInfo::file_name), - static_cast>(&CorePrPsInfo::file_name), - "Process file name" - ) - - .def_property("flags", - static_cast>(&CorePrPsInfo::flags), - static_cast>(&CorePrPsInfo::flags), - "Process flags" - ) - - .def_property("uid", - static_cast>(&CorePrPsInfo::uid), - static_cast>(&CorePrPsInfo::uid), - "Process User ID" - ) - - .def_property("gid", - static_cast>(&CorePrPsInfo::gid), - static_cast>(&CorePrPsInfo::gid), - "Process Group ID" - ) - - .def_property("pid", - static_cast>(&CorePrPsInfo::pid), - static_cast>(&CorePrPsInfo::pid), - "Process ID" - ) - - .def_property("ppid", - static_cast>(&CorePrPsInfo::ppid), - static_cast>(&CorePrPsInfo::ppid), - "Process parent ID" - ) - - .def_property("pgrp", - static_cast>(&CorePrPsInfo::pgrp), - static_cast>(&CorePrPsInfo::pgrp), - "Process session group ID" - ) - - .def_property("sid", - static_cast>(&CorePrPsInfo::sid), - static_cast>(&CorePrPsInfo::sid), - "Process session ID" - ) - - .def("__eq__", &CorePrPsInfo::operator==) - .def("__ne__", &CorePrPsInfo::operator!=) - .def("__hash__", - [] (const CorePrPsInfo& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const CorePrPsInfo& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCorePrStatus.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCorePrStatus.cpp deleted file mode 100644 index 703417e..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCorePrStatus.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails/core/CorePrStatus.hpp" - -#include "LIEF/ELF/EnumToString.hpp" - -#include "enums_wrapper.hpp" - -#define PY_ENUM(x) LIEF::ELF::to_string(x), x - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (CorePrStatus::*)(void) const; - -template -using setter_t = void (CorePrStatus::*)(T); - -template<> -void create(py::module& m) { - - py::class_ cls(m, "CorePrStatus"); - - py::class_(cls, "timeval") - .def_readwrite("sec", &CorePrStatus::timeval_t::sec) - .def_readwrite("usec", &CorePrStatus::timeval_t::usec); - - py::class_(cls, "siginfo") - .def_readwrite("sicode", &CorePrStatus::siginfo_t::si_code) - .def_readwrite("errno", &CorePrStatus::siginfo_t::si_errno) - .def_readwrite("signo", &CorePrStatus::siginfo_t::si_signo); - - cls - .def_property("siginfo", - static_cast>(&CorePrStatus::siginfo), - static_cast>(&CorePrStatus::siginfo), - "Info associated with the signal") - - .def_property("current_sig", - static_cast>(&CorePrStatus::current_sig), - static_cast>(&CorePrStatus::current_sig), - "Current Signal") - - .def_property("sigpend", - static_cast>(&CorePrStatus::sigpend), - static_cast>(&CorePrStatus::sigpend), - "Set of pending signals") - - .def_property("sighold", - static_cast>(&CorePrStatus::sighold), - static_cast>(&CorePrStatus::sighold), - "Set of held signals") - - .def_property("pid", - static_cast>(&CorePrStatus::pid), - static_cast>(&CorePrStatus::pid), - "Process ID") - - .def_property("ppid", - static_cast>(&CorePrStatus::ppid), - static_cast>(&CorePrStatus::ppid), - "Process parent ID") - - .def_property("pgrp", - static_cast>(&CorePrStatus::pgrp), - static_cast>(&CorePrStatus::pgrp), - "Process group ID") - - .def_property("sid", - static_cast>(&CorePrStatus::sid), - static_cast>(&CorePrStatus::sid), - "Process session ID") - - .def_property("utime", - static_cast>(&CorePrStatus::utime), - static_cast>(&CorePrStatus::utime), - "User time (" RST_CLASS_REF(lief.ELF.CorePrStatus.timeval) ")") - - .def_property("utime", - static_cast>(&CorePrStatus::utime), - static_cast>(&CorePrStatus::utime), - "User time (" RST_CLASS_REF(lief.ELF.CorePrStatus.timeval) ")") - - .def_property("stime", - static_cast>(&CorePrStatus::stime), - static_cast>(&CorePrStatus::stime), - "System time (" RST_CLASS_REF(lief.ELF.CorePrStatus.timeval) ")") - - .def_property("cutime", - static_cast>(&CorePrStatus::cutime), - static_cast>(&CorePrStatus::cutime), - "Cumulative user time (" RST_CLASS_REF(lief.ELF.CorePrStatus.timeval) ")") - - .def_property("cstime", - static_cast>(&CorePrStatus::cstime), - static_cast>(&CorePrStatus::cstime), - "Cumulative system time (" RST_CLASS_REF(lief.ELF.CorePrStatus.timeval) ")") - - .def_property("register_context", - static_cast>(&CorePrStatus::reg_context), - static_cast>(&CorePrStatus::reg_context), - "Current registers state as a dictionary where the keys are " - RST_CLASS_REF(lief.ELF.CorePrStatus.REGISTERS) " and the values the register's value") - - .def("get", - [] (const CorePrStatus& status, CorePrStatus::REGISTERS reg) -> py::object { - bool error; - uint64_t val = status.get(reg, &error); - if (error) { - return py::none(); - } - return py::int_(val); - }, - "Return the register value", - "register"_a) - - .def("set", - &CorePrStatus::set, - "Set register value", - "register"_a, "value"_a) - - .def("has", - &CorePrStatus::has, - "Check if a value is associated with the given register", - "register"_a) - - .def("__getitem__", - &CorePrStatus::operator[], - "", - py::return_value_policy::copy) - - .def("__setitem__", - [] (CorePrStatus& status, CorePrStatus::REGISTERS reg, uint64_t val) { - status.set(reg, val); - }, - "") - - .def("__contains__", - &CorePrStatus::has, - "") - - .def("__eq__", &CorePrStatus::operator==) - .def("__ne__", &CorePrStatus::operator!=) - .def("__hash__", - [] (const CorePrStatus& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const CorePrStatus& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); - - - LIEF::enum_(cls, "REGISTERS") - .value(PY_ENUM(CorePrStatus::REGISTERS::UNKNOWN)) - - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_EBX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_ECX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_EDX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_ESI)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_EDI)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_EBP)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_EAX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_DS)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_ES)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_FS)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_GS)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86__)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_EIP)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_CS)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_EFLAGS)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_ESP)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_SS)) - - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R15)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R14)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R13)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R12)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RBP)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RBX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R11)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R10)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R9)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_R8)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RAX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RCX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RDX)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RSI)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RDI)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64__)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RIP)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_CS)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_EFLAGS)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_RSP)) - .value(PY_ENUM(CorePrStatus::REGISTERS::X86_64_SS)) - - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R0)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R1)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R2)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R3)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R4)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R5)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R6)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R7)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R8)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R9)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R10)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R11)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R12)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R13)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R14)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_R15)) - .value(PY_ENUM(CorePrStatus::REGISTERS::ARM_CPSR)) - - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X0)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X1)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X2)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X3)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X4)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X5)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X6)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X7)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X8)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X9)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X10)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X11)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X12)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X13)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X14)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X15)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X16)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X17)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X18)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X19)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X20)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X21)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X22)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X23)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X24)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X25)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X26)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X27)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X28)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X29)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X30)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_X31)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64_PC)) - .value(PY_ENUM(CorePrStatus::REGISTERS::AARCH64__)); - -} -} // namespace ELF -} // namespace LIEF diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreSigInfo.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreSigInfo.cpp deleted file mode 100644 index fb19666..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/core/pyCoreSigInfo.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails/core/CoreSigInfo.hpp" - - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (CoreSigInfo::*)(void) const; - -template -using setter_t = void (CoreSigInfo::*)(T); - -template<> -void create(py::module& m) { - - py::class_(m, "CoreSigInfo") - - .def_property("signo", - static_cast>(&CoreSigInfo::signo), - static_cast>(&CoreSigInfo::signo), - "Signal number") - - .def_property("sigcode", - static_cast>(&CoreSigInfo::sigcode), - static_cast>(&CoreSigInfo::sigcode), - "Signal code") - - .def_property("sigerrno", - static_cast>(&CoreSigInfo::sigerrno), - static_cast>(&CoreSigInfo::sigerrno), - "If non-zero, an errno value associated with this signal") - - .def("__eq__", &CoreSigInfo::operator==) - .def("__ne__", &CoreSigInfo::operator!=) - .def("__hash__", - [] (const CoreSigInfo& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const CoreSigInfo& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); - - -} -} // namespace ELF -} // namespace LIEF diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/pyAndroidNote.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/pyAndroidNote.cpp deleted file mode 100644 index 45838c8..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/pyAndroidNote.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails/AndroidNote.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (AndroidNote::*)(void) const; - -template -using setter_t = void (AndroidNote::*)(T); - -template<> -void create(py::module& m) { - - py::class_(m, "AndroidNote") - - .def_property("sdk_version", - static_cast>(&AndroidNote::sdk_version), - static_cast>(&AndroidNote::sdk_version), - "Target SDK platform" - ) - - .def_property("ndk_version", - static_cast>(&AndroidNote::ndk_version), - static_cast>(&AndroidNote::ndk_version), - "Android NDK version used to build the current binary" - ) - - .def_property("ndk_build_number", - static_cast>(&AndroidNote::ndk_build_number), - static_cast>(&AndroidNote::ndk_build_number), - "Android NDK build number" - ) - - .def("__eq__", &AndroidNote::operator==) - .def("__ne__", &AndroidNote::operator!=) - .def("__hash__", - [] (const AndroidNote& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const AndroidNote& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/NoteDetails/pyNoteAbi.cpp b/vendor/lief/api/python/ELF/objects/NoteDetails/pyNoteAbi.cpp deleted file mode 100644 index f7f8974..0000000 --- a/vendor/lief/api/python/ELF/objects/NoteDetails/pyNoteAbi.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails/NoteAbi.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (NoteAbi::*)(void) const; - -template -using setter_t = void (NoteAbi::*)(T); - -template<> -void create(py::module& m) { - - py::class_(m, "NoteAbi") - - .def_property_readonly("abi", - static_cast>(&NoteAbi::abi), - "Return the target " RST_CLASS_REF(lief.ELF.NOTE_ABIS) "" - ) - - .def_property_readonly("version", - static_cast>(&NoteAbi::version), - "Return the target version as ``(Major, Minor, Patch)``" - ) - - .def("__eq__", &NoteAbi::operator==) - .def("__ne__", &NoteAbi::operator!=) - .def("__hash__", - [] (const NoteAbi& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const NoteAbi& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyBinary.cpp b/vendor/lief/api/python/ELF/objects/pyBinary.cpp deleted file mode 100644 index 9556b80..0000000 --- a/vendor/lief/api/python/ELF/objects/pyBinary.cpp +++ /dev/null @@ -1,711 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include "pyIterators.hpp" -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/Binary.hpp" - -#include "pyErr.hpp" -#include "pyELF.hpp" - -namespace LIEF { -namespace ELF { - -template -using no_const_getter = T (Binary::*)(void); - -template -using no_const_func = T (Binary::*)(P); - -template -using getter_t = T (Binary::*)(void) const; - -template -using setter_t = void (Binary::*)(T); - - -template<> -void create(py::module& m) { - // Binary object - py::class_ bin(m, "Binary", R"delim( - Class which represents an ELF binary - )delim"); - - init_ref_iterator(bin, "it_notes"); - init_ref_iterator(bin, "it_symbols_version_requirement"); - init_ref_iterator(bin, "it_symbols_version_definition"); - init_ref_iterator(bin, "it_segments"); - init_ref_iterator(bin, "it_sections"); - init_ref_iterator(bin, "it_dynamic_entries"); - init_ref_iterator(bin, "it_symbols_version"); - // We don't need to register it_object_relocations, it_dynamic_relocations - // as it it the same underlying type - init_ref_iterator(bin, "it_filter_relocation"); - init_ref_iterator(bin, "it_relocations"); - - init_ref_iterator(bin, "it_dyn_static_symbols"); - init_ref_iterator(bin, "it_symbols"); // For it_dynamic_symbols / it_static_symbols - init_ref_iterator(bin, "it_filter_symbols"); // For it_imported_symbols - - - - - bin - .def_property_readonly("type", - &Binary::type, - "Return the binary's " RST_CLASS_REF(lief.ELF.ELF_CLASS) "") - - .def_property_readonly("header", - static_cast>(&Binary::header), - "Return " RST_CLASS_REF(lief.ELF.Header) " object", - py::return_value_policy::reference_internal) - - .def_property_readonly("sections", - static_cast>(&Binary::sections), - "Return an iterator over binary's " RST_CLASS_REF(lief.ELF.Section) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("segments", - static_cast>(&Binary::segments), - "Return an iterator to binary's " RST_CLASS_REF(lief.ELF.Segment) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("dynamic_entries", - static_cast>(&Binary::dynamic_entries), - "Return an iterator to " RST_CLASS_REF(lief.ELF.DynamicEntry) " entries as a list", - py::return_value_policy::reference_internal) - - .def("add", - static_cast(&Binary::add), - "Add a new " RST_CLASS_REF(lief.ELF.DynamicEntry) " in the binary", - "dynamic_entry", - py::return_value_policy::reference) - - .def_property_readonly("static_symbols", - static_cast>(&Binary::static_symbols), - "Return an iterator to static " RST_CLASS_REF(lief.ELF.Symbol) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("dynamic_symbols", - static_cast>(&Binary::dynamic_symbols), - "Return an iterator to dynamic " RST_CLASS_REF(lief.ELF.Symbol) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("symbols", - static_cast>(&Binary::symbols), - "Return an iterator over both **static** and **dynamic** " RST_CLASS_REF(lief.ELF.Symbol) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("exported_symbols", - static_cast>(&Binary::exported_symbols), - "Return dynamic " RST_CLASS_REF(lief.ELF.Symbol) " which are exported", - py::return_value_policy::reference_internal) - - .def_property_readonly("imported_symbols", - static_cast>(&Binary::imported_symbols), - "Return dynamic " RST_CLASS_REF(lief.ELF.Symbol) " which are imported", - py::return_value_policy::reference_internal) - - .def_property_readonly("dynamic_relocations", - static_cast>(&Binary::dynamic_relocations), - "Return an iterator over dynamics " RST_CLASS_REF(lief.ELF.Relocation) "", - py::return_value_policy::reference_internal) - - .def("add_dynamic_relocation", - &Binary::add_dynamic_relocation, R"delim( - Add a new *dynamic* relocation. - - We consider a dynamic relocation as a relocation which is not plt-related. - - See: :meth:`lief.ELF.Binary.add_pltgot_relocation` - )delim", - "relocation"_a, - py::return_value_policy::reference) - - .def("add_pltgot_relocation", - &Binary::add_pltgot_relocation, R"delim( - Add a .plt.got relocation. This kind of relocation is usually - associated with a PLT stub that aims at resolving the underlying symbol. - - See: :meth:`lief.ELF.Binary.add_dynamic_relocation` - )delim", - "relocation"_a, - py::return_value_policy::reference) - - .def("add_object_relocation", - &Binary::add_object_relocation, - R"delim( - Add relocation for object file (.o) - - The first parameter is the section to add while the second parameter - is the :class:`~lief.ELF.Section` associated with the relocation. - - If there is an error, this function returns a nullptr. Otherwise, it returns - the relocation added.", - )delim", - "relocation"_a, "section"_a, - py::return_value_policy::reference) - - .def_property_readonly("pltgot_relocations", - static_cast>(&Binary::pltgot_relocations), - "Return an iterator over PLT/GOT " RST_CLASS_REF(lief.ELF.Relocation) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("object_relocations", - static_cast>(&Binary::object_relocations), - "Return an iterator over object " RST_CLASS_REF(lief.ELF.Relocation) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("relocations", - static_cast>(&Binary::relocations), - "Return an iterator over **all** " RST_CLASS_REF(lief.ELF.Relocation) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("symbols_version", - static_cast>(&Binary::symbols_version), - "Return an iterator " RST_CLASS_REF(lief.ELF.SymbolVersion) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("symbols_version_requirement", - static_cast>(&Binary::symbols_version_requirement), - "Return an iterator to " RST_CLASS_REF(lief.ELF.SymbolVersionRequirement) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("symbols_version_definition", - static_cast>(&Binary::symbols_version_definition), - "Return an iterator to " RST_CLASS_REF(lief.ELF.SymbolVersionDefinition) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("use_gnu_hash", - &Binary::use_gnu_hash, - "``True`` if GNU hash is used") - - .def_property_readonly("gnu_hash", - &Binary::gnu_hash, - "Return the " RST_CLASS_REF(lief.ELF.GnuHash) " object\n\n" - "Hash are used by the loader to speed up symbols resolution (GNU Version)", - py::return_value_policy::reference_internal) - - .def_property_readonly("use_sysv_hash", - &Binary::use_sysv_hash, - "``True`` if SYSV hash is used") - - .def_property_readonly("sysv_hash", - &Binary::sysv_hash, - "Return the " RST_CLASS_REF(lief.ELF.SysvHash) " object\n\n" - "Hash are used by the loader to speed up symbols resolution (SYSV version)", - py::return_value_policy::reference_internal) - - .def_property_readonly("imagebase", - &Binary::imagebase, - "Return the program image base. (e.g. ``0x400000``)") - - .def_property_readonly("virtual_size", - &Binary::virtual_size, - "Return the size of the mapped binary") - - .def_property_readonly("is_pie", - &Binary::is_pie, - R"delim( - Check if the binary has been compiled with `-fpie -pie` flags - - To do so we check if there is a `PT_INTERP` segment and if - the binary type is `ET_DYN` (Shared object) - )delim") - - .def_property_readonly("has_interpreter", - &Binary::has_interpreter, - "Check if the binary uses a loader (also named linker or interpreter)") - - .def_property_readonly("functions", - &Binary::functions, - "List of the functions found the in the binary") - - .def_property("interpreter", - static_cast>(&Binary::interpreter), - static_cast>(&Binary::interpreter), - "ELF interpreter (loader) if any. (e.g. ``/lib64/ld-linux-x86-64.so.2``)") - - .def("section_from_offset", - static_cast(&Binary::section_from_offset), - R"delim( - Return the :class:`~lief.ELF.Section` which encompasses the given offset. - It returns None if a section can't be found. - - If ``skip_nobits`` is set (which is the case by default), this function won't - consider sections for which the type is ``SHT_NOBITS`` (like ``.bss, .tbss, ...``) - )delim", - "offset"_a, "skip_nobits"_a = true, - py::return_value_policy::reference) - - .def("section_from_virtual_address", - static_cast(&Binary::section_from_virtual_address), - R"delim( - Return the :class:`~lief.ELF.Section` which encompasses the given virtual address. - It returns None if a section can't be found. - - If ``skip_nobits`` is set (which is the case by default), this function won't - consider sections for which the type is ``SHT_NOBITS`` (like ``.bss, .tbss, ...``) - )delim", - "address"_a, "skip_nobits"_a = true, - py::return_value_policy::reference) - - .def("segment_from_virtual_address", - static_cast>(&Binary::segment_from_virtual_address), - R"delim( - Return the :class:`~lief.ELF.Segment` which encompasses the given virtual address. - It returns None if a segment can't be found. - )delim", - "address"_a, - py::return_value_policy::reference) - - .def("segment_from_offset", - static_cast>(&Binary::segment_from_offset), - R"delim( - Return the :class:`~lief.ELF.Segment` which encompasses the given offset. - It returns None if a segment can't be found. - )delim", - "offset"_a, - py::return_value_policy::reference) - - .def("get", - static_cast>(&Binary::get), - R"delim( - Return the first binary's :class:`~lief.ELF.DynamicEntry` from the given - :class:`~lief.ELF.DYNAMIC_TAGS`. - - It returns None if the dynamic entry can't be found. - )delim", - "tag"_a, - py::return_value_policy::reference) - - .def("get", - static_cast>(&Binary::get), - R"delim( - Return the first binary's :class:`~lief.ELF.Segment` from the given - :class:`~lief.ELF.SEGMENT_TYPES` - - It returns None if the segment can't be found. - )delim", - "type"_a, - py::return_value_policy::reference) - - .def("get", - static_cast>(&Binary::get), - R"delim( - Return the first binary's :class:`~lief.ELF.Note` from the given - :class:`~lief.ELF.NOTE_TYPES`. - - It returns None if the note can't be found. - )delim", - "type"_a, - py::return_value_policy::reference) - - .def("get", - static_cast>(&Binary::get), - R"delim( - Return the first binary's :class:`~lief.ELF.Section` from the given - :class:`~lief.ELF.ELF_SECTION_TYPES` - - It returns None if the section can't be found. - )delim", - "type"_a, - py::return_value_policy::reference) - - .def("has", - static_cast(&Binary::has), - R"delim( - Check if it exists a :class:`~lief.ELF.DynamicEntry` with the given - :class:`~lief.ELF.DYNAMIC_TAGS` - )delim", - "tag"_a) - - .def("has", - static_cast(&Binary::has), - "Check if a " RST_CLASS_REF(lief.ELF.Segment) " of *type* (" RST_CLASS_REF(lief.ELF.SEGMENT_TYPES) ") exists", - "type"_a) - - .def("has", - static_cast(&Binary::has), - "Check if a " RST_CLASS_REF(lief.ELF.Note) " of *type* (" RST_CLASS_REF(lief.ELF.NOTE_TYPES) ") exists", - "type"_a) - - .def("has", - static_cast(&Binary::has), - "Check if a " RST_CLASS_REF(lief.ELF.Section) " of *type* (" RST_CLASS_REF(lief.ELF.ECTION_TYPES) ") exists", - "type"_a) - - .def("patch_pltgot", - static_cast(&Binary::patch_pltgot), - "Patch the imported symbol's name with the ``address``", - "symbol_name"_a, "address"_a) - - .def("patch_pltgot", - static_cast(&Binary::patch_pltgot), - "Patch the imported " RST_CLASS_REF(lief.ELF.Symbol) " with the ``address``", - "symbol"_a, "address"_a) - - .def("has_section", - &Binary::has_section, - "Check if a " RST_CLASS_REF(lief.ELF.Section) " with the given name exists in the binary", - "section_name"_a) - - .def("has_section_with_offset", - &Binary::has_section_with_offset, - "Check if a " RST_CLASS_REF(lief.ELF.Section) " that encompasses the given offset exists", - "offset"_a) - - .def("has_section_with_va", - &Binary::has_section_with_va, - "Check if a " RST_CLASS_REF(lief.ELF.Section) " that encompasses the given virtual address exists", - "virtual_address"_a) - - .def("get_section", - static_cast>(&Binary::get_section), - R"delim( - Return the :class:`~lief.ELF.Section` with the given ``name`` - - It returns None if the section can't be found. - )delim", - "section_name"_a, - py::return_value_policy::reference) - - .def("add_static_symbol", - &Binary::add_static_symbol, - "Add a **static** " RST_CLASS_REF(lief.ELF.Symbol) " to the binary", - "symbol"_a, - py::return_value_policy::reference) - - .def("add_dynamic_symbol", - static_cast(&Binary::add_dynamic_symbol), - R"delim( - Add a **dynamic** :class:`~lief.ELF.Symbol` to the binary - - The function also takes an optional :class:`lief.ELF.SymbolVersion` - )delim", - "symbol"_a, "symbol_version"_a = nullptr, - py::return_value_policy::reference) - - .def("virtual_address_to_offset", - [] (const Binary& self, uint64_t address) { - return error_or(&Binary::virtual_address_to_offset, self, address); - }, - "Convert the virtual address to a file offset", - "virtual_address"_a) - - .def("add", - static_cast(&Binary::add), - R"delim( - Add the given :class:`~lief.ELF.Section` to the binary. - - If the section does not aim at being loaded in memory, - the ``loaded`` parameter has to be set to ``False`` (default: ``True``) - )delim", - "section"_a, "loaded"_a = true, - py::return_value_policy::reference) - - .def("add", - static_cast(&Binary::add), - "Add a new " RST_CLASS_REF(lief.ELF.Segment) " in the binary" - "segment"_a, "base"_a = 0, - py::return_value_policy::reference) - - .def("add", - static_cast(&Binary::add), - "Add a new " RST_CLASS_REF(lief.ELF.Note) " in the binary", - "note"_a, - py::return_value_policy::reference) - - .def("replace", - static_cast(&Binary::replace), - R"delim( - Replace the :class:`~lief.ELF.Segment` given in 2nd parameter with the - :class:`~lief.ELF.Segment` given in the first parameter and return the updated segment. - - .. warning:: - - The ``original_segment`` is no longer valid after this function - )delim", - "new_segment"_a, "original_segment"_a, "base"_a = 0, - py::return_value_policy::reference) - - .def("extend", - static_cast(&Binary::extend), - "Extend the given given " RST_CLASS_REF(lief.ELF.Segment) " by the given size", - "segment"_a, "size"_a, - py::return_value_policy::reference) - - .def("extend", - static_cast(&Binary::extend), - "Extend the given given " RST_CLASS_REF(lief.ELF.Section) " by the given size", - "segment"_a, "size"_a, - py::return_value_policy::reference) - - .def("remove", - static_cast(&Binary::remove), - "Remove the given " RST_CLASS_REF(lief.ELF.DynamicEntry) " from the dynamic table", - "dynamic_entry"_a) - - .def("remove", - static_cast(&Binary::remove), - "Remove **all** the " RST_CLASS_REF(lief.ELF.DynamicEntry) " with the given " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) "", - "tag"_a) - - .def("remove", - static_cast(&Binary::remove), - "Remove the given " RST_CLASS_REF(lief.ELF.Section) ". The ``clear`` parameter specifies whether or not " - "we must fill its content with ``0`` before removing", - "section"_a, "clear"_a = false) - - .def("remove", - static_cast(&Binary::remove), - "Remove the given " RST_CLASS_REF(lief.ELF.Note) "", - "note"_a) - - .def("remove", - static_cast(&Binary::remove), - "Remove **all** the " RST_CLASS_REF(lief.ELF.Note) " with the given " RST_CLASS_REF(lief.ELF.NOTE_TYPES) "", - "type"_a) - - .def_property_readonly("has_notes", - &Binary::has_notes, - "``True`` if the binary contains notes") - - .def_property_readonly("notes", - static_cast>(&Binary::notes), - "Return an iterator over the " RST_CLASS_REF(lief.ELF.Note) " entries", - py::return_value_policy::reference_internal) - - .def("strip", - &Binary::strip, - "Strip the binary") - - .def("permute_dynamic_symbols", - &Binary::permute_dynamic_symbols, - "Apply the given permutation on the dynamic symbols table", - "permutation"_a) - - .def("write", - static_cast(&Binary::write), - "Rebuild the binary and write it in a file", - "output"_a, - py::return_value_policy::reference_internal) - - .def_property_readonly("last_offset_section", - &Binary::last_offset_section, - "Return the last offset used in binary according to **sections table**") - - .def_property_readonly("last_offset_segment", - &Binary::last_offset_segment, - "Return the last offset used in binary according to **segments table**") - - .def_property_readonly("next_virtual_address", - &Binary::next_virtual_address, - "Return the next virtual address available") - - .def("add_library", - &Binary::add_library, - "Add a library with the given name as dependency", - "library_name"_a) - - .def("has_library", - &Binary::has_library, - "Check if the given library name exists in the current binary", - "library_name"_a) - - .def("remove_library", - &Binary::remove_library, - "Remove the given library", - "library_name"_a) - - .def("get_library", - static_cast>(&Binary::get_library), - R"delim( - Return the :class:`~lief.ELF.DynamicEntryLibrary` with the given ``name`` - - It returns None if the library can't be found. - )delim", - "library_name"_a, - py::return_value_policy::reference) - - .def("has_dynamic_symbol", - &Binary::has_dynamic_symbol, - "Check if the symbol with the given ``name`` exists in the **dynamic** symbol table", - "symbol_name"_a) - - .def("get_dynamic_symbol", - static_cast>(&Binary::get_dynamic_symbol), - R"delim( - Get the dynamic symbol from the given name. - - It returns None if it can't be found. - )delim", - "symbol_name"_a, - py::return_value_policy::reference) - - .def("has_static_symbol", - &Binary::has_static_symbol, - "Check if the symbol with the given ``name`` exists in the **static** symbol table", - "symbol_name"_a) - - .def("get_static_symbol", - static_cast>(&Binary::get_static_symbol), - R"delim( - Get the **static** symbol from the given ``name``. - - It returns None if it can't be found. - )delim", - "symbol_name"_a, - py::return_value_policy::reference) - - .def("get_strings", - static_cast(&Binary::strings), - "Return list of strings used in the current ELF file with a minimal size given in first parameter (Default: 5)\n" - "It looks for strings in the ``.roadata`` section", - "min_size"_a = 5, - py::return_value_policy::move) - - .def_property_readonly("strings", - [] (const Binary& bin) { - return bin.strings(); - }, - "Return list of strings used in the current ELF file.\n" - "Basically this function looks for strings in the ``.roadata`` section", - py::return_value_policy::move) - - .def("remove_static_symbol", - static_cast(&Binary::remove_static_symbol), - "Remove the given " RST_CLASS_REF(lief.ELF.Symbol) " from the ``.symtab`` section") - - .def("add_exported_function", - &Binary::add_exported_function, - "Create a symbol for the function at the given ``address`` and create an export", - "address"_a, "name"_a = "", - py::return_value_policy::reference) - - .def("export_symbol", - static_cast(&Binary::export_symbol), - "Export the given symbol and create an entry if it doesn't exist", - "symbol"_a, - py::return_value_policy::reference) - - .def("export_symbol", - static_cast(&Binary::export_symbol), - "Export the symbol with the given name and create an entry if it doesn't exist", - "symbol_name"_a, "value"_a = 0, - py::return_value_policy::reference) - - .def("get_relocation", - static_cast>(&Binary::get_relocation), - "Return the " RST_CLASS_REF(lief.ELF.Relocation) " associated with the given symbol name", - "symbol_name"_a, - py::return_value_policy::reference) - - .def("get_relocation", - static_cast>(&Binary::get_relocation), - "Return the " RST_CLASS_REF(lief.ELF.Relocation) " associated with the given " RST_CLASS_REF(lief.ELF.Symbol) "", - "symbol"_a, - py::return_value_policy::reference) - - .def("get_relocation", - static_cast>(&Binary::get_relocation), - "Return the " RST_CLASS_REF(lief.ELF.Relocation) " associated with the given address", - "address"_a, - py::return_value_policy::reference) - - .def_property_readonly("dtor_functions", - &Binary::dtor_functions, - "List of the binary destructors (typically, the functions located in the ``.fini_array``)") - - .def_property_readonly("eof_offset", - &Binary::eof_offset, - "Return the last offset used by the ELF binary according to both: the sections table " - "and the segments table.") - - .def_property_readonly("has_overlay", - &Binary::has_overlay, - "True if data are appended to the end of the binary") - - .def_property("overlay", - static_cast>(&Binary::overlay), - static_cast>(&Binary::overlay), - "Overlay data that are not a part of the ELF format") - - .def(py::self += Segment()) - .def(py::self += Section()) - .def(py::self += DynamicEntry()) - .def(py::self += Note()) - - .def(py::self -= DynamicEntry()) - .def(py::self -= DYNAMIC_TAGS()) - - .def(py::self -= Note()) - .def(py::self -= NOTE_TYPES()) - - .def("__eq__", &Binary::operator==) - .def("__ne__", &Binary::operator!=) - .def("__hash__", - [] (const Binary& binary) { - return Hash::hash(binary); - }) - - .def("__getitem__", - static_cast(&Binary::operator[]), - "", - py::return_value_policy::reference) - - .def("__getitem__", - static_cast(&Binary::operator[]), - "", - py::return_value_policy::reference) - - .def("__getitem__", - static_cast(&Binary::operator[]), - "", - py::return_value_policy::reference) - - - .def("__getitem__", - static_cast(&Binary::operator[]), - "", - py::return_value_policy::reference) - - .def("__contains__", - static_cast(&Binary::has), - "Check if a " RST_CLASS_REF(lief.ELF.Segment) " of *type* (" RST_CLASS_REF(lief.ELF.SEGMENT_TYPES) ") exists") - - .def("__contains__", - static_cast(&Binary::has), - "Check if the " RST_CLASS_REF(lief.ELF.DynamicEntry) " associated with the given " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " exists") - - .def("__contains__", - static_cast(&Binary::has), - "Check if the " RST_CLASS_REF(lief.ELF.Note) " associated with the given " RST_CLASS_REF(lief.ELF.NOTE_TYPES) " exists") - - .def("__contains__", - static_cast(&Binary::has), - "Check if the " RST_CLASS_REF(lief.ELF.Section) " associated with the given " RST_CLASS_REF(lief.ELF.SECTION_TYPES) " exists") - - .def("__str__", - [] (const Binary& binary) { - std::ostringstream stream; - stream << binary; - return stream.str(); - }); -} -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyBuilder.cpp b/vendor/lief/api/python/ELF/objects/pyBuilder.cpp deleted file mode 100644 index dd6f75e..0000000 --- a/vendor/lief/api/python/ELF/objects/pyBuilder.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "pyELF.hpp" - -#include "LIEF/ELF/Binary.hpp" -#include "LIEF/ELF/Builder.hpp" - -namespace LIEF { -namespace ELF { - -template<> -void create(py::module& m) { - py::class_ builder(m, "Builder", - R"delim( - Class which takes an :class:`lief.ELF.Binary` object and reconstructs a valid binary - )delim"); - - py::class_(builder, "config_t", - "Interface to tweak the " RST_CLASS_REF(lief.ELF.Builder) "") - .def(py::init<>()) - .def_readwrite("force_relocate", &Builder::config_t::force_relocate, - "Force to relocate all the ELF structures that can be relocated (mostly for testing)") - - .def_readwrite("dt_hash", &Builder::config_t::dt_hash) - .def_readwrite("dyn_str", &Builder::config_t::dyn_str) - .def_readwrite("dynamic_section", &Builder::config_t::dynamic_section) - .def_readwrite("fini_array", &Builder::config_t::fini_array) - .def_readwrite("init_array", &Builder::config_t::init_array) - .def_readwrite("interpreter", &Builder::config_t::interpreter) - .def_readwrite("jmprel", &Builder::config_t::jmprel) - .def_readwrite("notes", &Builder::config_t::notes) - .def_readwrite("preinit_array", &Builder::config_t::preinit_array) - .def_readwrite("rela", &Builder::config_t::rela) - .def_readwrite("static_symtab", &Builder::config_t::static_symtab) - .def_readwrite("sym_verdef", &Builder::config_t::sym_verdef) - .def_readwrite("sym_verneed", &Builder::config_t::sym_verneed) - .def_readwrite("sym_versym", &Builder::config_t::sym_versym) - .def_readwrite("symtab", &Builder::config_t::symtab); - - builder - .def(py::init(), - "Constructor that takes a " RST_CLASS_REF(lief.ELF.Binary) "", - "elf_binary"_a) - - .def("build", - static_cast(&Builder::build), - "Perform the build of the provided ELF binary") - - .def_property("config", - &Builder::config, - &Builder::set_config, - "Tweak the ELF builder with the provided config parameter", - py::return_value_policy::reference_internal) - - .def("write", - static_cast(&Builder::write), - "Write the build result into the ``output`` file", - "output"_a) - - .def("get_build", - &Builder::get_build, - "Return the build result as a ``list`` of bytes", - py::return_value_policy::reference_internal); - -} -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyDynamicEntry.cpp b/vendor/lief/api/python/ELF/objects/pyDynamicEntry.cpp deleted file mode 100644 index 454ca81..0000000 --- a/vendor/lief/api/python/ELF/objects/pyDynamicEntry.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/DynamicEntry.hpp" -#include "LIEF/ELF/hash.hpp" - - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (DynamicEntry::*)(void) const; - -template -using setter_t = void (DynamicEntry::*)(T); - - -template<> -void create(py::module& m) { - - // DynamicEntry object - py::class_(m, "DynamicEntry", - R"delim( - Class which represents an entry in the dynamic table - These entries are located in the ``.dynamic`` section or the ``PT_DYNAMIC`` segment - )delim") - .def(py::init<>(), - "Default constructor") - - .def(py::init(), - "Constructor from a " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " and value", - "tag"_a, "value"_a) - - .def_property("tag", - static_cast>(&DynamicEntry::tag), - static_cast>(&DynamicEntry::tag), - "Return the entry's " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " which represent the entry type") - - .def_property("value", - static_cast>(&DynamicEntry::value), - static_cast>(&DynamicEntry::value), - R"delim( - Return the entry's value - - The meaning of the value strongly depends on the tag. - It can be an offset, an index, a flag, ... - )delim") - - .def("__eq__", &DynamicEntry::operator==) - .def("__ne__", &DynamicEntry::operator!=) - .def("__hash__", - [] (const DynamicEntry& entry) { - return Hash::hash(entry); - }) - - .def("__str__", - [] (const DynamicEntry& dynamicEntry) - { - std::ostringstream stream; - stream << dynamicEntry; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyDynamicEntryArray.cpp b/vendor/lief/api/python/ELF/objects/pyDynamicEntryArray.cpp deleted file mode 100644 index b759ca6..0000000 --- a/vendor/lief/api/python/ELF/objects/pyDynamicEntryArray.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ - -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" - -#include "LIEF/ELF/DynamicEntryArray.hpp" -#include "LIEF/ELF/DynamicEntry.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (DynamicEntryArray::*)(void) const; - -template -using setter_t = void (DynamicEntryArray::*)(T); - - -template<> -void create(py::module& m) { - - // Dynamic Entry Array object - py::class_(m, "DynamicEntryArray", - R"delim( - Class that represent an Array in the dynamic table. - This entry is associated with constructors: - - ``DT_PREINIT_ARRAY`` - - ``DT_INIT_ARRAY`` - - ``DT_FINI_ARRAY`` - - The underlying values are 64-bits integers to cover both: - ELF32 and ELF64 binaries. - )delim") - .def(py::init<>()) - - .def(py::init(), - "Constructor with " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " and value", - "tag"_a, "value"_a) - - .def_property("array", - static_cast& (DynamicEntryArray::*)()>(&DynamicEntryArray::array), - static_cast&>>(&DynamicEntryArray::array), - "Return the array as a list of intergers", - py::return_value_policy::reference) - - .def("insert", - &DynamicEntryArray::insert, - "Insert the given ``function`` at ``pos``", - "pos"_a, "function"_a, - py::return_value_policy::reference) - - .def("append", - &DynamicEntryArray::append, - "Append the given ``function`` ", - "function"_a, - py::return_value_policy::reference) - - .def("remove", - &DynamicEntryArray::remove, - "Remove the given ``function`` ", - "function"_a, - py::return_value_policy::reference) - - - .def(py::self += uint64_t()) - .def(py::self -= uint64_t()) - - - .def("__getitem__", - static_cast(&DynamicEntryArray::operator[]), - py::return_value_policy::reference) - - .def("__len__", - &DynamicEntryArray::size) - - .def("__eq__", &DynamicEntryArray::operator==) - .def("__ne__", &DynamicEntryArray::operator!=) - .def("__hash__", - [] (const DynamicEntryArray& entry) { - return Hash::hash(entry); - }) - - - .def("__str__", - [] (const DynamicEntryArray& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyDynamicEntryFlags.cpp b/vendor/lief/api/python/ELF/objects/pyDynamicEntryFlags.cpp deleted file mode 100644 index 9a16f53..0000000 --- a/vendor/lief/api/python/ELF/objects/pyDynamicEntryFlags.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" - -#include "LIEF/ELF/DynamicEntryFlags.hpp" -#include "LIEF/ELF/DynamicEntry.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (DynamicEntryFlags::*)(void) const; - -template -using setter_t = void (DynamicEntryFlags::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "DynamicEntryFlags") - .def(py::init<>()) - - .def(py::init(), - "Constructor with " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " and value", - "tag"_a, "value"_a) - - .def_property_readonly("flags", - &DynamicEntryFlags::flags, - "Return list of " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) " or " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) " (integer)", - py::return_value_policy::move) - - .def("has", - static_cast(&DynamicEntryFlags::has), - "Check if this entry contains the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) "", - "flag"_a) - - .def("has", - static_cast(&DynamicEntryFlags::has), - "Check if this entry contains the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) "", - "flag"_a) - - .def("add", - static_cast(&DynamicEntryFlags::add), - "Add the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) "", - "flag"_a) - - .def("add", - static_cast(&DynamicEntryFlags::add), - "Add the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) "", - "flag"_a) - - .def("remove", - static_cast(&DynamicEntryFlags::remove), - "Remove the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) "", - "flag"_a) - - .def("remove", - static_cast(&DynamicEntryFlags::remove), - "Remove the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) "", - "flag"_a) - - - .def("__eq__", &DynamicEntryFlags::operator==) - .def("__ne__", &DynamicEntryFlags::operator!=) - .def("__hash__", - [] (const DynamicEntryFlags& entry) { - return Hash::hash(entry); - }) - - .def(py::self += DYNAMIC_FLAGS()) - .def(py::self += DYNAMIC_FLAGS_1()) - - - .def(py::self -= DYNAMIC_FLAGS()) - .def(py::self -= DYNAMIC_FLAGS_1()) - - .def("__contains__", - static_cast(&DynamicEntryFlags::has), - "Check if the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) " is present") - - .def("__contains__", - static_cast(&DynamicEntryFlags::has), - "Check if the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) " is present") - - - .def("__str__", - [] (const DynamicEntryFlags& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyDynamicEntryLibrary.cpp b/vendor/lief/api/python/ELF/objects/pyDynamicEntryLibrary.cpp deleted file mode 100644 index 051fb84..0000000 --- a/vendor/lief/api/python/ELF/objects/pyDynamicEntryLibrary.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" - -#include "LIEF/ELF/DynamicEntryLibrary.hpp" -#include "LIEF/ELF/DynamicEntry.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (DynamicEntryLibrary::*)(void) const; - -template -using setter_t = void (DynamicEntryLibrary::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "DynamicEntryLibrary", - R"delim( - Class which represents a ``DT_NEEDED`` entry in the dynamic table. - - This kind of entry is usually used to create library dependency. - )delim") - - .def(py::init(), - "Constructor from a library name", - "library_name"_a) - - .def_property("name", - [] (const DynamicEntryLibrary& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&DynamicEntryLibrary::name), - "Library associated with this entry (e.g. ``libc.so.6``)") - - .def("__eq__", &DynamicEntryLibrary::operator==) - .def("__ne__", &DynamicEntryLibrary::operator!=) - .def("__hash__", - [] (const DynamicEntryLibrary& entry) { - return Hash::hash(entry); - }) - - - .def("__str__", - [] (const DynamicEntryLibrary& dynamicEntryLibrary) - { - std::ostringstream stream; - stream << dynamicEntryLibrary; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyDynamicEntryRpath.cpp b/vendor/lief/api/python/ELF/objects/pyDynamicEntryRpath.cpp deleted file mode 100644 index 17a4a7d..0000000 --- a/vendor/lief/api/python/ELF/objects/pyDynamicEntryRpath.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" - -#include "LIEF/ELF/DynamicEntryRpath.hpp" -#include "LIEF/ELF/DynamicEntry.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (DynamicEntryRpath::*)(void) const; - -template -using setter_t = void (DynamicEntryRpath::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "DynamicEntryRpath", - R"delim( - Class which represents a ``DT_RPATH`` entry. This attribute is - deprecated (cf. ``man ld``) in favour of ``DT_RUNPATH`` (See :class:`~lief.ELF.DynamicRunPath`) - )delim") - - .def(py::init(), - "Constructor from (r)path", - "path"_a = "") - - .def(py::init &>(), - "Constructor from a list of paths", - "paths"_a) - - .def_property("name", - [] (const DynamicEntryRpath& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&DynamicEntryRpath::name), - "The actual rpath as a string") - - .def_property("rpath", - [] (const DynamicEntryRpath& obj) { - return safe_string_converter(obj.rpath()); - }, - static_cast>(&DynamicEntryRpath::rpath), - "The actual rpath as a string") - - - .def_property("paths", - static_cast >>(&DynamicEntryRpath::paths), - static_cast&>>(&DynamicEntryRpath::paths), - "Paths as a list") - - .def("insert", - &DynamicEntryRpath::insert, - "Insert a ``path`` at the given ``position``", - "position"_a, "path"_a, - py::return_value_policy::reference) - - .def("append", - &DynamicEntryRpath::append, - "Append the given ``path`` ", - "path"_a, - py::return_value_policy::reference) - - - .def("remove", - &DynamicEntryRpath::remove, - "Remove the given ``path`` ", - "path"_a, - py::return_value_policy::reference) - - .def(py::self += std::string()) - .def(py::self -= std::string()) - - .def("__eq__", &DynamicEntryRpath::operator==) - .def("__ne__", &DynamicEntryRpath::operator!=) - .def("__hash__", - [] (const DynamicEntryRpath& entry) { - return Hash::hash(entry); - }) - - - .def("__str__", - [] (const DynamicEntryRpath& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyDynamicEntryRunPath.cpp b/vendor/lief/api/python/ELF/objects/pyDynamicEntryRunPath.cpp deleted file mode 100644 index 8756fa1..0000000 --- a/vendor/lief/api/python/ELF/objects/pyDynamicEntryRunPath.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" - -#include "LIEF/ELF/DynamicEntryRunPath.hpp" -#include "LIEF/ELF/DynamicEntry.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (DynamicEntryRunPath::*)(void) const; - -template -using setter_t = void (DynamicEntryRunPath::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "DynamicEntryRunPath", - R"delim( - Class that represents a ``DT_RUNPATH`` wich is used by the loader - to resolve libraries (:class:`~lief.ELF.DynamicEntryLibrary`). - )delim") - - .def(py::init(), - "Constructor from a (run)path", - "path"_a = "") - - .def(py::init &>(), - "Constructor from a list of paths", - "paths"_a) - - .def_property("name", - [] (const DynamicEntryRunPath& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&DynamicEntryRunPath::name), - "Runpath raw value") - - .def_property("runpath", - [] (const DynamicEntryRunPath& obj) { - return safe_string_converter(obj.runpath()); - }, - static_cast>(&DynamicEntryRunPath::runpath), - "Runpath raw value") - - .def_property("paths", - static_cast >>(&DynamicEntryRunPath::paths), - static_cast&>>(&DynamicEntryRunPath::paths), - "Paths as a list") - - .def("insert", - &DynamicEntryRunPath::insert, - "Insert a ``path`` at the given ``position``", - "position"_a, "path"_a, - py::return_value_policy::reference) - - .def("append", - &DynamicEntryRunPath::append, - "Append the given ``path`` ", - "path"_a, - py::return_value_policy::reference) - - - .def("remove", - &DynamicEntryRunPath::remove, - "Remove the given ``path`` ", - "path"_a, - py::return_value_policy::reference) - - - .def(py::self += std::string()) - .def(py::self -= std::string()) - - .def("__eq__", &DynamicEntryRunPath::operator==) - .def("__ne__", &DynamicEntryRunPath::operator!=) - .def("__hash__", - [] (const DynamicEntryRunPath& entry) { - return Hash::hash(entry); - }) - - .def("__str__", - [] (const DynamicEntryRunPath& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyDynamicSharedObject.cpp b/vendor/lief/api/python/ELF/objects/pyDynamicSharedObject.cpp deleted file mode 100644 index 84a8d91..0000000 --- a/vendor/lief/api/python/ELF/objects/pyDynamicSharedObject.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" - -#include "LIEF/ELF/DynamicSharedObject.hpp" -#include "LIEF/ELF/DynamicEntry.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (DynamicSharedObject::*)(void) const; - -template -using setter_t = void (DynamicSharedObject::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "DynamicSharedObject", - R"delim( - Class which represents a ``DT_SONAME`` entry in the dynamic table - This kind of entry is usually used no name the original library. - - This entry is not present for executable. - )delim") - - .def(py::init(), - "Constructor from library name", - "library_name"_a) - - .def_property("name", - [] (const DynamicSharedObject& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&DynamicSharedObject::name), - "Return the library name") - - .def("__eq__", &DynamicSharedObject::operator==) - .def("__ne__", &DynamicSharedObject::operator!=) - .def("__hash__", - [] (const DynamicSharedObject& entry) { - return Hash::hash(entry); - }) - - .def("__str__", - [] (const DynamicSharedObject& dynamicSharedObject) { - std::ostringstream stream; - stream << dynamicSharedObject; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyGnuHash.cpp b/vendor/lief/api/python/ELF/objects/pyGnuHash.cpp deleted file mode 100644 index c4e860e..0000000 --- a/vendor/lief/api/python/ELF/objects/pyGnuHash.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/GnuHash.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (GnuHash::*)(void) const; - -template -using setter_t = void (GnuHash::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "GnuHash", - R"delim( - Class which provides a view over the GNU Hash implementation. - Most of the fields are read-only since the values are re-computed by the :class:`lief.ELF.Builder`. - )delim") - .def(py::init<>()) - - .def_property_readonly("nb_buckets", - &GnuHash::nb_buckets, - "Return the number of buckets") - - .def_property_readonly("symbol_index", - &GnuHash::symbol_index, - "Index of the first symbol in the dynamic symbols table which is accessible with the hash table") - - .def_property_readonly("shift2", - &GnuHash::shift2, - "Shift count used in the bloom filter") - - .def_property_readonly("bloom_filters", - &GnuHash::bloom_filters, - "Bloom filters", - py::return_value_policy::reference_internal) - - .def_property_readonly("buckets", - &GnuHash::buckets, - "hash buckets", - py::return_value_policy::reference_internal) - - .def_property_readonly("hash_values", - &GnuHash::hash_values, - "Hash values", - py::return_value_policy::reference_internal) - - .def("check_bloom_filter", - &GnuHash::check_bloom_filter, - "Check if the given hash pass the bloom filter", - "hash"_a) - - .def("check_bucket", - &GnuHash::check_bucket, - "Check if the given hash pass the bucket filter", - "hash"_a) - - .def("check", - static_cast(&GnuHash::check), - "Check if the symbol *probably* exists. If " - "the returned value is ``false`` you can assume at ``100%`` that " - "the symbol with the given name doesn't exists. If ``true`` you can't " - "do any assumption ", - "symbol_name"_a) - - .def("check", - static_cast(&GnuHash::check), - "Check if the symbol associated with the given *probably* exists. If " - "the returned value is ``false`` you can assume at ``100%`` that " - "the symbol doesn't exists. If ``true`` you can't " - "do any assumption", - "hash_value"_a) - - .def("__eq__", &GnuHash::operator==) - .def("__ne__", &GnuHash::operator!=) - .def("__hash__", - [] (const GnuHash& gnuhash) { - return Hash::hash(gnuhash); - }) - - .def("__str__", - [] (const GnuHash& gnuhash) - { - std::ostringstream stream; - stream << gnuhash; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/ELF/objects/pyHeader.cpp b/vendor/lief/api/python/ELF/objects/pyHeader.cpp deleted file mode 100644 index bddfabf..0000000 --- a/vendor/lief/api/python/ELF/objects/pyHeader.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/Header.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - - -template<> -void create
(py::module& m) { - - py::class_(m, "Header", - R"delim( - Class which represents the ELF's header. This is the ELF structure - that starts an ELF file. - )delim") - .def(py::init<>()) - - .def_property("identity_class", - static_cast>(&Header::identity_class), - static_cast>(&Header::identity_class), - "Header's " RST_CLASS_REF(lief.ELF.ELF_CLASS) "." - ) - - .def_property("identity_data", - static_cast>(&Header::identity_data), - static_cast>(&Header::identity_data), - "Specify the data encoding: " RST_CLASS_REF(lief.ELF.ELF_DATA) "." - ) - - .def_property("identity_version", - static_cast>(&Header::identity_version), - static_cast>(&Header::identity_version), - "Return header's " RST_CLASS_REF(lief.ELF.VERSION) "." - ) - - .def_property("identity_os_abi", - static_cast>(&Header::identity_os_abi), - static_cast>(&Header::identity_os_abi), - "Identifies the version of the ABI for which the object is prepared (" RST_CLASS_REF(lief.ELF.OS_ABI) ")." - ) - - .def_property("identity_abi_version", - static_cast>(&Header::identity_abi_version), - static_cast>(&Header::identity_abi_version), - "Return the ABI version (integer)." - ) - - .def_property("identity", - static_cast(&Header::identity), - [] (Header& header, const py::object& obj) { - if (py::isinstance(obj)) { - header.identity(obj.cast()); - return; - } - - if (py::isinstance(obj)) { - header.identity(obj.cast()); - return; - } - - if (py::isinstance(obj)) { - header.identity(obj.cast()); - return; - } - - std::string error_str = py::repr(obj).cast(); - error_str = error_str + " is not supported!"; - throw py::type_error(error_str.c_str()); - }, - "Header's identity.", - py::return_value_policy::reference_internal - ) - - .def_property("file_type", - static_cast>(&Header::file_type), - static_cast>(&Header::file_type), - "Return binary's " RST_CLASS_REF(lief.ELF.E_TYPE) ". This field determines if the binary \ - is a executable, a library..." - ) - - .def_property("machine_type", - static_cast>(&Header::machine_type), - static_cast>(&Header::machine_type), - "Return the target architecture (" RST_CLASS_REF(lief.ELF.ARCH) ")") - - .def_property("object_file_version", - static_cast>(&Header::object_file_version), - static_cast>(&Header::object_file_version), - "Return the " RST_CLASS_REF(lief.ELF.VERSION) "") - - .def_property("entrypoint", - static_cast>(&Header::entrypoint), - static_cast>(&Header::entrypoint), - "Return the binary entry point") - - .def_property("program_header_offset", - static_cast>(&Header::program_headers_offset), - static_cast>(&Header::program_headers_offset), - "Offset of program table (also known as segments table)") - - .def_property("section_header_offset", - static_cast>(&Header::section_headers_offset), - static_cast>(&Header::section_headers_offset), - "Offset of section table") - - .def_property("processor_flag", - static_cast>(&Header::processor_flag), - static_cast>(&Header::processor_flag), - "Processor-specific flags") - - .def_property_readonly("arm_flags_list", - &Header::arm_flags_list, - "Return a list of " RST_CLASS_REF(lief.ELF.ARM_EFLAGS) " present in " - ":attr:`~lief.ELF.Header.processor_flag`", - py::return_value_policy::reference_internal) - - .def_property_readonly("mips_flags_list", - &Header::mips_flags_list, - "Return a list of " RST_CLASS_REF(lief.ELF.MIPS_EFLAGS) " present in " - ":attr:`~lief.ELF.Header.processor_flag`", - py::return_value_policy::reference_internal) - - .def_property_readonly("ppc64_flags_list", - &Header::ppc64_flags_list, - "Return a list of " RST_CLASS_REF(lief.ELF.PPC64_EFLAGS) " present in " - ":attr:`~lief.ELF.Header.processor_flag`", - py::return_value_policy::reference_internal) - - .def_property_readonly("hexagon_flags_list", - &Header::hexagon_flags_list, - "Return a list of " RST_CLASS_REF(lief.ELF.HEXAGON_EFLAGS) " present in " - ":attr:`~lief.ELF.Header.processor_flag`", - py::return_value_policy::reference_internal) - - .def_property("header_size", - static_cast>(&Header::header_size), - static_cast>(&Header::header_size), - R"delim( - Return the size of the ELF header - - This size should be 64 for an ``ELF64`` binary and 52 for an ``ELF32``. - )delim") - - .def_property("program_header_size", - static_cast>(&Header::program_header_size), - static_cast>(&Header::program_header_size), - R"delim( - Return the size of a Segment header (:class:`lief.ELF.Segment`) - - This size should be 56 for a ``ELF64`` binary and 32 for an ``ELF32``. - )delim") - - .def_property("numberof_segments", - static_cast>(&Header::numberof_segments), - static_cast>(&Header::numberof_segments), - "Return the number of program headers (segments)") - - .def_property("section_header_size", - static_cast>(&Header::section_header_size), - static_cast>(&Header::section_header_size), - R"delim( - Return the size of a Section header (:class:`lief.ELF.Section`) - - This size should be 64 for a ``ELF64`` binary and 40 for an ``ELF32``. - )delim") - - .def_property("numberof_sections", - static_cast>(&Header::numberof_sections), - static_cast>(&Header::numberof_sections), - "Return the number of sections") - - .def_property("section_name_table_idx", - static_cast>(&Header::section_name_table_idx), - static_cast>(&Header::section_name_table_idx), - "Return the section index which contains sections' names") - - .def("__eq__", &Header::operator==) - .def("__ne__", &Header::operator!=) - .def("__hash__", - [] (const Header& header) { - return Hash::hash(header); - }) - - .def("__contains__", - static_cast(&Header::has), - "Check if the given " RST_CLASS_REF(lief.ELF.ARM_EFLAGS) " is present in " - ":attr:`~lief.ELF.Header.processor_flag`") - - - .def("__contains__", - static_cast(&Header::has), - "Check if the given " RST_CLASS_REF(lief.ELF.MIPS_EFLAGS) " is present in " - ":attr:`~lief.ELF.Header.processor_flag`") - - - .def("__contains__", - static_cast(&Header::has), - "Check if the given " RST_CLASS_REF(lief.ELF.PPC64_EFLAGS) " is present in " - ":attr:`~lief.ELF.Header.processor_flag`") - - - .def("__contains__", - static_cast(&Header::has), - "Check if the given " RST_CLASS_REF(lief.ELF.HEXAGON_EFLAGS) " is present in " - ":attr:`~lief.ELF.Header.processor_flag`") - - .def("__str__", - [] (const Header& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyNote.cpp b/vendor/lief/api/python/ELF/objects/pyNote.cpp deleted file mode 100644 index 680a3f0..0000000 --- a/vendor/lief/api/python/ELF/objects/pyNote.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/Note.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (Note::*)(void) const; - -template -using setter_t = void (Note::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "Note", - R"delim( - Class which represents an ELF note. - )delim") - - .def(py::init<>(), - "Default constructor") - - .def(py::init&>(), - "Constructor from a ``name``, ``type`` and ``description``", - "name"_a, "type"_a, "description"_a) - - .def_property_readonly("details", - static_cast(&Note::details), - "Parse the given note description and return a " RST_CLASS_REF(lief.ELF.NoteDetails) " object", - py::return_value_policy::reference_internal) - - .def_property("name", - static_cast>(&Note::name), - static_cast>(&Note::name), - "Return the *name* of the note (Usually the owner)." - ) - - .def_property("type", - static_cast>(&Note::type), - static_cast>(&Note::type), - "Return the type of the note. It can be one of the " RST_CLASS_REF(lief.ELF.NOTE_TYPES) " values" - ) - - .def_property("type_core", - static_cast>(&Note::type_core), - static_cast>(&Note::type_core), - "Return the type of the note for ELF Core (ET_CORE). It Can be one of the " RST_CLASS_REF(lief.ELF.NOTE_TYPES_CORE) " values" - ) - - .def_property("description", - static_cast>(&Note::description), - static_cast>(&Note::description), - "Return the description associated with the note" - ) - - .def_property_readonly("is_core", - &Note::is_core, - "True if the note is associated with a coredump") - - .def_property_readonly("is_android", - &Note::is_android, - R"delim( - True if the current note is specific to Android. - - If true, :attr:`lief.Note.details` returns a reference to the :class:`~lief.ELF.AndroidNote` object - )delim") - - .def_property_readonly("size", - &Note::size, - "Size of the **raw** note") - - .def("__eq__", &Note::operator==) - .def("__ne__", &Note::operator!=) - .def("__hash__", - [] (const Note& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const Note& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyNoteDetails.cpp b/vendor/lief/api/python/ELF/objects/pyNoteDetails.cpp deleted file mode 100644 index dbed310..0000000 --- a/vendor/lief/api/python/ELF/objects/pyNoteDetails.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/NoteDetails.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (NoteDetails::*)(void) const; - -template -using setter_t = void (NoteDetails::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "NoteDetails") - .def(py::init<>(), - "Default ctor") - - .def("__eq__", &NoteDetails::operator==) - .def("__ne__", &NoteDetails::operator!=) - .def("__hash__", - [] (const NoteDetails& note) { - return Hash::hash(note); - }) - - .def("__str__", - [] (const NoteDetails& note) - { - std::ostringstream stream; - stream << note; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyParser.cpp b/vendor/lief/api/python/ELF/objects/pyParser.cpp deleted file mode 100644 index 39f2ea4..0000000 --- a/vendor/lief/api/python/ELF/objects/pyParser.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/Parser.hpp" -#include "LIEF/ELF/Binary.hpp" - -#include - -namespace LIEF { -namespace ELF { - -template<> -void create(py::module& m) { - - // Parser (Parser) - m.def("parse", - static_cast (*) (const std::string&, DYNSYM_COUNT_METHODS)>(&Parser::parse), - R"delim( - Parse the ELF binary from the given **file path** and return a :class:`lief.ELF.Binary` object - - For *weird* binaries (e.g sectionless) you can choose the method to use to count dynamic symbols - (:class:`lief.ELF.DYNSYM_COUNT_METHODS`). By default, the value is set to - :attr:`lief.ELF.DYNSYM_COUNT_METHODS.COUNT_AUTO` - )delim", - "filename"_a, "dynsym_count_method"_a = DYNSYM_COUNT_METHODS::COUNT_AUTO, - py::return_value_policy::take_ownership); - - m.def("parse", - static_cast(*)(const std::vector&, const std::string&, DYNSYM_COUNT_METHODS)>(&Parser::parse), - R"delim( - Parse the ELF binary from the given **list of bytes** and return a :class:`lief.ELF.Binary` object - - For *weird* binaries (e.g sectionless) you can choose the method to use to count dynamic symbols - (:class:`lief.ELF.DYNSYM_COUNT_METHODS`). By default, the value is set to - :attr:`lief.ELF.DYNSYM_COUNT_METHODS.COUNT_AUTO` - )delim", - - "raw"_a, "name"_a = "", "dynsym_count_method"_a = DYNSYM_COUNT_METHODS::COUNT_AUTO, - py::return_value_policy::take_ownership); - - - m.def("parse", - [] (py::object byteio, const std::string& name, DYNSYM_COUNT_METHODS count) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str))}; - - return LIEF::ELF::Parser::parse(std::move(raw), name, count); - }, - R"delim( - Parse the ELF binary from a Python IO stream and return a :class:`lief.ELF.Binary` object - - For *weird* binaries (e.g sectionless) you can choose the method to use to count dynamic symbols - (:class:`lief.ELF.lief.ELF.DYNSYM_COUNT_METHODS`). By default, the value is set to - :attr:`lief.ELF.lief.ELF.DYNSYM_COUNT_METHODS.COUNT_AUTO` - )delim", - "io"_a, "name"_a = "", "dynsym_count_method"_a = DYNSYM_COUNT_METHODS::COUNT_AUTO, - py::return_value_policy::take_ownership); -} -} -} diff --git a/vendor/lief/api/python/ELF/objects/pyRelocation.cpp b/vendor/lief/api/python/ELF/objects/pyRelocation.cpp deleted file mode 100644 index b3e02cf..0000000 --- a/vendor/lief/api/python/ELF/objects/pyRelocation.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/Relocation.hpp" -#include "LIEF/ELF/Symbol.hpp" -#include "LIEF/ELF/Section.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (Relocation::*)(void) const; - -template -using setter_t = void (Relocation::*)(T); - - -template<> -void create(py::module& m) { - - // Relocation object - py::class_(m, "Relocation", - R"delim( - Class that represents an ELF relocation. - )delim") - .def(py::init<>()) - .def(py::init(), "arch"_a) - .def(py::init(), - "address"_a, "type"_a = 0, "addend"_a = 0, "is_rela"_a = false) - - .def_property("addend", - static_cast>(&Relocation::addend), - static_cast>(&Relocation::addend), - "Additional value") - - .def_property("info", - static_cast>(&Relocation::info), - static_cast>(&Relocation::info), - "Extra information like the symbol index") - - .def_property("purpose", - static_cast>(&Relocation::purpose), - static_cast>(&Relocation::purpose), - R"delim( - Purpose of the relocation (:class:`~lief.ELF.RELOCATION_PURPOSES`). - - This value provides the information about how the relocation is used (PLT/GOT resolution, ``.o`` file, ...) - )delim") - - .def_property("type", - static_cast>(&Relocation::type), - static_cast>(&Relocation::type), - R"delim( - Relocation type. This value depends on the underlying architecture. - - See: - * :class:`~lief.ELF.RELOCATION_X86_64` - * :class:`~lief.ELF.RELOCATION_i386` - * :class:`~lief.ELF.RELOCATION_AARCH64` - * :class:`~lief.ELF.RELOCATION_ARM` - )delim") - - .def_property_readonly("has_symbol", - &Relocation::has_symbol, - "``True`` if a " RST_CLASS_REF(lief.ELF.Symbol) " is associated with the relocation") - - .def_property("symbol", - static_cast(&Relocation::symbol), - static_cast(&Relocation::symbol), - R"delim( - :class:`~lief.ELF.Symbol` associated with the relocation or None - if no symbol are associated with this relocation. - )delim", - py::return_value_policy::reference) - - .def_property_readonly("has_section", - &Relocation::has_section, - R"delim( - ``True`` if this relocation has a :class:`lief.ELF.Section` associated with. - - This is usually the case for object files (``.o``) - )delim") - - .def_property_readonly("section", - static_cast(&Relocation::section), - R"delim( - :class:`~lief.ELF.Section` in which the relocation is applied or None if not relevant - )delim", - py::return_value_policy::reference) - - .def_property_readonly("is_rela", - static_cast>(&Relocation::is_rela), - "``True`` if the relocation **uses** the :attr:`~lief.ELF.Relocation.addend` proprety") - - .def_property_readonly("is_rel", - static_cast>(&Relocation::is_rel), - "``True`` if the relocation **doesn't use** the :attr:`~lief.ELF.Relocation.addend` proprety") - - .def("__eq__", &Relocation::operator==) - .def("__ne__", &Relocation::operator!=) - .def("__hash__", - [] (const Relocation& relocation) { - return Hash::hash(relocation); - }) - - .def("__str__", - [] (const Relocation& relocation) - { - std::ostringstream stream; - stream << relocation; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySection.cpp b/vendor/lief/api/python/ELF/objects/pySection.cpp deleted file mode 100644 index 5073f08..0000000 --- a/vendor/lief/api/python/ELF/objects/pySection.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" -#include "pyIterators.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/Abstract/Section.hpp" -#include "LIEF/ELF/Section.hpp" -#include "LIEF/ELF/Segment.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (Section::*)(void) const; - -template -using setter_t = void (Section::*)(T); - -template -using no_const_getter = T (Section::*)(void); - - -template<> -void create
(py::module& m) { - - // Section object - py::class_ sec(m, "Section", - R"delim( - Class which represents an ELF section. - )delim"); - - init_ref_iterator(sec, "it_segments"); - - sec - .def(py::init<>(), - "Default constructor") - - .def("as_frame", - &Section::as_frame, - py::return_value_policy::reference_internal) - - .def_property_readonly("is_frame", - &Section::is_frame) - - .def(py::init(), - "Constructor from a name and a section type", - "name"_a, "type"_a = ELF_SECTION_TYPES::SHT_PROGBITS) - - .def(py::init([] (Section& section, std::vector& content, ELF_CLASS type) { - return new Section(content.data(), type); - })) - - .def_property("type", - static_cast>(&Section::type), - static_cast>(&Section::type), - "Return the " RST_CLASS_REF(lief.ELF.SECTION_TYPES) "") - - .def_property("flags", - static_cast>(&Section::flags), - static_cast>(&Section::flags), - "Return the section's flags as an integer") - - .def_property_readonly("flags_list", - &Section::flags_list, - "Return section's flags as a list of " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) "") - - .def_property("file_offset", - static_cast>(&Section::file_offset), - static_cast>(&Section::file_offset), - "Offset of the section's content") - - .def_property_readonly("original_size", - static_cast>(&Section::original_size), - R"delim( - Original size of the section's data. - - This value is used by the :class:`~lief.ELF.Builder` to determine if it needs - to be relocated to avoid an override of the data - )delim") - - .def_property("alignment", - static_cast>(&Section::alignment), - static_cast>(&Section::alignment), - "Section alignment") - - .def_property("information", - static_cast>(&Section::information), - static_cast>(&Section::information), - "Section information (this value depends on the section)") - - .def_property("entry_size", - static_cast>(&Section::entry_size), - static_cast>(&Section::entry_size), - R"delim( - This property returns the size of an element in the case of a section that - contains an array. - - :Example: - - The `.dynamic` section contains an array of :class:`~lief.ELF.DynamicEntry`. As the - size of the raw C structure of this entry is 0x10 (``sizeof(Elf64_Dyn)``) - in a ELF64, the :attr:`~lief.ELF.Section.entry_size`, - is set to this value. - )delim") - - .def_property("link", - static_cast>(&Section::link), - static_cast>(&Section::link), - "Index to another section") - - .def_property_readonly("segments", - static_cast>(&Section::segments), - "Return segment(s) associated with the given section", - py::return_value_policy::reference_internal) - - .def("clear", - &Section::clear, - "Clear the content of the section with the given ``value``", - "value"_a = 0, - py::return_value_policy::reference) - - .def("add", - &Section::add, - "Add the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " to the list of " - ":attr:`~lief.ELF.Section.flags`", - "flag"_a) - - .def("remove", - &Section::remove, - "Remove the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " from the list of " - ":attr:`~lief.ELF.Section.flags`", - "flag"_a) - - .def("has", - static_cast(&Section::has), - "Check if the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " is present", - "flag"_a) - - .def("has", - static_cast(&Section::has), - "Check if the given " RST_CLASS_REF(lief.ELF.Segment) " is present " - "in :attr:`~lief.ELF.Section.segments`", - "segment"_a) - - .def("__eq__", &Section::operator==) - .def("__ne__", &Section::operator!=) - .def("__hash__", - [] (const Section& section) { - return Hash::hash(section); - }) - - .def(py::self += ELF_SECTION_FLAGS()) - .def(py::self -= ELF_SECTION_FLAGS()) - - .def("__contains__", - static_cast(&Section::has), - "Check if the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " is present") - - - .def("__contains__", - static_cast(&Section::has), - "Check if the given " RST_CLASS_REF(lief.ELF.Segment) " is present " - "in :attr:`~lief.ELF.Section.segments`") - - .def("__str__", - [] (const Section& section) - { - std::ostringstream stream; - stream << section; - return stream.str(); - }); -} - - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySegment.cpp b/vendor/lief/api/python/ELF/objects/pySegment.cpp deleted file mode 100644 index 7476259..0000000 --- a/vendor/lief/api/python/ELF/objects/pySegment.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include - - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/Segment.hpp" -#include "LIEF/ELF/Section.hpp" - -#include "pyIterators.hpp" -#include "pyELF.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (Segment::*)(void) const; - -template -using setter_t = void (Segment::*)(T); - -template -using no_const_getter = T (Segment::*)(void); - - -template<> -void create(py::module& m) { - py::class_ seg(m, "Segment", - R"delim( - Class which represents the ELF segments - )delim"); - - init_ref_iterator(seg, "it_sections"); - - seg - .def(py::init<>()) - .def_static("from_raw", - [] (py::bytes raw) -> py::object { - const std::string& bytes_as_str = raw; - std::vector cpp_raw = {std::begin(bytes_as_str), std::end(bytes_as_str)}; - auto* f_ptr = static_cast(*)(const std::vector&)>(&Segment::from_raw); - return error_or(f_ptr, std::move(cpp_raw)); - }) - - .def_property("type", - static_cast>(&Segment::type), - static_cast>(&Segment::type), - "Segment's type: " RST_CLASS_REF(lief.ELF.SEGMENT_TYPES) "") - - .def_property("flags", - static_cast>(&Segment::flags), - static_cast>(&Segment::flags), - "The flag permissions associated with this segment") - - .def_property("file_offset", - static_cast>(&Segment::file_offset), - static_cast>(&Segment::file_offset), - "The file offset of the data associated with this segment") - - .def_property("virtual_address", - static_cast>(&Segment::virtual_address), - static_cast>(&Segment::virtual_address), - R"delim( - The virtual address of the segment. - - .. warning:: - The ELF format specifications require the following relationship: - - .. math:: - \text{virtual address} \equiv \text{file offset} \pmod{\text{page size}} - \text{virtual address} \equiv \text{file offset} \pmod{\text{alignment}} - )delim") - - .def_property("physical_address", - static_cast>(&Segment::physical_address), - static_cast>(&Segment::physical_address), - R"delim( - The physical address of the segment. - This value is not really relevant on systems like Linux or Android. On the other hand, - Qualcomm trustlets might use this value. - - Usually this value matches :attr:`~lief.ELF.Segment.virtual_address` - )delim") - - .def_property("physical_size", - static_cast>(&Segment::physical_size), - static_cast>(&Segment::physical_size), - "The **file** size of the data associated with this segment") - - .def_property("virtual_size", - static_cast>(&Segment::virtual_size), - static_cast>(&Segment::virtual_size), - R"delim( - The in-memory size of this segment. - - Usually, if the ``.bss`` segment is wrapped by this segment - then, virtual_size is larger than physical_size - )delim") - - .def_property("alignment", - static_cast>(&Segment::alignment), - static_cast>(&Segment::alignment), - "The offset alignment of the segment") - - .def_property("content", - [] (const Segment& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast>>(&Segment::content), - "The raw data associated with this segment.") - - .def("add", - &Segment::add, - "Add the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " to the list of " - ":attr:`~lief.ELF.Segment.flags`", - "flag"_a) - - .def("remove", - &Segment::remove, - "Remove the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " from the list of " - ":attr:`~lief.ELF.Segment.flags`", - "flag"_a) - - .def("has", - static_cast(&Segment::has), - "Check if the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " is present", - "flag"_a) - - .def("has", - static_cast(&Segment::has), - "Check if the given " RST_CLASS_REF(lief.ELF.Section) " is present " - "in :attr:`~lief.ELF.Segment.sections`", - "section"_a) - - .def("has", - static_cast(&Segment::has), - "Check if the given " RST_CLASS_REF(lief.ELF.Section) " 's name is present " - "in :attr:`~lief.ELF.Segment.sections`", - "section_name"_a) - - .def_property_readonly("sections", - static_cast>(&Segment::sections), - "Iterator over the " RST_CLASS_REF(lief.ELF.Section) " wrapped by this segment", - py::return_value_policy::reference_internal) - - .def("__eq__", &Segment::operator==) - .def("__ne__", &Segment::operator!=) - .def("__hash__", - [] (const Segment& segment) { - return Hash::hash(segment); - }) - - .def(py::self += ELF_SEGMENT_FLAGS()) - .def(py::self -= ELF_SEGMENT_FLAGS()) - - .def("__contains__", - static_cast(&Segment::has), - "Check if the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " is present") - - .def("__contains__", - static_cast(&Segment::has), - "Check if the given " RST_CLASS_REF(lief.ELF.Section) " is present " - "in :attr:`~lief.ELF.Segment.sections`") - - .def("__contains__", - static_cast(&Segment::has), - "Check if the given " RST_CLASS_REF(lief.ELF.Section) " 's name is present " - "in :attr:`~lief.ELF.Segment.sections`") - - .def("__str__", - [] (const Segment& segment) - { - std::ostringstream stream; - stream << segment; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySymbol.cpp b/vendor/lief/api/python/ELF/objects/pySymbol.cpp deleted file mode 100644 index 7fed486..0000000 --- a/vendor/lief/api/python/ELF/objects/pySymbol.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" -#include "pyIterators.hpp" - -#include "LIEF/ELF/Symbol.hpp" -#include "LIEF/ELF/SymbolVersion.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/Abstract/Symbol.hpp" - - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (Symbol::*)(void) const; - -template -using setter_t = void (Symbol::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "Symbol", - R"delim( - "Class which represents an ELF symbol" - )delim") - .def(py::init<>()) - .def_property_readonly("demangled_name", - &Symbol::demangled_name, - "Symbol's name demangled or an empty string if the demangling is not possible/failed") - - .def_property("type", - static_cast>(&Symbol::type), - static_cast>(&Symbol::type), - "The symbol's type provides a general classification for the associated entity. " - "See: " RST_CLASS_REF(lief.ELF.SYMBOL_TYPES) "") - - .def_property("binding", - static_cast>(&Symbol::binding), - static_cast>(&Symbol::binding), - "A symbol's binding determines the linkage visibility and behavior. " - "See " RST_CLASS_REF(lief.ELF.SYMBOL_BINDINGS) "") - - .def_property("information", - static_cast>(&Symbol::information), - static_cast>(&Symbol::information), - "This property specifies the symbol's type and binding attributes") - - .def_property("other", - static_cast>(&Symbol::other), - static_cast>(&Symbol::other), - "Alias for: " RST_ATTR_REF(lief.ELF.Symbol.visibility) "") - - .def_property("visibility", - static_cast>(&Symbol::visibility), - static_cast>(&Symbol::visibility), - R"delim( - Symbol :class:`~lief.ELF.SYMBOL_VISIBILITY`. - It's basically an alias on :attr:`~lief.ELF.Symbol.other` - )delim") - - .def_property("value", // Even though it is already defined in the base class (Abstract/Symbol) - // We keep the definition to provide a dedicated documentation - static_cast>(&Symbol::value), - static_cast>(&Symbol::value), - R"delim( - This member has different menaing depending on the symbol's type and the type of the ELF file (library, object, ...) - - - In relocatable files, this property contains the alignment constraints - of the symbol for which the section index is `SHN_COMMON`. - - In relocatable files, can also contain a section's offset for a defined symbol. - That is, `value` is an offset from the beginning of the section associated with this symbol. - - In executable and libraries, this property contains a virtual address. - )delim") - - .def_property("size", - static_cast>(&Symbol::size), - static_cast>(&Symbol::size), - "Many symbols have associated sizes. For example, a data object's size is the number of " - "bytes contained in the object. This member holds `0` if the symbol has no size or " - "an unknown size.") - - .def_property("shndx", - static_cast>(&Symbol::shndx), - static_cast>(&Symbol::shndx), - "Section index associated with the symbol") - - .def_property_readonly("has_version", - &Symbol::has_version, - "Check if this symbols has a " RST_CLASS_REF(lief.ELF.SymbolVersion) "") - - .def_property_readonly("symbol_version", - static_cast(&Symbol::symbol_version), - R"delim( - Return the :class:`~lief.ELF.SymbolVersion` associated with this symbol - - It returns None if no version is tied to this symbol. - )delim", - py::return_value_policy::reference_internal) - - .def_property_readonly("is_static", - &Symbol::is_static, - "True if the symbol is a static one (i.e. from the ``.symtab`` section") - - .def_property_readonly("is_function", - &Symbol::is_function, - "True if the symbol is a function") - - .def_property_readonly("is_variable", - &Symbol::is_variable, - "True if the symbol is a variable") - - .def_property("exported", - &Symbol::is_exported, &Symbol::set_exported, - "Whether the symbol is **exported**") - - .def_property("imported", - &Symbol::is_imported, &Symbol::set_imported, - "Whether the symbol is **imported**") - - .def("__eq__", &Symbol::operator==) - .def("__ne__", &Symbol::operator!=) - .def("__hash__", - [] (const Symbol& symbol) { - return Hash::hash(symbol); - }) - - - .def("__str__", - [] (const Symbol& symbol) { - std::ostringstream stream; - stream << symbol; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySymbolVersion.cpp b/vendor/lief/api/python/ELF/objects/pySymbolVersion.cpp deleted file mode 100644 index c34d1d0..0000000 --- a/vendor/lief/api/python/ELF/objects/pySymbolVersion.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/SymbolVersion.hpp" -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/SymbolVersionAux.hpp" -#include "LIEF/ELF/SymbolVersionAuxRequirement.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (SymbolVersion::*)(void) const; - -template -using setter_t = void (SymbolVersion::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "SymbolVersion") - .def(py::init<>(),"Default constructor") - .def(py::init(), "Constructor from :attr:`~lief.SymbolVersion.value`") - - .def_property_readonly_static("local", - [] (const py::object&) { - return SymbolVersion::local(); - }, - "Generate a *local* " RST_CLASS_REF(lief.ELF.SymbolVersion) "") - - .def_property_readonly_static("global_", - [] (const py::object&) { - return SymbolVersion::global(); - }, - "Generate a *global* " RST_CLASS_REF(lief.ELF.SymbolVersion) "") - - .def_property("value", - static_cast>(&SymbolVersion::value), - static_cast>(&SymbolVersion::value), - R"delim( - Value associated with the symbol. - - If the given SymbolVersion hasn't Auxiliary version: - - - `0` : The symbol is local - - `1` : The symbol is global - - All other values are used for versions in the own object or in any of - the dependencies. This is the version the symbol is tight to. - )delim") - - .def_property_readonly("has_auxiliary_version", - &SymbolVersion::has_auxiliary_version, - "Check if this symbols has a " RST_CLASS_REF(lief.ELF.SymbolVersionAux) "") - - .def_property( - "symbol_version_auxiliary", - static_cast(&SymbolVersion::symbol_version_auxiliary), - static_cast(&SymbolVersion::symbol_version_auxiliary), - R"delim( - Return the :class:`~lief.ELF.SymbolVersionAux` associated with this version or None if not present. - - The value can be changed by assigning a :class:`~lief.ELF.SymbolVersionAuxRequirement` which - must already exist in the :class:`~lief.ELF.SymbolVersionRequirement`. Once can use - :meth:`~lief.ELF.SymbolVersionAuxRequirement.add_aux_requirement` to add a new - :class:`~lief.ELF.SymbolVersionAuxRequirement`. - )delim", - py::return_value_policy::reference_internal) - - - .def("__eq__", &SymbolVersion::operator==) - .def("__ne__", &SymbolVersion::operator!=) - .def("__hash__", - [] (const SymbolVersion& sv) { - return Hash::hash(sv); - }) - - .def("__str__", - [] (const SymbolVersion& symbolVersion) - { - std::ostringstream stream; - stream << symbolVersion; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySymbolVersionAux.cpp b/vendor/lief/api/python/ELF/objects/pySymbolVersionAux.cpp deleted file mode 100644 index 85099b9..0000000 --- a/vendor/lief/api/python/ELF/objects/pySymbolVersionAux.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/SymbolVersionAux.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (SymbolVersionAux::*)(void) const; - -template -using setter_t = void (SymbolVersionAux::*)(T); - -template<> -void create(py::module& m) { - - py::class_(m, "SymbolVersionAux", - "Class which represents an Auxiliary Symbol version") - - .def_property("name", - [] (const SymbolVersionAux& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&SymbolVersionAux::name), - "Symbol's name (e.g. ``GLIBC_2.2.5``)") - - .def("__eq__", &SymbolVersionAux::operator==) - .def("__ne__", &SymbolVersionAux::operator!=) - .def("__hash__", - [] (const SymbolVersionAux& sva) { - return Hash::hash(sva); - }) - - .def("__str__", - [] (const SymbolVersionAux& symbolVersionAux) - { - std::ostringstream stream; - stream << symbolVersionAux; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySymbolVersionAuxRequirement.cpp b/vendor/lief/api/python/ELF/objects/pySymbolVersionAuxRequirement.cpp deleted file mode 100644 index 4fdf655..0000000 --- a/vendor/lief/api/python/ELF/objects/pySymbolVersionAuxRequirement.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/SymbolVersionAuxRequirement.hpp" - -#include -#include - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (SymbolVersionAuxRequirement::*)(void) const; - -template -using setter_t = void (SymbolVersionAuxRequirement::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "SymbolVersionAuxRequirement") - .def(py::init<>(),"Default constructor") - - .def_property("hash", - static_cast>(&SymbolVersionAuxRequirement::hash), - static_cast>(&SymbolVersionAuxRequirement::hash), - "Hash value of the dependency name (use ELF hashing function)") - - .def_property("flags", - static_cast>(&SymbolVersionAuxRequirement::flags), - static_cast>(&SymbolVersionAuxRequirement::flags), - "Bitmask of flags") - - .def_property("other", - static_cast>(&SymbolVersionAuxRequirement::other), - static_cast>(&SymbolVersionAuxRequirement::other), - R"delim( - It returns the unique version index for the file which is used in the - version symbol table. If the highest bit (bit 15) is set this - is a hidden symbol which cannot be referenced from outside the - object. - )delim") - - - .def("__eq__", &SymbolVersionAuxRequirement::operator==) - .def("__ne__", &SymbolVersionAuxRequirement::operator!=) - .def("__hash__", - [] (const SymbolVersionAuxRequirement& svar) { - return Hash::hash(svar); - }) - - .def("__str__", - [] (const SymbolVersionAuxRequirement& symbolVersionAux) - { - std::ostringstream stream; - stream << symbolVersionAux; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySymbolVersionDefinition.cpp b/vendor/lief/api/python/ELF/objects/pySymbolVersionDefinition.cpp deleted file mode 100644 index a3bc017..0000000 --- a/vendor/lief/api/python/ELF/objects/pySymbolVersionDefinition.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyIterators.hpp" -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/SymbolVersionDefinition.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (SymbolVersionDefinition::*)(void) const; - -template -using setter_t = void (SymbolVersionDefinition::*)(T); - -template -using no_const_getter = T (SymbolVersionDefinition::*)(void); - - -template<> -void create(py::module& m) { - - py::class_ sym_ver_def(m, "SymbolVersionDefinition", - "Class which represents an entry defined in ``DT_VERDEF`` or ``.gnu.version_d``"); - - init_ref_iterator(sym_ver_def, "it_version_aux"); - sym_ver_def - .def_property("version", - static_cast>(&SymbolVersionDefinition::version), - static_cast>(&SymbolVersionDefinition::version), - R"delim( - Version revision. Should be 1 - - This field should always have the value ``1``. It will be changed - if the versioning implementation has to be changed in an incompatible way. - )delim") - - .def_property("flags", - static_cast>(&SymbolVersionDefinition::flags), - static_cast>(&SymbolVersionDefinition::flags), - "Version information") - - .def_property("hash", - static_cast>(&SymbolVersionDefinition::hash), - static_cast>(&SymbolVersionDefinition::hash), - "Hash value of the symbol's name (using ELF hash function)") - - .def_property_readonly("auxiliary_symbols", - static_cast>(&SymbolVersionDefinition::symbols_aux), - py::return_value_policy::reference_internal) - - .def("__eq__", &SymbolVersionDefinition::operator==) - .def("__ne__", &SymbolVersionDefinition::operator!=) - .def("__hash__", - [] (const SymbolVersionDefinition& svd) { - return Hash::hash(svd); - }) - - .def("__str__", - [] (const SymbolVersionDefinition& svd) - { - std::ostringstream stream; - stream << svd; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySymbolVersionRequirement.cpp b/vendor/lief/api/python/ELF/objects/pySymbolVersionRequirement.cpp deleted file mode 100644 index 25d38f0..0000000 --- a/vendor/lief/api/python/ELF/objects/pySymbolVersionRequirement.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/SymbolVersionRequirement.hpp" - -#include "pyIterators.hpp" -#include "pyELF.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (SymbolVersionRequirement::*)(void) const; - -template -using setter_t = void (SymbolVersionRequirement::*)(T); - -template -using no_const_getter = T (SymbolVersionRequirement::*)(void); - - -template<> -void create(py::module& m) { - - // Symbol Version Requirement object - py::class_ sym_ver_req(m, "SymbolVersionRequirement", - "Class which represents an entry in the ``DT_VERNEED`` or ``.gnu.version_r`` table"); - - init_ref_iterator(sym_ver_req, "it_aux_requirement"); - - sym_ver_req - .def_property("version", - static_cast>(&SymbolVersionRequirement::version), - static_cast>(&SymbolVersionRequirement::version), - "Version revision. Should be 1") - - .def_property("name", - static_cast>(&SymbolVersionRequirement::name), - static_cast>(&SymbolVersionRequirement::name), - "Library's name associated with this requirement (e.g. ``libc.so.6``)") - - .def("get_auxiliary_symbols", - static_cast>(&SymbolVersionRequirement::auxiliary_symbols), - "Auxiliary entries (iterator over " RST_CLASS_REF(lief.ELF.SymbolVersionAuxRequirement) ")", - py::return_value_policy::reference_internal) - - .def("add_auxiliary_requirement", - static_cast(&SymbolVersionRequirement::add_aux_requirement), - "Add an auxiliary version requirement to the existing entries") - - .def("__eq__", &SymbolVersionRequirement::operator==) - .def("__ne__", &SymbolVersionRequirement::operator!=) - .def("__hash__", - [] (const SymbolVersionRequirement& svr) { - return Hash::hash(svr); - }) - - .def("__str__", - [] (const SymbolVersionRequirement& symbolVersionRequirement) - { - std::ostringstream stream; - stream << symbolVersionRequirement; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/ELF/objects/pySysvHash.cpp b/vendor/lief/api/python/ELF/objects/pySysvHash.cpp deleted file mode 100644 index d495721..0000000 --- a/vendor/lief/api/python/ELF/objects/pySysvHash.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "pyELF.hpp" - -#include "LIEF/ELF/hash.hpp" -#include "LIEF/ELF/SysvHash.hpp" - -namespace LIEF { -namespace ELF { - -template -using getter_t = T (SysvHash::*)() const; - -template -using setter_t = void (SysvHash::*)(T); - -template<> -void create(py::module& m) { - - py::class_(m, "SysvHash", - R"delim( - Class which represents the SYSV hash for the symbols resolution - - References: - - * http://www.linker-aliens.org/blogs/ali/entry/gnu_hash_elf_sections/ - * https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-48031.html - )delim") - .def(py::init<>()) - - .def_property_readonly("nbucket", - &SysvHash::nbucket, - "Return the number of buckets") - - .def_property("nchain", - static_cast>(&SysvHash::nchain), - static_cast>(&SysvHash::nchain), - "Return the number of *chains* (symbol table index)") - - .def_property_readonly("buckets", - &SysvHash::buckets, - "Buckets values", - py::return_value_policy::reference_internal) - - .def_property_readonly("chains", - &SysvHash::chains, - "Chains values", - py::return_value_policy::reference_internal) - - .def("__eq__", &SysvHash::operator==) - .def("__ne__", &SysvHash::operator!=) - .def("__hash__", - [] (const SysvHash& sysvhash) { - return Hash::hash(sysvhash); - }) - - - .def("__str__", - [] (const SysvHash& sysvhash) - { - std::ostringstream stream; - stream << sysvhash; - std::string str = stream.str(); - return str; - }); - - - -} - -} -} diff --git a/vendor/lief/api/python/ELF/pyELF.cpp b/vendor/lief/api/python/ELF/pyELF.cpp deleted file mode 100644 index 3525055..0000000 --- a/vendor/lief/api/python/ELF/pyELF.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" - - -namespace LIEF { -namespace ELF { -void init_python_module(py::module& m) { - py::module LIEF_ELF_module = m.def_submodule("ELF", "Python API for the ELF format"); - - init_enums(LIEF_ELF_module); - init_objects(LIEF_ELF_module); - - py::module LIEF_ELF32_module = LIEF_ELF_module.def_submodule("ELF32", ""); - init_ELF32_sizes(LIEF_ELF32_module); - - py::module LIEF_ELF64_module = LIEF_ELF_module.def_submodule("ELF64", ""); - init_ELF64_sizes(LIEF_ELF64_module); -} - -void init_objects(py::module& m) { - CREATE(Parser, m); - CREATE(SymbolVersion, m); - CREATE(Binary, m); - CREATE(Header, m); - CREATE(Section, m); - CREATE(Segment, m); - CREATE(Symbol, m); - CREATE(Relocation, m); - CREATE(SymbolVersionAux, m); - CREATE(SymbolVersionAuxRequirement, m); - CREATE(SymbolVersionDefinition,m ); - CREATE(SymbolVersionRequirement, m); - CREATE(DynamicEntry, m); - CREATE(DynamicEntryLibrary, m); - CREATE(DynamicSharedObject, m); - CREATE(DynamicEntryArray, m); - CREATE(DynamicEntryRpath, m); - CREATE(DynamicEntryRunPath, m); - CREATE(DynamicEntryFlags, m); - CREATE(GnuHash, m); - CREATE(SysvHash, m); - CREATE(Builder, m); - CREATE(Note, m); - CREATE(NoteDetails, m); - CREATE(AndroidNote, m); - CREATE(NoteAbi, m); - CREATE(CorePrPsInfo, m); - CREATE(CoreFile, m); - CREATE(CoreFileEntry, m); - CREATE(CorePrStatus, m); - CREATE(CoreAuxv, m); - CREATE(CoreSigInfo, m); -} - -} -} diff --git a/vendor/lief/api/python/ELF/pyELF.hpp b/vendor/lief/api/python/ELF/pyELF.hpp deleted file mode 100644 index 6781c65..0000000 --- a/vendor/lief/api/python/ELF/pyELF.hpp +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ELF_H_ -#define PY_LIEF_ELF_H_ - -#include -#include -#include "LIEF/ELF/NoteDetails/core/CoreFile.hpp" -#include "pyLIEF.hpp" - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - - -namespace LIEF { -namespace ELF { - -class Parser; -class Binary; -class Header; -class Section; -class Segment; -class Symbol; -class Relocation; -class SymbolVersion; -class SymbolVersionAux; -class SymbolVersionRequirement; -class SymbolVersionDefinition; -class SymbolVersionAuxRequirement; -class DynamicEntry; -class DynamicEntryLibrary; -class DynamicSharedObject; -class DynamicEntryArray; -class DynamicEntryRpath; -class DynamicEntryRunPath; -class DynamicEntryFlags; -class GnuHash; -class SysvHash; -class Builder; -class Note; -class NoteDetails; -class AndroidNote; -class NoteAbi; -class CorePrPsInfo; -class CoreFile; -class CoreFileEntry; -class CorePrStatus; -class CoreAuxv; -class CoreSigInfo; - -template -void create(py::module&); - -void init_python_module(py::module& m); -void init_objects(py::module&); -void init_enums(py::module&); - -void init_ELF32_sizes(py::module&); -void init_ELF64_sizes(py::module&); - -SPECIALIZE_CREATE(Parser); -SPECIALIZE_CREATE(Binary); -SPECIALIZE_CREATE(Header); -SPECIALIZE_CREATE(Section); -SPECIALIZE_CREATE(Segment); -SPECIALIZE_CREATE(Symbol); -SPECIALIZE_CREATE(Relocation); -SPECIALIZE_CREATE(SymbolVersion); -SPECIALIZE_CREATE(SymbolVersionAux); -SPECIALIZE_CREATE(SymbolVersionRequirement); -SPECIALIZE_CREATE(SymbolVersionDefinition); -SPECIALIZE_CREATE(SymbolVersionAuxRequirement); -SPECIALIZE_CREATE(DynamicEntry); -SPECIALIZE_CREATE(DynamicEntryLibrary); -SPECIALIZE_CREATE(DynamicSharedObject); -SPECIALIZE_CREATE(DynamicEntryArray); -SPECIALIZE_CREATE(DynamicEntryRpath); -SPECIALIZE_CREATE(DynamicEntryRunPath); -SPECIALIZE_CREATE(DynamicEntryFlags); -SPECIALIZE_CREATE(GnuHash); -SPECIALIZE_CREATE(SysvHash); -SPECIALIZE_CREATE(Builder); -SPECIALIZE_CREATE(Note); -SPECIALIZE_CREATE(NoteDetails); -SPECIALIZE_CREATE(AndroidNote); -SPECIALIZE_CREATE(NoteAbi); -SPECIALIZE_CREATE(CorePrPsInfo); -SPECIALIZE_CREATE(CoreFile); -SPECIALIZE_CREATE(CoreFileEntry); -SPECIALIZE_CREATE(CorePrStatus); -SPECIALIZE_CREATE(CoreAuxv); -SPECIALIZE_CREATE(CoreSigInfo); - -} -} - -PYBIND11_MAKE_OPAQUE(LIEF::ELF::CoreFile::files_t); - -#endif diff --git a/vendor/lief/api/python/ELF/pyEnums.cpp b/vendor/lief/api/python/ELF/pyEnums.cpp deleted file mode 100644 index b8fb943..0000000 --- a/vendor/lief/api/python/ELF/pyEnums.cpp +++ /dev/null @@ -1,1277 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyELF.hpp" -#include "enums_wrapper.hpp" - -#include "LIEF/ELF/enums.hpp" -#include "LIEF/ELF/EnumToString.hpp" - -#define PY_ENUM(x) to_string(x), x - -namespace LIEF { -namespace ELF { - -void init_enums(py::module& m) { - - LIEF::enum_(m, "ELF_CLASS") - .value(PY_ENUM(ELF_CLASS::ELFCLASSNONE)) - .value(PY_ENUM(ELF_CLASS::ELFCLASS32)) - .value(PY_ENUM(ELF_CLASS::ELFCLASS64)); - - - LIEF::enum_(m, "ELF_DATA") - .value(PY_ENUM(ELF_DATA::ELFDATANONE)) - .value(PY_ENUM(ELF_DATA::ELFDATA2LSB)) - .value(PY_ENUM(ELF_DATA::ELFDATA2MSB)); - - LIEF::enum_(m, "OS_ABI") - .value(PY_ENUM(OS_ABI::ELFOSABI_SYSTEMV)) - .value(PY_ENUM(OS_ABI::ELFOSABI_HPUX)) - .value(PY_ENUM(OS_ABI::ELFOSABI_NETBSD)) - .value(PY_ENUM(OS_ABI::ELFOSABI_LINUX)) - .value("GNU", OS_ABI::ELFOSABI_GNU) - .value(PY_ENUM(OS_ABI::ELFOSABI_HURD)) - .value(PY_ENUM(OS_ABI::ELFOSABI_SOLARIS)) - .value(PY_ENUM(OS_ABI::ELFOSABI_AIX)) - .value(PY_ENUM(OS_ABI::ELFOSABI_IRIX)) - .value(PY_ENUM(OS_ABI::ELFOSABI_FREEBSD)) - .value(PY_ENUM(OS_ABI::ELFOSABI_TRU64)) - .value(PY_ENUM(OS_ABI::ELFOSABI_MODESTO)) - .value(PY_ENUM(OS_ABI::ELFOSABI_OPENBSD)) - .value(PY_ENUM(OS_ABI::ELFOSABI_OPENVMS)) - .value(PY_ENUM(OS_ABI::ELFOSABI_NSK)) - .value(PY_ENUM(OS_ABI::ELFOSABI_AROS)) - .value(PY_ENUM(OS_ABI::ELFOSABI_FENIXOS)) - .value(PY_ENUM(OS_ABI::ELFOSABI_CLOUDABI)) - .value(PY_ENUM(OS_ABI::ELFOSABI_AMDGPU_HSA)) - .value("C6000_ELFABI", OS_ABI::ELFOSABI_C6000_ELFABI) - .value(PY_ENUM(OS_ABI::ELFOSABI_C6000_LINUX)) - .value(PY_ENUM(OS_ABI::ELFOSABI_ARM)) - .value(PY_ENUM(OS_ABI::ELFOSABI_STANDALONE)); - - // Enum for the *e_type* of ElfXX_Ehdr - LIEF::enum_(m, "E_TYPE") - .value(PY_ENUM(E_TYPE::ET_NONE)) - .value(PY_ENUM(E_TYPE::ET_REL)) - .value(PY_ENUM(E_TYPE::ET_EXEC)) - .value(PY_ENUM(E_TYPE::ET_DYN)) - .value(PY_ENUM(E_TYPE::ET_CORE)) - .value(PY_ENUM(E_TYPE::ET_LOPROC)) - .value(PY_ENUM(E_TYPE::ET_HIPROC)); - - //! Enum for the *e_version* of ElfXX_Ehdr; - LIEF::enum_(m, "VERSION") - .value(PY_ENUM(VERSION::EV_NONE)) - .value(PY_ENUM(VERSION::EV_CURRENT)); - - // Enum for the *e_machine* of ElfXX_Ehdr - LIEF::enum_(m, "ARCH") - .value(PY_ENUM(ARCH::EM_NONE)) - .value(PY_ENUM(ARCH::EM_M32)) - .value(PY_ENUM(ARCH::EM_SPARC)) - .value(PY_ENUM(ARCH::EM_386)) - .value(PY_ENUM(ARCH::EM_68K)) - .value(PY_ENUM(ARCH::EM_88K)) - .value(PY_ENUM(ARCH::EM_IAMCU)) - .value(PY_ENUM(ARCH::EM_860)) - .value(PY_ENUM(ARCH::EM_MIPS)) - .value(PY_ENUM(ARCH::EM_S370)) - .value(PY_ENUM(ARCH::EM_MIPS_RS3_LE)) - .value(PY_ENUM(ARCH::EM_PARISC)) - .value(PY_ENUM(ARCH::EM_VPP500)) - .value(PY_ENUM(ARCH::EM_SPARC32PLUS)) - .value(PY_ENUM(ARCH::EM_960)) - .value(PY_ENUM(ARCH::EM_PPC)) - .value(PY_ENUM(ARCH::EM_PPC64)) - .value(PY_ENUM(ARCH::EM_S390)) - .value(PY_ENUM(ARCH::EM_SPU)) - .value(PY_ENUM(ARCH::EM_V800)) - .value(PY_ENUM(ARCH::EM_FR20)) - .value(PY_ENUM(ARCH::EM_RH32)) - .value(PY_ENUM(ARCH::EM_RCE)) - .value(PY_ENUM(ARCH::EM_ARM)) - .value(PY_ENUM(ARCH::EM_ALPHA)) - .value(PY_ENUM(ARCH::EM_SH)) - .value(PY_ENUM(ARCH::EM_SPARCV9)) - .value(PY_ENUM(ARCH::EM_TRICORE)) - .value(PY_ENUM(ARCH::EM_ARC)) - .value(PY_ENUM(ARCH::EM_H8_300)) - .value(PY_ENUM(ARCH::EM_H8_300H)) - .value(PY_ENUM(ARCH::EM_H8S)) - .value(PY_ENUM(ARCH::EM_H8_500)) - .value(PY_ENUM(ARCH::EM_IA_64)) - .value(PY_ENUM(ARCH::EM_MIPS_X)) - .value(PY_ENUM(ARCH::EM_COLDFIRE)) - .value(PY_ENUM(ARCH::EM_68HC12)) - .value(PY_ENUM(ARCH::EM_MMA)) - .value(PY_ENUM(ARCH::EM_PCP)) - .value(PY_ENUM(ARCH::EM_NCPU)) - .value(PY_ENUM(ARCH::EM_NDR1)) - .value(PY_ENUM(ARCH::EM_STARCORE)) - .value(PY_ENUM(ARCH::EM_ME16)) - .value(PY_ENUM(ARCH::EM_ST100)) - .value(PY_ENUM(ARCH::EM_TINYJ)) - .value(PY_ENUM(ARCH::EM_X86_64)) - .value(PY_ENUM(ARCH::EM_PDSP)) - .value(PY_ENUM(ARCH::EM_PDP10)) - .value(PY_ENUM(ARCH::EM_PDP11)) - .value(PY_ENUM(ARCH::EM_FX66)) - .value(PY_ENUM(ARCH::EM_ST9PLUS)) - .value(PY_ENUM(ARCH::EM_ST7)) - .value(PY_ENUM(ARCH::EM_68HC16)) - .value(PY_ENUM(ARCH::EM_68HC11)) - .value(PY_ENUM(ARCH::EM_68HC08)) - .value(PY_ENUM(ARCH::EM_68HC05)) - .value(PY_ENUM(ARCH::EM_SVX)) - .value(PY_ENUM(ARCH::EM_ST19)) - .value(PY_ENUM(ARCH::EM_VAX)) - .value(PY_ENUM(ARCH::EM_CRIS)) - .value(PY_ENUM(ARCH::EM_JAVELIN)) - .value(PY_ENUM(ARCH::EM_FIREPATH)) - .value(PY_ENUM(ARCH::EM_ZSP)) - .value(PY_ENUM(ARCH::EM_MMIX)) - .value(PY_ENUM(ARCH::EM_HUANY)) - .value(PY_ENUM(ARCH::EM_PRISM)) - .value(PY_ENUM(ARCH::EM_AVR)) - .value(PY_ENUM(ARCH::EM_FR30)) - .value(PY_ENUM(ARCH::EM_D10V)) - .value(PY_ENUM(ARCH::EM_D30V)) - .value(PY_ENUM(ARCH::EM_V850)) - .value(PY_ENUM(ARCH::EM_M32R)) - .value(PY_ENUM(ARCH::EM_MN10300)) - .value(PY_ENUM(ARCH::EM_MN10200)) - .value(PY_ENUM(ARCH::EM_PJ)) - .value(PY_ENUM(ARCH::EM_OPENRISC)) - .value(PY_ENUM(ARCH::EM_ARC_COMPACT)) - .value(PY_ENUM(ARCH::EM_XTENSA)) - .value(PY_ENUM(ARCH::EM_VIDEOCORE)) - .value(PY_ENUM(ARCH::EM_TMM_GPP)) - .value(PY_ENUM(ARCH::EM_NS32K)) - .value(PY_ENUM(ARCH::EM_TPC)) - .value(PY_ENUM(ARCH::EM_SNP1K)) - .value(PY_ENUM(ARCH::EM_ST200)) - .value(PY_ENUM(ARCH::EM_IP2K)) - .value(PY_ENUM(ARCH::EM_MAX)) - .value(PY_ENUM(ARCH::EM_CR)) - .value(PY_ENUM(ARCH::EM_F2MC16)) - .value(PY_ENUM(ARCH::EM_MSP430)) - .value(PY_ENUM(ARCH::EM_BLACKFIN)) - .value(PY_ENUM(ARCH::EM_SE_C33)) - .value(PY_ENUM(ARCH::EM_SEP)) - .value(PY_ENUM(ARCH::EM_ARCA)) - .value(PY_ENUM(ARCH::EM_UNICORE)) - .value(PY_ENUM(ARCH::EM_EXCESS)) - .value(PY_ENUM(ARCH::EM_DXP)) - .value(PY_ENUM(ARCH::EM_ALTERA_NIOS2)) - .value(PY_ENUM(ARCH::EM_CRX)) - .value(PY_ENUM(ARCH::EM_XGATE)) - .value(PY_ENUM(ARCH::EM_C166)) - .value(PY_ENUM(ARCH::EM_M16C)) - .value(PY_ENUM(ARCH::EM_DSPIC30F)) - .value(PY_ENUM(ARCH::EM_CE)) - .value(PY_ENUM(ARCH::EM_M32C)) - .value(PY_ENUM(ARCH::EM_TSK3000)) - .value(PY_ENUM(ARCH::EM_RS08)) - .value(PY_ENUM(ARCH::EM_SHARC)) - .value(PY_ENUM(ARCH::EM_ECOG2)) - .value(PY_ENUM(ARCH::EM_SCORE7)) - .value(PY_ENUM(ARCH::EM_DSP24)) - .value(PY_ENUM(ARCH::EM_VIDEOCORE3)) - .value(PY_ENUM(ARCH::EM_LATTICEMICO32)) - .value(PY_ENUM(ARCH::EM_SE_C17)) - .value(PY_ENUM(ARCH::EM_TI_C6000)) - .value(PY_ENUM(ARCH::EM_TI_C2000)) - .value(PY_ENUM(ARCH::EM_TI_C5500)) - .value(PY_ENUM(ARCH::EM_MMDSP_PLUS)) - .value(PY_ENUM(ARCH::EM_CYPRESS_M8C)) - .value(PY_ENUM(ARCH::EM_R32C)) - .value(PY_ENUM(ARCH::EM_TRIMEDIA)) - .value(PY_ENUM(ARCH::EM_HEXAGON)) - .value(PY_ENUM(ARCH::EM_8051)) - .value(PY_ENUM(ARCH::EM_STXP7X)) - .value(PY_ENUM(ARCH::EM_NDS32)) - .value("ECOG1", ARCH::EM_ECOG1) - .value("ECOG1X", ARCH::EM_ECOG1X) - .value(PY_ENUM(ARCH::EM_MAXQ30)) - .value(PY_ENUM(ARCH::EM_XIMO16)) - .value(PY_ENUM(ARCH::EM_MANIK)) - .value(PY_ENUM(ARCH::EM_CRAYNV2)) - .value(PY_ENUM(ARCH::EM_RX)) - .value(PY_ENUM(ARCH::EM_METAG)) - .value(PY_ENUM(ARCH::EM_MCST_ELBRUS)) - .value(PY_ENUM(ARCH::EM_ECOG16)) - .value(PY_ENUM(ARCH::EM_CR16)) - .value(PY_ENUM(ARCH::EM_ETPU)) - .value(PY_ENUM(ARCH::EM_SLE9X)) - .value(PY_ENUM(ARCH::EM_L10M)) - .value(PY_ENUM(ARCH::EM_K10M)) - .value(PY_ENUM(ARCH::EM_AARCH64)) - .value(PY_ENUM(ARCH::EM_AVR32)) - .value(PY_ENUM(ARCH::EM_STM8)) - .value(PY_ENUM(ARCH::EM_TILE64)) - .value(PY_ENUM(ARCH::EM_TILEPRO)) - .value(PY_ENUM(ARCH::EM_CUDA)) - .value(PY_ENUM(ARCH::EM_TILEGX)) - .value(PY_ENUM(ARCH::EM_CLOUDSHIELD)) - .value(PY_ENUM(ARCH::EM_COREA_1ST)) - .value(PY_ENUM(ARCH::EM_COREA_2ND)) - .value(PY_ENUM(ARCH::EM_ARC_COMPACT2)) - .value(PY_ENUM(ARCH::EM_OPEN8)) - .value(PY_ENUM(ARCH::EM_RL78)) - .value(PY_ENUM(ARCH::EM_VIDEOCORE5)) - .value(PY_ENUM(ARCH::EM_78KOR)) - .value(PY_ENUM(ARCH::EM_56800EX)) - .value(PY_ENUM(ARCH::EM_BA1)) - .value(PY_ENUM(ARCH::EM_BA2)) - .value(PY_ENUM(ARCH::EM_XCORE)) - .value(PY_ENUM(ARCH::EM_MCHP_PIC)) - .value(PY_ENUM(ARCH::EM_INTEL205)) - .value(PY_ENUM(ARCH::EM_INTEL206)) - .value(PY_ENUM(ARCH::EM_INTEL207)) - .value(PY_ENUM(ARCH::EM_INTEL208)) - .value(PY_ENUM(ARCH::EM_INTEL209)) - .value(PY_ENUM(ARCH::EM_KM32)) - .value(PY_ENUM(ARCH::EM_KMX32)) - .value(PY_ENUM(ARCH::EM_KMX16)) - .value(PY_ENUM(ARCH::EM_KMX8)) - .value(PY_ENUM(ARCH::EM_KVARC)) - .value(PY_ENUM(ARCH::EM_CDP)) - .value(PY_ENUM(ARCH::EM_COGE)) - .value(PY_ENUM(ARCH::EM_COOL)) - .value(PY_ENUM(ARCH::EM_NORC)) - .value(PY_ENUM(ARCH::EM_CSR_KALIMBA)) - .value(PY_ENUM(ARCH::EM_AMDGPU)) - .value(PY_ENUM(ARCH::EM_RISCV)) - .value(PY_ENUM(ARCH::EM_BPF)); - - - //! Enum for the *sh_type* of ElfXX_Shdr; - LIEF::enum_(m, "SECTION_TYPES") - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_NULL)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_PROGBITS)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_SYMTAB)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_STRTAB)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_RELA)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HASH)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_DYNAMIC)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_NOTE)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_NOBITS)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_REL)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_SHLIB)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_DYNSYM)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_INIT_ARRAY)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_FINI_ARRAY)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_PREINIT_ARRAY)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GROUP)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_SYMTAB_SHNDX)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_LOOS)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_ATTRIBUTES)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_HASH)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_verdef)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_verneed)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_versym)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ANDROID_REL)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ANDROID_RELA)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_LLVM_ADDRSIG)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_RELR)) - - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_EXIDX)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_PREEMPTMAP)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_ATTRIBUTES)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_DEBUGOVERLAY)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_OVERLAYSECTION)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HEX_ORDERED)) - .value("X86_64_UNWIND", ELF_SECTION_TYPES::SHT_X86_64_UNWIND) - //.value(PY_ENUM(ELF_SECTION_TYPES::SHT_MIPS_REGINFO)) - //.value(PY_ENUM(ELF_SECTION_TYPES::SHT_MIPS_OPTIONS)) - //.value(PY_ENUM(ELF_SECTION_TYPES::SHT_MIPS_ABIFLAGS)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HIPROC)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_LOUSER)) - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HIUSER)); - - - //! Enum for the *sh_flags* field of ElfXX_Shdr; - LIEF::enum_(m, "SECTION_FLAGS", py::arithmetic()) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_NONE)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_WRITE)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_ALLOC)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_EXECINSTR)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_MERGE)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_STRINGS)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_INFO_LINK)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_LINK_ORDER)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_OS_NONCONFORMING)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_GROUP)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_TLS)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_EXCLUDE)) - .value("SHF_CP_SECTION", ELF_SECTION_FLAGS::XCORE_SHF_CP_SECTION) - .value(PY_ENUM(ELF_SECTION_FLAGS::XCORE_SHF_DP_SECTION)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_MASKOS)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_MASKPROC)) - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_HEX_GPREL)); - - //! Enum for the *p_type* field of ElfXX_Phdr - LIEF::enum_(m, "SEGMENT_TYPES") - .value(PY_ENUM(SEGMENT_TYPES::PT_NULL)) - .value(PY_ENUM(SEGMENT_TYPES::PT_LOAD)) - .value(PY_ENUM(SEGMENT_TYPES::PT_DYNAMIC)) - .value(PY_ENUM(SEGMENT_TYPES::PT_INTERP)) - .value(PY_ENUM(SEGMENT_TYPES::PT_NOTE)) - .value(PY_ENUM(SEGMENT_TYPES::PT_SHLIB)) - .value(PY_ENUM(SEGMENT_TYPES::PT_PHDR)) - .value(PY_ENUM(SEGMENT_TYPES::PT_TLS)) - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_EH_FRAME)) - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_PROPERTY)) - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_STACK)) - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_RELRO)) - .value(PY_ENUM(SEGMENT_TYPES::PT_ARM_ARCHEXT)) - .value(PY_ENUM(SEGMENT_TYPES::PT_ARM_EXIDX)) - .value("UNWIND", SEGMENT_TYPES::PT_ARM_UNWIND); - - //! Enum for the *p_flags* field of ElfXX_Phdr - LIEF::enum_(m, "SEGMENT_FLAGS", py::arithmetic()) - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_NONE)) - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_X)) - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_W)) - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_R)); - - LIEF::enum_(m, "DYNAMIC_TAGS") - .value(PY_ENUM(DYNAMIC_TAGS::DT_NULL)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_NEEDED)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_PLTRELSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_PLTGOT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_HASH)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_STRTAB)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_SYMTAB)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELA)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELASZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELAENT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_STRSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_SYMENT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_INIT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_FINI)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_SONAME)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RPATH)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_SYMBOLIC)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_REL)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELENT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_PLTREL)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_DEBUG)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_TEXTREL)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_JMPREL)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_BIND_NOW)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_INIT_ARRAY)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_FINI_ARRAY)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_INIT_ARRAYSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_FINI_ARRAYSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RUNPATH)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_FLAGS)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_PREINIT_ARRAY)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_PREINIT_ARRAYSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_GNU_HASH)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELACOUNT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELCOUNT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_FLAGS_1)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERSYM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERDEF)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERDEFNUM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERNEED)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERNEEDNUM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RLD_VERSION)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_TIME_STAMP)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_ICHECKSUM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_IVERSION)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_FLAGS)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_BASE_ADDRESS)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_MSYM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_CONFLICT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LIBLIST)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LOCAL_GOTNO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_CONFLICTNO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LIBLISTNO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_SYMTABNO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_UNREFEXTNO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_GOTSYM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_HIPAGENO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RLD_MAP)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASS)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASS_NO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_INSTANCE)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_INSTANCE_NO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_RELOC)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_RELOC_NO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_SYM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_SYM_NO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASSSYM)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASSSYM_NO)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_CXX_FLAGS)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PIXIE_INIT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_SYMBOL_LIB)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LOCALPAGE_GOTIDX)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LOCAL_GOTIDX)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_HIDDEN_GOTIDX)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PROTECTED_GOTIDX)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_OPTIONS)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_INTERFACE)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DYNSTR_ALIGN)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_INTERFACE_SIZE)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RLD_TEXT_RESOLVE_ADDR)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PERF_SUFFIX)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_COMPACT_SIZE)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_GP_VALUE)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_AUX_DYNAMIC)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PLTGOT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RWPLT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_REL_OFFSET)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_REL_SIZE)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_REL)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELA)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELASZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELR)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELRSZ)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELRENT)) - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELRCOUNT)); - - - LIEF::enum_(m, "SYMBOL_TYPES") - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_NOTYPE)) - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_OBJECT)) - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_FUNC)) - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_SECTION)) - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_FILE)) - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_COMMON)) - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_TLS)) - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_GNU_IFUNC)); - - - LIEF::enum_(m, "SYMBOL_BINDINGS") - .value(PY_ENUM(SYMBOL_BINDINGS::STB_LOCAL)) - .value(PY_ENUM(SYMBOL_BINDINGS::STB_GLOBAL)) - .value(PY_ENUM(SYMBOL_BINDINGS::STB_WEAK)) - .value(PY_ENUM(SYMBOL_BINDINGS::STB_GNU_UNIQUE)); - - - LIEF::enum_(m, "RELOCATION_X86_64") - .value(PY_ENUM(RELOC_x86_64::R_X86_64_NONE)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOT32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PLT32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_COPY)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GLOB_DAT)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_JUMP_SLOT)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_RELATIVE)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPCREL)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_32S)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_16)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC16)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_8)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC8)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_DTPMOD64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_DTPOFF64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TPOFF64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSGD)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSLD)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_DTPOFF32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTTPOFF)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TPOFF32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTOFF64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPC32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOT64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPCREL64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPC64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPLT64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PLTOFF64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_SIZE32)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_SIZE64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPC32_TLSDESC)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSDESC_CALL)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSDESC)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_IRELATIVE)) - - .value(PY_ENUM(RELOC_x86_64::R_X86_64_RELATIVE64)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC32_BND)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PLT32_BND)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPCRELX)) - .value(PY_ENUM(RELOC_x86_64::R_X86_64_REX_GOTPCRELX)); - - - LIEF::enum_(m, "RELOCATION_ARM") - .value(PY_ENUM(RELOC_ARM::R_ARM_NONE)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PC24)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_REL32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_PC_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS16)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS12)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_ABS5)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS8)) - .value(PY_ENUM(RELOC_ARM::R_ARM_SBREL32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_CALL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_PC8)) - .value(PY_ENUM(RELOC_ARM::R_ARM_BREL_ADJ)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DESC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_SWI8)) - .value(PY_ENUM(RELOC_ARM::R_ARM_XPC25)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_XPC22)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DTPMOD32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DTPOFF32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_TPOFF32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_COPY)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GLOB_DAT)) - .value(PY_ENUM(RELOC_ARM::R_ARM_JUMP_SLOT)) - .value(PY_ENUM(RELOC_ARM::R_ARM_RELATIVE)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GOTOFF32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_BASE_PREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_BREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PLT32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_CALL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_JUMP24)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP24)) - .value(PY_ENUM(RELOC_ARM::R_ARM_BASE_ABS)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PCREL_7_0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PCREL_15_8)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PCREL_23_15)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SBREL_11_0_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SBREL_19_12_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SBREL_27_20_CK)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TARGET1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_SBREL31)) - .value(PY_ENUM(RELOC_ARM::R_ARM_V4BX)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TARGET2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PREL31)) - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_ABS_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVT_ABS)) - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_PREL_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVT_PREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_ABS_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVT_ABS)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_PREL_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVT_PREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP19)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP6)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_ALU_PREL_11_0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_PC12)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS32_NOI)) - .value(PY_ENUM(RELOC_ARM::R_ARM_REL32_NOI)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G0_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G1_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_PC_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_PC_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_PC_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_PC_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_PC_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_PC_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_PC_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_PC_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G0_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G1_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SB_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SB_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SB_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_SB_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_SB_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_SB_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_SB_G0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_SB_G1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_SB_G2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_BREL_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVT_BREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_BREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_BREL_NC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVT_BREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_BREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_GOTDESC)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_CALL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DESCSEQ)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_TLS_CALL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PLT32_ABS)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_ABS)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_PREL)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_BREL12)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GOTOFF12)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GOTRELAX)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GNU_VTENTRY)) - .value(PY_ENUM(RELOC_ARM::R_ARM_GNU_VTINHERIT)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP11)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP8)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_GD32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LDM32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LDO32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_IE32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LE32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LDO12)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LE12)) - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_IE12GP)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_0)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_1)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_2)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_3)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_4)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_5)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_6)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_7)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_8)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_9)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_10)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_11)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_12)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_13)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_14)) - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_15)) - .value(PY_ENUM(RELOC_ARM::R_ARM_ME_TOO)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_TLS_DESCSEQ16)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_TLS_DESCSEQ32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_IRELATIVE)) - .value(PY_ENUM(RELOC_ARM::R_ARM_RXPC25)) - .value(PY_ENUM(RELOC_ARM::R_ARM_RSBREL32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_RPC22)) - .value(PY_ENUM(RELOC_ARM::R_ARM_RREL32)) - .value(PY_ENUM(RELOC_ARM::R_ARM_RPC24)) - .value(PY_ENUM(RELOC_ARM::R_ARM_RBASE)); - - - LIEF::enum_(m, "RELOCATION_i386") - .value(PY_ENUM(RELOC_i386::R_386_NONE)) - .value(PY_ENUM(RELOC_i386::R_386_32)) - .value(PY_ENUM(RELOC_i386::R_386_PC32)) - .value(PY_ENUM(RELOC_i386::R_386_GOT32)) - .value(PY_ENUM(RELOC_i386::R_386_PLT32)) - .value(PY_ENUM(RELOC_i386::R_386_COPY)) - .value(PY_ENUM(RELOC_i386::R_386_GLOB_DAT)) - .value(PY_ENUM(RELOC_i386::R_386_JUMP_SLOT)) - .value(PY_ENUM(RELOC_i386::R_386_RELATIVE)) - .value(PY_ENUM(RELOC_i386::R_386_GOTOFF)) - .value(PY_ENUM(RELOC_i386::R_386_GOTPC)) - .value(PY_ENUM(RELOC_i386::R_386_32PLT)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_TPOFF)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_IE)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_GOTIE)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LE)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM)) - .value(PY_ENUM(RELOC_i386::R_386_16)) - .value(PY_ENUM(RELOC_i386::R_386_PC16)) - .value(PY_ENUM(RELOC_i386::R_386_8)) - .value(PY_ENUM(RELOC_i386::R_386_PC8)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_PUSH)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_CALL)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_POP)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_PUSH)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_CALL)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_POP)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDO_32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_IE_32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_LE_32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_DTPMOD32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_DTPOFF32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_TPOFF32)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_GOTDESC)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_DESC_CALL)) - .value(PY_ENUM(RELOC_i386::R_386_TLS_DESC)) - .value(PY_ENUM(RELOC_i386::R_386_IRELATIVE)) - .value(PY_ENUM(RELOC_i386::R_386_NUM)); - - - LIEF::enum_(m, "RELOCATION_AARCH64") - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_NONE)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ABS64)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ABS32)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ABS16)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_PREL64)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_PREL32)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_PREL16)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G0)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G1_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G2)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G2_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G3)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_SABS_G0)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_SABS_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_SABS_G2)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD_PREL_LO19)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_PREL_LO21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_PREL_PG_HI21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_PREL_PG_HI21_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADD_ABS_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST8_ABS_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TSTBR14)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_CONDBR19)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_JUMP26)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_CALL26)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST16_ABS_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST32_ABS_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST64_ABS_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G0)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G1_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G2)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G2_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G3)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST128_ABS_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G0)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G1_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G2)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G2_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G3)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GOTREL64)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GOTREL32)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GOT_LD_PREL19)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD64_GOTOFF_LO15)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_GOT_PAGE)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD64_GOT_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD64_GOTPAGE_LO15)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_ADR_PREL21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_ADR_PAGE21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_ADD_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_MOVW_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_MOVW_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADR_PREL21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADR_PAGE21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LD_PREL19)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G2)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G0)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_DTPREL_HI12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_DTPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST8_DTPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST16_DTPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST32_DTPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST64_DTPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_MOVW_GOTTPREL_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_LD_GOTTPREL_PREL19)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G2)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G0)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_ADD_TPREL_HI12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_ADD_TPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST8_TPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST16_TPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST32_TPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST64_TPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_LD_PREL19)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADR_PREL21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADR_PAGE21)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_LD64_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADD_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_OFF_G1)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_OFF_G0_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_LDR)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADD)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_CALL)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST128_TPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST128_DTPREL_LO12)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_COPY)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GLOB_DAT)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_JUMP_SLOT)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_RELATIVE)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLS_DTPREL64)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLS_DTPMOD64)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLS_TPREL64)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC)) - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_IRELATIVE)); - - LIEF::enum_(m, "RELOCATION_PPC") - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_NONE)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR32)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR24)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR14)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR14_BRTAKEN)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR14_BRNTAKEN)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL24)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL14)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL14_BRTAKEN)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL14_BRNTAKEN)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_PLTREL24)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_JMP_SLOT)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_RELATIVE)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_LOCAL24PC)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL32)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TLS)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPMOD32)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL32)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL32)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TLSGD)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TLSLD)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16_LO)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16_HI)) - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16_HA)); - - LIEF::enum_(m, "RELOCATION_PPC64") - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_NONE)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR32)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR24)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR14)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR14_BRTAKEN)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR14_BRNTAKEN)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL24)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL14)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL14_BRTAKEN)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL14_BRNTAKEN)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_JMP_SLOT)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_RELATIVE)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL32)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR64)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHER)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHERA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHEST)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHESTA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL64)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_LO_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_LO_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_LO_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TLS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPMOD64)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL64)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL64)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_LO_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_LO_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_HA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_LO_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHER)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHERA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHEST)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHESTA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_LO_DS)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHER)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHERA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHEST)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHESTA)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TLSGD)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TLSLD)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16_LO)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16_HI)) - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16_HA)); - - LIEF::enum_(m, "RELOCATION_MIPS") - .value(PY_ENUM(RELOC_MIPS::R_MIPS_NONE)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_32)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_REL32)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_26)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GPREL16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_LITERAL)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_CALL16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GPREL32)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_UNUSED1)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_UNUSED2)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_UNUSED3)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SHIFT5)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SHIFT6)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_64)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_DISP)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_PAGE)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_OFST)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SUB)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_INSERT_A)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_INSERT_B)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_DELETE)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_HIGHER)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_HIGHEST)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_CALL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_CALL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SCN_DISP)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_REL16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_ADD_IMMEDIATE)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PJUMP)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_RELGOT)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_JALR)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPMOD32)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL32)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPMOD64)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL64)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_GD)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_LDM)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_GOTTPREL)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL32)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL64)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GLOB_DAT)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC21_S2)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC26_S2)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC18_S3)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC19_S2)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PCHI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PCLO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_26)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_GPREL)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_GOT16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_CALL16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_GD)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_LDM)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_DTPREL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_DTPREL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_GOTTPREL)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_TPREL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_TPREL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_COPY)) - .value(PY_ENUM(RELOC_MIPS::R_MIPS_JUMP_SLOT)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_26_S1)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GPREL16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_LITERAL)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC7_S1)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC10_S1)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC16_S1)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_CALL16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_DISP)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_PAGE)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_OFST)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_SUB)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HIGHER)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HIGHEST)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_CALL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_CALL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_SCN_DISP)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_JALR)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HI0_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_GD)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_LDM)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_DTPREL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_DTPREL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_GOTTPREL)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_TPREL_HI16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_TPREL_LO16)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GPREL7_S2)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC23_S2)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC21_S2)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC26_S2)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC18_S3)) - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC19_S2)); - - - LIEF::enum_(m, "DYNSYM_COUNT_METHODS") - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_AUTO)) - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_SECTION)) - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_HASH)) - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_RELOCATIONS)); - - - LIEF::enum_(m, "NOTE_TYPES") - .value(PY_ENUM(NOTE_TYPES::NT_UNKNOWN)) - .value(PY_ENUM(NOTE_TYPES::NT_GNU_ABI_TAG)) - .value(PY_ENUM(NOTE_TYPES::NT_GNU_HWCAP)) - .value(PY_ENUM(NOTE_TYPES::NT_GNU_BUILD_ID)) - .value(PY_ENUM(NOTE_TYPES::NT_GNU_GOLD_VERSION)) - .value(PY_ENUM(NOTE_TYPES::NT_GNU_PROPERTY_TYPE_0)) - .value(PY_ENUM(NOTE_TYPES::NT_CRASHPAD)); - - - LIEF::enum_(m, "NOTE_TYPES_CORE") - .value(PY_ENUM(NOTE_TYPES_CORE::NT_CORE_UNKNOWN)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_PRSTATUS)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_PRFPREG)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_PRPSINFO)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_TASKSTRUCT)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_AUXV)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_SIGINFO)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_FILE)) - - .value(PY_ENUM(NOTE_TYPES_CORE::NT_ARM_VFP)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_ARM_TLS)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_ARM_HW_BREAK)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_ARM_HW_WATCH)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_ARM_SYSTEM_CALL)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_ARM_SVE)) - - .value(PY_ENUM(NOTE_TYPES_CORE::NT_386_TLS)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_386_IOPERM)) - .value(PY_ENUM(NOTE_TYPES_CORE::NT_386_XSTATE)); - - - LIEF::enum_(m, "NOTE_ABIS") - .value(PY_ENUM(NOTE_ABIS::ELF_NOTE_UNKNOWN)) - .value(PY_ENUM(NOTE_ABIS::ELF_NOTE_OS_LINUX)) - .value(PY_ENUM(NOTE_ABIS::ELF_NOTE_OS_GNU)) - .value(PY_ENUM(NOTE_ABIS::ELF_NOTE_OS_SOLARIS2)) - .value(PY_ENUM(NOTE_ABIS::ELF_NOTE_OS_FREEBSD)) - .value(PY_ENUM(NOTE_ABIS::ELF_NOTE_OS_NETBSD)) - .value(PY_ENUM(NOTE_ABIS::ELF_NOTE_OS_SYLLABLE)); - - - LIEF::enum_(m, "RELOCATION_PURPOSES") - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_NONE)) - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_PLTGOT)) - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_DYNAMIC)) - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_OBJECT)); - - - LIEF::enum_(m, "ARM_EFLAGS", py::arithmetic()) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_SOFT_FLOAT)) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_VFP_FLOAT)) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_UNKNOWN)) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER1)) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER2)) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER3)) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER4)) - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER5)); - - - LIEF::enum_(m, "PPC64_EFLAGS", py::arithmetic()) - .value(PY_ENUM(PPC64_EFLAGS::EF_PPC64_ABI)); - - LIEF::enum_(m, "MIPS_EFLAGS", py::arithmetic()) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_NOREORDER)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_PIC)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_CPIC)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI2)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_32BITMODE)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_FP64)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_NAN2008)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_O32)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_O64)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_EABI32)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_EABI64)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_3900)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4010)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4100)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4650)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4120)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4111)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_SB1)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_OCTEON)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_XLR)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_OCTEON2)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_OCTEON3)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_5400)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_5900)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_5500)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_9000)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_LS2E)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_LS2F)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_LS3A)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MICROMIPS)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_ASE_M16)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_ASE_MDMX)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_1)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_2)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_3)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_4)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_5)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_32)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_64)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_32R2)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_64R2)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_32R6)) - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_64R6)); - - LIEF::enum_(m, "HEXAGON_EFLAGS", py::arithmetic()) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V2)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V3)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V4)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V5)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_MACH)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V2)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V3)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V4)) - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V5)); - - - LIEF::enum_(m, "IDENTITY") - .value(PY_ENUM(IDENTITY::EI_MAG0)) - .value(PY_ENUM(IDENTITY::EI_MAG1)) - .value(PY_ENUM(IDENTITY::EI_MAG2)) - .value(PY_ENUM(IDENTITY::EI_MAG3)) - .value(PY_ENUM(IDENTITY::EI_CLASS)) - .value(PY_ENUM(IDENTITY::EI_DATA)) - .value(PY_ENUM(IDENTITY::EI_VERSION)) - .value(PY_ENUM(IDENTITY::EI_OSABI)) - .value(PY_ENUM(IDENTITY::EI_ABIVERSION)) - .value(PY_ENUM(IDENTITY::EI_PAD)) - .value(PY_ENUM(IDENTITY::EI_NIDENT)); - - - LIEF::enum_(m, "SYMBOL_SECTION_INDEX") - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_UNDEF)) - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_ABS)) - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_COMMON)) - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_HIRESERVE)); - - - LIEF::enum_(m, "DYNAMIC_FLAGS", py::arithmetic()) - .value(PY_ENUM(DYNAMIC_FLAGS::DF_ORIGIN)) - .value(PY_ENUM(DYNAMIC_FLAGS::DF_SYMBOLIC)) - .value(PY_ENUM(DYNAMIC_FLAGS::DF_TEXTREL)) - .value(PY_ENUM(DYNAMIC_FLAGS::DF_BIND_NOW)) - .value(PY_ENUM(DYNAMIC_FLAGS::DF_STATIC_TLS)); - - LIEF::enum_(m, "DYNAMIC_FLAGS_1", py::arithmetic()) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOW)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_GLOBAL)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_GROUP)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODELETE)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_LOADFLTR)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_INITFIRST)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOOPEN)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_ORIGIN)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_DIRECT)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_TRANS)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_INTERPOSE)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODEFLIB)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODUMP)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_CONFALT)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_ENDFILTEE)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_DISPRELDNE)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_DISPRELPND)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODIRECT)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_IGNMULDEF)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOKSYMS)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOHDR)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_EDITED)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NORELOC)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_SYMINTPOSE)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_GLOBAUDIT)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_SINGLETON)) - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_PIE)); - - - LIEF::enum_(m, "SYMBOL_VISIBILITY") - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_DEFAULT)) - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_HIDDEN)) - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_INTERNAL)) - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_PROTECTED)); - -} - -} -} diff --git a/vendor/lief/api/python/ELF/pySizes.cpp b/vendor/lief/api/python/ELF/pySizes.cpp deleted file mode 100644 index b156867..0000000 --- a/vendor/lief/api/python/ELF/pySizes.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "pyELF.hpp" -#include "ELF/Structures.hpp" - -namespace LIEF { -namespace ELF { -void init_ELF32_sizes(py::module& m) { - enum SIZES : size_t {}; - py::enum_(m, "SIZES") - .value("ADDR", static_cast(sizeof(details::Elf32_Addr))) - .value("OFF", static_cast(sizeof(details::Elf32_Off))) - .value("HALF", static_cast(sizeof(details::Elf32_Half))) - .value("WORD", static_cast(sizeof(details::Elf32_Word))) - .value("SWORD", static_cast(sizeof(details::Elf32_Sword))) - .value("INT", static_cast(sizeof(uint32_t))) - .value("EHDR", static_cast(sizeof(details::Elf32_Ehdr))) - .value("SHDR", static_cast(sizeof(details::Elf32_Shdr))) - .value("PHDR", static_cast(sizeof(details::Elf32_Phdr))) - .value("SYM", static_cast(sizeof(details::Elf32_Sym))) - .value("REL", static_cast(sizeof(details::Elf32_Rel))) - .value("RELA", static_cast(sizeof(details::Elf32_Rela))) - .value("DYN", static_cast(sizeof(details::Elf32_Dyn))) - .value("VERNEED", static_cast(sizeof(details::Elf32_Verneed))) - .value("VERNAUX", static_cast(sizeof(details::Elf32_Vernaux))) - .value("AUXV", static_cast(sizeof(details::Elf32_Auxv))) - .value("VERDEF", static_cast(sizeof(details::Elf32_Verdef))) - .value("VERDAUX", static_cast(sizeof(details::Elf32_Verdaux))); -} - - -void init_ELF64_sizes(py::module& m) { - enum SIZES : size_t {}; - py::enum_(m, "SIZES") - .value("ADDR", static_cast(sizeof(details::Elf64_Addr))) - .value("OFF", static_cast(sizeof(details::Elf64_Off))) - .value("HALF", static_cast(sizeof(details::Elf64_Half))) - .value("WORD", static_cast(sizeof(details::Elf64_Word))) - .value("SWORD", static_cast(sizeof(details::Elf64_Sword))) - .value("INT", static_cast(sizeof(uint64_t))) - .value("EHDR", static_cast(sizeof(details::Elf64_Ehdr))) - .value("SHDR", static_cast(sizeof(details::Elf64_Shdr))) - .value("PHDR", static_cast(sizeof(details::Elf64_Phdr))) - .value("SYM", static_cast(sizeof(details::Elf64_Sym))) - .value("REL", static_cast(sizeof(details::Elf64_Rel))) - .value("RELA", static_cast(sizeof(details::Elf64_Rela))) - .value("DYN", static_cast(sizeof(details::Elf64_Dyn))) - .value("VERNEED", static_cast(sizeof(details::Elf64_Verneed))) - .value("VERNAUX", static_cast(sizeof(details::Elf64_Vernaux))) - .value("AUXV", static_cast(sizeof(details::Elf64_Auxv))) - .value("VERDEF", static_cast(sizeof(details::Elf64_Verdef))) - .value("VERDAUX", static_cast(sizeof(details::Elf64_Verdaux))); -} - -} -} diff --git a/vendor/lief/api/python/MachO/CMakeLists.txt b/vendor/lief/api/python/MachO/CMakeLists.txt deleted file mode 100644 index 61a8eba..0000000 --- a/vendor/lief/api/python/MachO/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -set(LIEF_PYTHON_MACHO_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyMachO.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDylibCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBinary.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyFatBinary.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyLoadCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySegmentCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySection.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbol.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbolCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyUUID.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySourceVersion.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyVersionMin.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyMainCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDylinker.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDyldInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDyldChainedFixups.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyChainedBindingInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDyldBindingInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDyldExportsTrie.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocationFixup.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyFunctionStarts.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocation.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocationObject.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocationDyld.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBindingInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyExportInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyThreadCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRPathCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParserConfig.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDynamicSymbolCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyCodeSignature.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySegmentSplitInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDataInCode.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDataCodeEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySubFramework.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDyldEnvironment.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyEncryptionInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBuildVersion.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyFilesetCommand.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyCodeSignatureDir.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyTwoLevelHints.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyLinkerOptHint.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBuilder.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyEnums.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyUtils.cpp" -) - -set(LIEF_PYTHON_MACHO_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyMachO.hpp") - -source_group("Source Files\\MachO" FILES ${LIEF_PYTHON_MACHO_SRC}) -source_group("Header Files\\MachO" FILES ${LIEF_PYTHON_MACHO_HDR}) - -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}") -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_MACHO_SRC}" "${LIEF_PYTHON_MACHO_HDR}") - - - diff --git a/vendor/lief/api/python/MachO/objects/pyBinary.cpp b/vendor/lief/api/python/MachO/objects/pyBinary.cpp deleted file mode 100644 index f05b7f5..0000000 --- a/vendor/lief/api/python/MachO/objects/pyBinary.cpp +++ /dev/null @@ -1,640 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include "LIEF/Abstract/Binary.hpp" -#include "LIEF/MachO/Binary.hpp" -#include "LIEF/MachO/Symbol.hpp" -#include "LIEF/MachO/Section.hpp" - -#include "LIEF/MachO/hash.hpp" - -#include "pyErr.hpp" -#include "pyMachO.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace MachO { - -template -using no_const_getter = T (Binary::*)(void); - -template -using no_const_func = T (Binary::*)(P); - - -template<> -void create(py::module& m) { - - - py::class_ bin(m, "Binary", - R"delim( - Class which represents a MachO binary - )delim"); - - init_ref_iterator(bin, "it_commands"); - - init_ref_iterator(bin, "it_symbols"); - init_ref_iterator(bin, "it_filter_symbols"); - init_ref_iterator(bin, "it_sections"); - init_ref_iterator(bin, "it_segments"); - init_ref_iterator(bin, "it_libraries"); - init_ref_iterator(bin, "it_relocations"); - - // --> Already registered with FatMachO (same container) - //init_ref_iterator(bin, "it_fileset_binaries"); - - bin - .def_property_readonly("header", - static_cast>(&Binary::header), - "Return binary's " RST_CLASS_REF(lief.MachO.Header) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("sections", - static_cast>(&Binary::sections), - "Return an iterator over the binary's " RST_CLASS_REF(lief.MachO.Section) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("relocations", - static_cast>(&Binary::relocations), - "Return an iterator over binary's " RST_CLASS_REF(lief.MachO.Relocation) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("segments", - static_cast>(&Binary::segments), - "Return an iterator over the binary's " RST_CLASS_REF(lief.MachO.SegmentCommand) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("libraries", - static_cast>(&Binary::libraries), - "Return an iterator over the binary's " RST_CLASS_REF(lief.MachO.DylibCommand) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("symbols", - static_cast>(&Binary::symbols), - "Return an iterator over the binary's " RST_CLASS_REF(lief.MachO.Symbol) "", - py::return_value_policy::reference_internal) - - .def("has_symbol", - &Binary::has_symbol, - "Check if a " RST_CLASS_REF(lief.MachO.Symbol) " with the given name exists", - "name"_a) - - .def("get_symbol", - static_cast>(&Binary::get_symbol), - "Return the " RST_CLASS_REF(lief.MachO.Symbol) " from the given name", - "name"_a, - py::return_value_policy::reference) - - .def_property_readonly("imported_symbols", - static_cast>(&Binary::imported_symbols), - "Return the binary's " RST_CLASS_REF(lief.MachO.Symbol) " which are imported", - py::return_value_policy::reference_internal) - - .def_property_readonly("exported_symbols", - static_cast>(&Binary::exported_symbols), - "Return the binary's " RST_CLASS_REF(lief.MachO.Symbol) " which are exported", - py::return_value_policy::reference_internal) - - .def_property_readonly("commands", - static_cast>(&Binary::commands), - "Return an iterator over the binary's " RST_CLASS_REF(lief.MachO.Command) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("filesets", - static_cast>(&Binary::filesets), - "Return binary's " RST_CLASS_REF(lief.MachO.Filesets) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("has_filesets", - &Binary::has_filesets, - "Return ``True`` if the binary has filesets") - - .def_property_readonly("imagebase", - &Binary::imagebase, - R"delim( - Return the binary's ``imagebase`` which is the base address - where segments are mapped (without the ASLR). ``0`` if not relevant. - )delim") - - .def_property_readonly("virtual_size", - &Binary::virtual_size, - "Binary's memory size when mapped") - - .def_property_readonly("fat_offset", - &Binary::fat_offset, - "Return binary's *fat offset*. ``0`` if not relevant.", - py::return_value_policy::copy) - - .def("section_from_offset", - static_cast(&Binary::section_from_offset), - "Return the " RST_CLASS_REF(lief.MachO.Section) " which encompasses the offset", - py::return_value_policy::reference) - - .def("section_from_virtual_address", - static_cast(&Binary::section_from_virtual_address), - "Return the " RST_CLASS_REF(lief.MachO.Section) " which encompasses the virtual address", - py::return_value_policy::reference) - - .def("segment_from_offset", - static_cast(&Binary::segment_from_offset), - "Return the " RST_CLASS_REF(lief.MachO.SegmentCommand) " which encompasses the offset", - py::return_value_policy::reference) - - .def("segment_from_virtual_address", - static_cast(&Binary::segment_from_virtual_address), - "Return the " RST_CLASS_REF(lief.MachO.SegmentCommand) " which encompasses the virtual address", - py::return_value_policy::reference) - - .def_property_readonly("has_entrypoint", - &Binary::has_entrypoint, - R"delim( - ``True`` if the binary has an entrypoint. - - Basically for libraries it will return ``false`` - )delim") - - - .def_property_readonly("has_uuid", - &Binary::has_uuid, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.UUIDCommand) " command.") - - .def_property_readonly("uuid", - static_cast>(&Binary::uuid), - "Return the binary's " RST_CLASS_REF(lief.MachO.UUIDCommand) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_main_command", - &Binary::has_main_command, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.MainCommand) " command.") - - .def_property_readonly("main_command", - static_cast>(&Binary::main_command), - "Return the binary's " RST_CLASS_REF(lief.MachO.MainCommand) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_dylinker", - &Binary::has_dylinker, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.DylinkerCommand) " command.") - - .def_property_readonly("dylinker", - static_cast>(&Binary::dylinker), - "Return the binary's " RST_CLASS_REF(lief.MachO.DylinkerCommand) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_dyld_info", - &Binary::has_dyld_info, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.DyldInfo) " command.") - - .def_property_readonly("dyld_info", - static_cast>(&Binary::dyld_info), - "Return the binary's " RST_CLASS_REF(lief.MachO.DyldInfo) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_function_starts", - &Binary::has_function_starts, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.FunctionStarts) " command.") - - .def_property_readonly("function_starts", - static_cast>(&Binary::function_starts), - "Return the binary's " RST_CLASS_REF(lief.MachO.FunctionStarts) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_source_version", - &Binary::has_source_version, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.SourceVersion) " command.") - - .def_property_readonly("source_version", - static_cast>(&Binary::source_version), - "Return the binary's " RST_CLASS_REF(lief.MachO.SourceVersion) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_version_min", - &Binary::has_version_min, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.VersionMin) " command.") - - .def_property_readonly("version_min", - static_cast>(&Binary::version_min), - "Return the binary's " RST_CLASS_REF(lief.MachO.VersionMin) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_thread_command", - &Binary::has_thread_command, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.ThreadCommand) " command.") - - .def_property_readonly("thread_command", - static_cast>(&Binary::thread_command), - "Return the binary's " RST_CLASS_REF(lief.MachO.ThreadCommand) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_rpath", - &Binary::has_rpath, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.RPathCommand) " command.") - - .def_property_readonly("rpath", - static_cast>(&Binary::rpath), - "Return the binary's " RST_CLASS_REF(lief.MachO.RPathCommand) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_symbol_command", - &Binary::has_symbol_command, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.SymbolCommand) " command.") - - .def_property_readonly("symbol_command", - static_cast>(&Binary::symbol_command), - "Return the binary's " RST_CLASS_REF(lief.MachO.SymbolCommand) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_dynamic_symbol_command", - &Binary::has_dynamic_symbol_command, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.DynamicSymbolCommand) " command.") - - .def_property_readonly("dynamic_symbol_command", - static_cast>(&Binary::dynamic_symbol_command), - "Return the binary's " RST_CLASS_REF(lief.MachO.DynamicSymbolCommand) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_code_signature", - &Binary::has_code_signature, - "``True`` if the binary is signed (i.e. has a " RST_CLASS_REF(lief.MachO.CodeSignature) " command)") - - .def_property_readonly("code_signature", - static_cast>(&Binary::code_signature), - "Return the binary's " RST_CLASS_REF(lief.MachO.CodeSignature) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_code_signature_dir", - &Binary::has_code_signature_dir, - "``True`` if the binary is signed (i.e. has a " RST_CLASS_REF(lief.MachO.CodeSignatureDir) " command) " - "with the command LC_DYLIB_CODE_SIGN_DRS") - - .def_property_readonly("code_signature_dir", - static_cast>(&Binary::code_signature_dir), - "Return the binary's " RST_CLASS_REF(lief.MachO.CodeSignatureDir) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_data_in_code", - &Binary::has_data_in_code, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.DataInCode) " command") - - .def_property_readonly("data_in_code", - static_cast>(&Binary::data_in_code), - "Return the binary's " RST_CLASS_REF(lief.MachO.DataInCode) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_segment_split_info", - &Binary::has_segment_split_info, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.SegmentSplitInfo) " command") - - .def_property_readonly("segment_split_info", - static_cast>(&Binary::segment_split_info), - "Return the binary's " RST_CLASS_REF(lief.MachO.SegmentSplitInfo) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_sub_framework", - &Binary::has_sub_framework, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.SubFramework) " command") - - .def_property_readonly("sub_framework", - static_cast>(&Binary::sub_framework), - "Return the binary's " RST_CLASS_REF(lief.MachO.SubFramework) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_dyld_environment", - &Binary::has_dyld_environment, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.DyldEnvironment) " command") - - .def_property_readonly("dyld_environment", - static_cast>(&Binary::dyld_environment), - "Return the binary's " RST_CLASS_REF(lief.MachO.DyldEnvironment) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_encryption_info", - &Binary::has_encryption_info, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.EncryptionInfo) " command") - - .def_property_readonly("encryption_info", - static_cast>(&Binary::encryption_info), - "Return the binary's " RST_CLASS_REF(lief.MachO.EncryptionInfo) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_build_version", - &Binary::has_build_version, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.BuildVersion) " command") - - .def_property_readonly("build_version", - static_cast>(&Binary::build_version), - "Return the binary's " RST_CLASS_REF(lief.MachO.BuildVersion) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_dyld_chained_fixups", - &Binary::has_dyld_chained_fixups, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.DyldChainedFixups) " command") - - .def_property_readonly("dyld_chained_fixups", - static_cast>(&Binary::dyld_chained_fixups), - "Return the binary's " RST_CLASS_REF(lief.MachO.DyldChainedFixups) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_dyld_exports_trie", - &Binary::has_dyld_exports_trie, - "``True`` if the binary has a " RST_CLASS_REF(lief.MachO.DyldExportsTrie) " command") - - .def_property_readonly("dyld_exports_trie", - static_cast>(&Binary::dyld_exports_trie), - "Return the binary's " RST_CLASS_REF(lief.MachO.DyldExportsTrie) " if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_two_level_hints", - &Binary::has_two_level_hints, - "``True`` if the binary embeds the Two Level Hint command (" RST_CLASS_REF(lief.MachO.TwoLevelHints) ")") - - .def_property_readonly("two_level_hints", - static_cast>(&Binary::two_level_hints), - "Return the binary's " RST_CLASS_REF(lief.MachO.TwoLevelHints) " if any, or None", - py::return_value_policy::reference) - - - .def_property_readonly("has_linker_opt_hint", - &Binary::has_linker_opt_hint, - "``True`` if the binary embeds the Linker optimization hint command (" RST_CLASS_REF(lief.MachO.LinkerOptHint) ")") - - .def_property_readonly("linker_opt_hint", - static_cast>(&Binary::linker_opt_hint), - "Return the binary's " RST_CLASS_REF(lief.MachO.LinkerOptHint) " if any, or None", - py::return_value_policy::reference) - - .def("virtual_address_to_offset", - [] (const Binary& self, uint64_t va) { - return error_or(&Binary::virtual_address_to_offset, self, va); - }, - "Convert the virtual address to an offset in the binary", - "virtual_address"_a) - - .def("has_section", - &Binary::has_section, - "Check if a section with the given name exists", - "name"_a) - - .def("get_section", - static_cast(&Binary::get_section), - "Return the section from the given name or None if the section does not exist", - "name"_a, - py::return_value_policy::reference) - - .def("has_segment", - &Binary::has_segment, - "Check if a " RST_CLASS_REF(lief.MachO.SegmentCommand) " with the given name exists", - "name"_a) - - .def("get_segment", - static_cast(&Binary::get_segment), - "Return the " RST_CLASS_REF(lief.MachO.SegmentCommand) " from the given name", - "name"_a, - py::return_value_policy::reference) - - .def_property_readonly("va_ranges", - &Binary::va_ranges, - "Return the range of virtual addresses as a tuple ``(va_start, va_end)``") - - .def_property_readonly("off_ranges", - &Binary::off_ranges, - "Return the range of offsets as a tuple ``(off_start, off_end)``") - - .def("is_valid_addr", - &Binary::is_valid_addr, - R"delim( - Check if the given address is encompassed between the range of virtual addresses. - - See: :attr:`~lief.MachO.Binary.va_ranges` - )delim", - "address"_a) - - .def("write", - static_cast(&Binary::write), - "Rebuild the binary and write and write its content if the file given in parameter", - "output"_a, - py::return_value_policy::reference_internal) - - .def("add", - static_cast(&Binary::add), - "Add a new " RST_CLASS_REF(lief.MachO.DylibCommand) "", - "dylib_command"_a, - py::return_value_policy::reference) - - .def("add", - static_cast(&Binary::add), - "Add a new " RST_CLASS_REF(lief.MachO.SegmentCommand) "", - "segment"_a, - py::return_value_policy::reference) - - .def("add", - static_cast(&Binary::add), - "Add a new " RST_CLASS_REF(lief.MachO.LoadCommand) "", - "load_command"_a, - py::return_value_policy::reference) - - .def("add", - static_cast(&Binary::add), - "Add a new " RST_CLASS_REF(lief.MachO.LoadCommand) " at ``index``", - "load_command"_a, "index"_a, - py::return_value_policy::reference) - - - .def("remove", - static_cast(&Binary::remove), - "Remove a " RST_CLASS_REF(lief.MachO.LoadCommand) "", - "load_command"_a) - - .def("remove", - static_cast(&Binary::remove), - "Remove **all** the " RST_CLASS_REF(lief.MachO.LoadCommand) " having the given " - "" RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES) "", - "type"_a) - - .def("remove", - static_cast(&Binary::remove), - "Remove the given " RST_CLASS_REF(lief.MachO.Symbol)"", - "symbol"_a) - - .def("remove_command", - static_cast(&Binary::remove_command), - "Remove the " RST_CLASS_REF(lief.MachO.LoadCommand) " at the given ``index``", - "index"_a) - - .def("remove_section", - static_cast(&Binary::remove_section), - "Remove the section with the given name", - "name"_a, "clear"_a = false) - - .def("remove_section", - py::overload_cast(&Binary::remove_section), - R"delim( - Remove the section from the segment with the name - given in the first parameter and with the section's name provided in the - second parameter.)delim", - "segname"_a, "secname"_a, "clear"_a = false) - - .def("remove_signature", - static_cast(&Binary::remove_signature), - "Remove the " RST_CLASS_REF(lief.MachO.CodeSignature) " (if any)") - - .def("remove_symbol", - static_cast(&Binary::remove_symbol), - "Remove all symbol(s) with the given name", - "name"_a) - - .def("can_remove", - static_cast(&Binary::can_remove), - "Check if the given symbol can be safely removed.", - "symbol"_a) - - .def("can_remove_symbol", - static_cast(&Binary::can_remove_symbol), - "Check if the given symbol name can be safely removed.", - "symbol_name"_a) - - .def("unexport", - static_cast(&Binary::unexport), - "Remove the symbol from the export table", - "name"_a) - - .def("unexport", - static_cast(&Binary::unexport), - "Remove the symbol from the export table", - "symbol"_a) - - .def("extend", - static_cast(&Binary::extend), - "Extend a " RST_CLASS_REF(lief.MachO.LoadCommand) " by ``size``", - "load_command"_a, "size"_a) - - .def("extend_segment", - static_cast(&Binary::extend_segment), - "Extend the **content** of the given " RST_CLASS_REF(lief.MachO.SegmentCommand) " by ``size``", - "segment_command"_a, "size"_a) - - .def("add_section", - static_cast(&Binary::add_section), - "Add a new " RST_CLASS_REF(lief.MachO.Section) " in the given " RST_CLASS_REF(lief.MachO.SegmentCommand) "", - "segment"_a, "section"_a, - py::return_value_policy::reference) - - .def("add_section", - static_cast(&Binary::add_section), - "Add a new " RST_CLASS_REF(lief.MachO.Section) " within the ``__TEXT`` segment", - "section"_a, - py::return_value_policy::reference) - - - .def("add_section", - static_cast(&Binary::add_section), - "Add a new " RST_CLASS_REF(lief.MachO.Section) " in the given " RST_CLASS_REF(lief.MachO.SegmentCommand) "", - "section"_a, "section"_a, - py::return_value_policy::reference) - - .def("add_library", - static_cast(&Binary::add_library), - "Add a new library dependency", - "library_name"_a, - py::return_value_policy::reference) - - .def("get", - static_cast(&Binary::get), - "Return the **first** " RST_CLASS_REF(lief.MachO.LoadCommand) " having the given " - "" RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES) " or None if it is not present.", - "type"_a, - py::return_value_policy::reference) - - .def("has", - static_cast(&Binary::has), - "Check if the current binary has a " RST_CLASS_REF(lief.MachO.LoadCommand) " with the given " - "" RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES) "", - "type"_a) - - .def_property_readonly("unwind_functions", - &Binary::unwind_functions, - "Return list of " RST_CLASS_REF(lief.Function) " found in the ``__unwind_info`` section") - - .def_property_readonly("functions", - &Binary::functions, - "Return list of **all** " RST_CLASS_REF(lief.Function) " found") - - .def("get_section", - py::overload_cast(&Binary::get_section), - R"delim( - Return the section from the segment with the name - given in the first parameter and with the section's name provided in the - second parameter. If the section cannot be found, it returns a nullptr - )delim", - "segname"_a, "secname"_a, - py::return_value_policy::reference_internal) - - .def("shift", - [] (Binary& self, size_t width) { - return error_or(&Binary::shift, self, width); - }, - R"delim( - Shift the content located right after the Load commands table. - This operation can be used to add a new command - )delim", - "value"_a) - - .def("shift_linkedit", - [] (Binary& self, size_t width) { - return error_or(&Binary::shift_linkedit, self, width); - }, - "Shift the position on the __LINKEDIT data by `width`", - "value"_a) - - .def("add_exported_function", - &Binary::add_exported_function, - "Add a new export in the binary", - "address"_a, "name"_a, - py::return_value_policy::reference) - - .def("add_local_symbol", - &Binary::add_local_symbol, - "Add a new a new symbol in the LC_SYMTAB", - "address"_a, "name"_a, - py::return_value_policy::reference) - - .def_property_readonly("page_size", - &Binary::page_size, - "Return the binary's page size") - - .def("__getitem__", - static_cast(&Binary::operator[]), - "", - py::return_value_policy::reference) - - .def("__contains__", - static_cast(&Binary::has)) - - - .def("__str__", - [] (const Binary& binary) - { - std::ostringstream stream; - stream << binary; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/MachO/objects/pyBindingInfo.cpp b/vendor/lief/api/python/MachO/objects/pyBindingInfo.cpp deleted file mode 100644 index 75d341e..0000000 --- a/vendor/lief/api/python/MachO/objects/pyBindingInfo.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/BindingInfo.hpp" -#include "LIEF/MachO/SegmentCommand.hpp" -#include "LIEF/MachO/Symbol.hpp" -#include "LIEF/MachO/DylibCommand.hpp" - -#include "pyMachO.hpp" - - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (BindingInfo::*)(void) const; - -template -using setter_t = void (BindingInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "BindingInfo", - R"delim( - Class that provides an interface over an entry in DyldInfo structure - - This class does not represent a structure that exists in the Mach-O format - specifications but it provides a *view* of a binding operation that is performed - by the Dyld binding bytecode (`LC_DYLD_INFO`) or the Dyld chained fixups (`DYLD_CHAINED_FIXUPS`) - - See: :class:`~lief.MachO.ChainedBindingInfo`, :class:`~lief.MachO.DyldBindingInfo` - )delim") - - - .def_property("address", - static_cast>(&BindingInfo::address), - static_cast>(&BindingInfo::address), - "Binding's address") - - - .def_property("library_ordinal", - static_cast>(&BindingInfo::library_ordinal), - static_cast>(&BindingInfo::library_ordinal)) - - .def_property("addend", - static_cast>(&BindingInfo::addend), - static_cast>(&BindingInfo::addend), - "Value added to the segment's virtual address when binding") - - .def_property("weak_import", - static_cast>(&BindingInfo::is_weak_import), - static_cast>(&BindingInfo::set_weak_import)) - - - .def_property_readonly("has_library", - &BindingInfo::has_library, - "``True`` if the binding info has a " RST_CLASS_REF(lief.MachO.DylibCommand) " associated with") - - .def_property_readonly("library", - static_cast(&BindingInfo::library), - "" RST_CLASS_REF(lief.MachO.DylibCommand) " associated with the binding if any, or None", - py::return_value_policy::reference) - - - .def_property_readonly("has_segment", - &BindingInfo::has_segment, - "``True`` if the binding info has a " RST_CLASS_REF(lief.MachO.SegmentCommand) " associated with") - - .def_property_readonly("segment", - static_cast(&BindingInfo::segment), - "" RST_CLASS_REF(lief.MachO.SegmentCommand) " associated with the binding if any, or None", - py::return_value_policy::reference) - - - .def_property_readonly("has_symbol", - &BindingInfo::has_symbol, - "``True`` if the binding info has a " RST_CLASS_REF(lief.MachO.Symbol) " associated with") - - .def_property_readonly("symbol", - static_cast(&BindingInfo::symbol), - "" RST_CLASS_REF(lief.MachO.Symbol) " associated with the binding if any, or None", - py::return_value_policy::reference) - - .def("__eq__", &BindingInfo::operator==) - .def("__ne__", &BindingInfo::operator!=) - .def("__hash__", - [] (const BindingInfo& binding_info) { - return Hash::hash(binding_info); - }) - - - .def("__str__", - [] (const BindingInfo& binding_info) - { - std::ostringstream stream; - stream << binding_info; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyBuildVersion.cpp b/vendor/lief/api/python/MachO/objects/pyBuildVersion.cpp deleted file mode 100644 index a398674..0000000 --- a/vendor/lief/api/python/MachO/objects/pyBuildVersion.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/BuildVersion.hpp" -#include "LIEF/MachO/EnumToString.hpp" - -#include "enums_wrapper.hpp" - -#include "pyMachO.hpp" - -#define PY_ENUM(x) LIEF::MachO::to_string(x), x - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (BuildVersion::*)(void) const; - -template -using setter_t = void (BuildVersion::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ cls(m, "BuildVersion"); - py::class_ tool_version_cls(m, "BuildToolVersion", - R"delim( - Class that represents a tool's version that was involved in the build of the binary - )delim"); - - - // Build Tool Version - // ================== - tool_version_cls - .def_property_readonly("tool", - &BuildToolVersion::tool, - "" RST_CLASS_REF(.BuildVersion.TOOLS) " type") - - .def_property_readonly("version", - &BuildToolVersion::version, - "Version of the tool") - - .def("__eq__", &BuildToolVersion::operator==) - .def("__ne__", &BuildToolVersion::operator!=) - .def("__hash__", - [] (const BuildToolVersion& version) { - return Hash::hash(version); - }) - - .def("__str__", - [] (const BuildToolVersion& version) - { - std::ostringstream stream; - stream << version; - return stream.str(); - }); - - - LIEF::enum_(tool_version_cls, "TOOLS") - .value(PY_ENUM(BuildToolVersion::TOOLS::UNKNOWN)) - .value(PY_ENUM(BuildToolVersion::TOOLS::CLANG)) - .value(PY_ENUM(BuildToolVersion::TOOLS::SWIFT)) - .value(PY_ENUM(BuildToolVersion::TOOLS::LD)); - - cls - - .def_property("platform", - static_cast>(&BuildVersion::platform), - static_cast>(&BuildVersion::platform), - "Target " RST_CLASS_REF(.BuildVersion.PLATFORMS) "") - - .def_property("minos", - static_cast>(&BuildVersion::minos), - static_cast>(&BuildVersion::minos), - "Minimal OS version on which this binary was built to run") - - .def_property("sdk", - static_cast>(&BuildVersion::sdk), - static_cast>(&BuildVersion::sdk), - "SDK Version") - - .def_property_readonly("tools", - static_cast>(&BuildVersion::tools), - "List of " RST_CLASS_REF(BuildToolVersion) " used when while this binary") - - .def("__eq__", &BuildVersion::operator==) - .def("__ne__", &BuildVersion::operator!=) - .def("__hash__", - [] (const BuildVersion& version) { - return Hash::hash(version); - }) - - .def("__str__", - [] (const BuildVersion& version) - { - std::ostringstream stream; - stream << version; - return stream.str(); - }); - - - LIEF::enum_(cls, "PLATFORMS") - .value(PY_ENUM(BuildVersion::PLATFORMS::UNKNOWN)) - .value(PY_ENUM(BuildVersion::PLATFORMS::MACOS)) - .value(PY_ENUM(BuildVersion::PLATFORMS::IOS)) - .value(PY_ENUM(BuildVersion::PLATFORMS::TVOS)) - .value(PY_ENUM(BuildVersion::PLATFORMS::WATCHOS)); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyBuilder.cpp b/vendor/lief/api/python/MachO/objects/pyBuilder.cpp deleted file mode 100644 index 77ecf32..0000000 --- a/vendor/lief/api/python/MachO/objects/pyBuilder.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "pyMachO.hpp" -#include "pyErr.hpp" - -#include "LIEF/MachO/Binary.hpp" -#include "LIEF/MachO/FatBinary.hpp" -#include "LIEF/MachO/Builder.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - py::class_ builder(m, "Builder", - R"delim( - Class used to reconstruct a Mach-O binary from its object representation - )delim"); - - py::class_(builder, "config_t", - "Interface to tweak the " RST_CLASS_REF(lief.MachO.Builder) "") - .def(py::init<>()) - .def_readwrite("linkedit", &Builder::config_t::linkedit); - - builder - .def_static("write", - [] (Binary& bin, const std::string& out) { - auto target = py::overload_cast(&Builder::write); - return error_or(target, bin, out); - }, - R"delim( - )delim", - "binary"_a, "output"_a) - .def_static("write", - [] (Binary& bin, const std::string& out, Builder::config_t config) { - auto target = py::overload_cast(&Builder::write); - return error_or(target, bin, out, config); - }, - R"delim( - )delim", - "binary"_a, "output"_a, "config"_a) - .def_static("write", - [] (FatBinary& fat, const std::string& out) { - auto target = py::overload_cast(&Builder::write); - return error_or(target, fat, out); - }, - R"delim( - )delim", - "fat_binary"_a, "output"_a) - .def_static("write", - [] (FatBinary& fat, const std::string& out, Builder::config_t config) { - auto target = py::overload_cast(&Builder::write); - return error_or(target, fat, out, config); - }, - R"delim( - )delim", - "fat_binary"_a, "output"_a, "config"_a); -} -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyChainedBindingInfo.cpp b/vendor/lief/api/python/MachO/objects/pyChainedBindingInfo.cpp deleted file mode 100644 index 3f78bc0..0000000 --- a/vendor/lief/api/python/MachO/objects/pyChainedBindingInfo.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/ChainedBindingInfo.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - py::class_(m, "ChainedBindingInfo", - R"delim( - This class represents a symbol binding operation associated with - the LC_DYLD_CHAINED_FIXUPS command. - - This class does not represent a structure that exists in the Mach-O format - specifications but it provides a *view* on an entry. - - See also: :class:`~lief.MachO.BindingInfo` - )delim") - - .def_property_readonly("format", - &ChainedBindingInfo::format, - R"delim( - :class:`~lief.MachO.DYLD_CHAINED_FORMAT` of the import - )delim") - - .def_property_readonly("ptr_format", - &ChainedBindingInfo::ptr_format, - R"delim( - :class:`~lief.MachO.DYLD_CHAINED_PTR_FORMAT` of the import - )delim") - - .def_property("offset", - py::overload_cast<>(&ChainedBindingInfo::offset, py::const_), - py::overload_cast(&ChainedBindingInfo::offset), - R"delim( - Offset of the entry in the chained fixups - )delim") - - .def_property_readonly("sign_extended_addend", &ChainedBindingInfo::sign_extended_addend) - - .def("__eq__", &ChainedBindingInfo::operator==) - .def("__ne__", &ChainedBindingInfo::operator!=) - .def("__hash__", - [] (const ChainedBindingInfo& info) { - return Hash::hash(info); - }) - - .def("__str__", - [] (const ChainedBindingInfo& info) { - std::ostringstream stream; - std::string str = stream.str(); - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyCodeSignature.cpp b/vendor/lief/api/python/MachO/objects/pyCodeSignature.cpp deleted file mode 100644 index 7c83418..0000000 --- a/vendor/lief/api/python/MachO/objects/pyCodeSignature.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/CodeSignature.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (CodeSignature::*)(void) const; - -template -using setter_t = void (CodeSignature::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "CodeSignature") - - .def_property("data_offset", - static_cast>(&CodeSignature::data_offset), - static_cast>(&CodeSignature::data_offset), - "Offset in the binary where the signature starts") - - .def_property("data_size", - static_cast>(&CodeSignature::data_size), - static_cast>(&CodeSignature::data_size), - "Size of the raw signature") - - .def_property_readonly("content", - [] (const CodeSignature& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The raw signature as a bytes stream") - - .def("__eq__", &CodeSignature::operator==) - .def("__ne__", &CodeSignature::operator!=) - .def("__hash__", - [] (const CodeSignature& func) { - return Hash::hash(func); - }) - - .def("__str__", - [] (const CodeSignature& func) - { - std::ostringstream stream; - stream << func; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyCodeSignatureDir.cpp b/vendor/lief/api/python/MachO/objects/pyCodeSignatureDir.cpp deleted file mode 100644 index acada62..0000000 --- a/vendor/lief/api/python/MachO/objects/pyCodeSignatureDir.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/CodeSignatureDir.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - py::class_(m, "CodeSignatureDir") - - .def_property("data_offset", - py::overload_cast<>(&CodeSignatureDir::data_offset, py::const_), - py::overload_cast(&CodeSignatureDir::data_offset), - "Offset in the binary where the signature starts") - - .def_property("data_size", - py::overload_cast<>(&CodeSignatureDir::data_offset, py::const_), - py::overload_cast(&CodeSignatureDir::data_offset), - "Size of the raw signature") - - .def_property_readonly("content", - [] (const CodeSignatureDir& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The raw signature as a bytes stream") - - .def("__eq__", &CodeSignatureDir::operator==) - .def("__ne__", &CodeSignatureDir::operator!=) - .def("__hash__", - [] (const CodeSignatureDir& sig) { - return Hash::hash(sig); - }) - - .def("__str__", - [] (const CodeSignatureDir& dir) - { - std::ostringstream stream; - stream << dir; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDataCodeEntry.cpp b/vendor/lief/api/python/MachO/objects/pyDataCodeEntry.cpp deleted file mode 100644 index 4ef9c27..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDataCodeEntry.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DataCodeEntry.hpp" -#include "LIEF/MachO/EnumToString.hpp" - -#include "enums_wrapper.hpp" - -#include "pyMachO.hpp" - -#define PY_ENUM(x) LIEF::MachO::to_string(x), x - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DataCodeEntry::*)(void) const; - -template -using setter_t = void (DataCodeEntry::*)(T); - - -template<> -void create(py::module& m) { - - - py::class_ cls(m, "DataCodeEntry", - R"delim( - Interface over an entry in the :class:`~lief.MachO.DataInCode` command - )delim"); - - cls - .def(py::init()) - .def_property("offset", - static_cast>(&DataCodeEntry::offset), - static_cast>(&DataCodeEntry::offset), - "Offset of the data") - - .def_property("length", - static_cast>(&DataCodeEntry::length), - static_cast>(&DataCodeEntry::length), - "Length of the data") - - .def_property("type", - static_cast>(&DataCodeEntry::type), - static_cast>(&DataCodeEntry::type), - "Type of the data (" RST_CLASS_REF(lief.MachO.DataCodeEntry.TYPES) "") - - - .def("__eq__", &DataCodeEntry::operator==) - .def("__ne__", &DataCodeEntry::operator!=) - .def("__hash__", - [] (const DataCodeEntry& func) { - return Hash::hash(func); - }) - - - .def("__str__", - [] (const DataCodeEntry& func) - { - std::ostringstream stream; - stream << func; - std::string str = stream.str(); - return str; - }); - - - LIEF::enum_(cls, "TYPES") - .value(PY_ENUM(DataCodeEntry::TYPES::UNKNOWN)) - .value(PY_ENUM(DataCodeEntry::TYPES::DATA)) - .value(PY_ENUM(DataCodeEntry::TYPES::JUMP_TABLE_8)) - .value(PY_ENUM(DataCodeEntry::TYPES::JUMP_TABLE_16)) - .value(PY_ENUM(DataCodeEntry::TYPES::JUMP_TABLE_32)) - .value(PY_ENUM(DataCodeEntry::TYPES::ABS_JUMP_TABLE_32)); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDataInCode.cpp b/vendor/lief/api/python/MachO/objects/pyDataInCode.cpp deleted file mode 100644 index a07a4d1..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDataInCode.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DataInCode.hpp" - -#include "pyIterators.hpp" -#include "pyMachO.hpp" - - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DataInCode::*)(void) const; - -template -using setter_t = void (DataInCode::*)(T); - - -template<> -void create(py::module& m) { - - // Init Iterator - init_ref_iterator(m, "it_data_in_code_entries"); - - py::class_(m, "DataInCode", - R"delim( - Interface of the LC_DATA_IN_CODE command - - This command is used to list slices of code sections that contain data. The *slices* - information are stored as an array of :class:`~lief.MachO.DataCodeEntry` - )delim") - .def_property("data_offset", - static_cast>(&DataInCode::data_offset), - static_cast>(&DataInCode::data_offset), - "Start of the array of the DataCodeEntry entries") - - .def_property("data_size", - static_cast>(&DataInCode::data_size), - static_cast>(&DataInCode::data_size), - "Whole size of the array (``size = sizeof(DataCodeEntry) * nb_elements``)") - - .def_property_readonly("entries", - static_cast(&DataInCode::entries), - "Iterator over " RST_CLASS_REF(lief.MachO.DataCodeEntry) "", - py::return_value_policy::reference_internal) - - .def("add", - &DataInCode::add, - "Add an new " RST_CLASS_REF(lief.MachO.DataCodeEntry) "", - "entry"_a) - - .def_property_readonly("content", - [] (const DataInCode& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The original content as a bytes stream") - - - .def("__eq__", &DataInCode::operator==) - .def("__ne__", &DataInCode::operator!=) - .def("__hash__", - [] (const DataInCode& func) { - return Hash::hash(func); - }) - - - .def("__str__", - [] (const DataInCode& func) - { - std::ostringstream stream; - stream << func; - std::string str = stream.str(); - return str; - }); - -} -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDyldBindingInfo.cpp b/vendor/lief/api/python/MachO/objects/pyDyldBindingInfo.cpp deleted file mode 100644 index 4cc8f05..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDyldBindingInfo.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DyldBindingInfo.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DyldBindingInfo::*)() const; - -template -using setter_t = void (DyldBindingInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "DyldBindingInfo", - R"delim( - This class represents a symbol binding operation associated with - the LC_DYLD_INFO bytecode. - - This class does not represent a structure that exists in the Mach-O format - specifications but it provides a *view* on an entry of the Dyld binding opcodes. - - See also: :class:`~lief.MachO.BindingInfo` - )delim") - - .def_property("binding_class", - static_cast>(&DyldBindingInfo::binding_class), - static_cast>(&DyldBindingInfo::binding_class), - "" RST_CLASS_REF(lief.MachO.BINDING_CLASS) " of the binding") - - .def_property("binding_type", - static_cast>(&DyldBindingInfo::binding_type), - static_cast>(&DyldBindingInfo::binding_type), - R"delim( - :class:`~lief.MachO.BIND_TYPES` of the binding. - - Usually, it is :attr:`~lief.MachO.BIND_TYPES.POINTER`. - )delim") - - - .def_property_readonly("original_offset", - &DyldBindingInfo::original_offset, - "Original relative offset of the binding opcodes") - - .def("__eq__", &DyldBindingInfo::operator==) - .def("__ne__", &DyldBindingInfo::operator!=) - .def("__hash__", - [] (const DyldBindingInfo& info) { - return Hash::hash(info); - }) - - .def("__str__", - [] (const DyldBindingInfo& info) { - std::ostringstream stream; - std::string str = stream.str(); - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDyldChainedFixups.cpp b/vendor/lief/api/python/MachO/objects/pyDyldChainedFixups.cpp deleted file mode 100644 index a3dfb48..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDyldChainedFixups.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "pyIterators.hpp" -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DyldChainedFixups.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - py::class_ chained(m, "DyldChainedFixups", - R"delim( - Class that represents the LC_DYLD_CHAINED_FIXUPS command - - This command aims at providing rebase and binding information like - the :class:`~lief.MachO.DyldInfo` 's bytecode. Compared to the :class:`~lief.MachO.DyldInfo` bytecode, - these chained fixups are taking less space. - )delim"); - - init_ref_iterator(chained, "it_binding_info"); - init_ref_iterator(chained, "it_chained_starts_in_segments_t"); - - py::class_(chained, "chained_starts_in_segment", - R"delim( - Structure that mirrors the raw dyld_chained_starts_in_segment - which aims at providing information about the chained rebase/bind fixups - - The relocations provided by this structure can be accessed through :attr:`~lief.MachO.SegmentCommand.relocations` - )delim") - .def_readonly("offset", &DyldChainedFixups::chained_starts_in_segment::offset, - "Original offset of the structure, relative to :attr:`~lief.MachO.DyldChainedFixups.starts_offset`") - .def_readonly("size", &DyldChainedFixups::chained_starts_in_segment::size, - "``sizeof(size) + sizeof(page_size) + ... + sizeof(pointer_format)``") - .def_readonly("page_size", &DyldChainedFixups::chained_starts_in_segment::page_size, - "Likely 0x1000 for x86/x86_64 architectures and 0x4000 for ARM64 architecture") - .def_readonly("segment_offset", &DyldChainedFixups::chained_starts_in_segment::segment_offset, - R"delim( - Offset of the segment's data from the beginning of the file. - (it should match :attr:`~lief.MachO.SegmentCommand.file_offset`) - )delim") - .def_readonly("page_start", &DyldChainedFixups::chained_starts_in_segment::page_start, - R"delim( - Offset in the :class:`~lief.MachO.SegmentCommand` of - the first element of the chain. - )delim") - .def_readonly("pointer_format", &DyldChainedFixups::chained_starts_in_segment::pointer_format, - R"delim( - How pointers are encoded - )delim") - .def_readonly("max_valid_pointer", &DyldChainedFixups::chained_starts_in_segment::max_valid_pointer, - R"delim( - for 32-bit OS, any value beyond this is not a pointer - )delim") - .def_property_readonly("page_count", - &DyldChainedFixups::chained_starts_in_segment::page_count, - "How many pages are in the :attr:`~lief.MachO.DyldChainedFixups.page_start` array") - - .def_property_readonly("segment", - [] (DyldChainedFixups::chained_starts_in_segment& self) -> SegmentCommand* { - return &self.segment; - }, - ":class:`~lief.MachO.SegmentCommand` in which the rebase/bind fixups take place", - py::return_value_policy::reference) - - .def("__str__", - [] (const DyldChainedFixups::chained_starts_in_segment& self) { - std::ostringstream stream; - stream << self; - return stream.str(); - }); - - chained - .def_property("data_offset", - py::overload_cast<>(&DyldChainedFixups::data_offset, py::const_), - py::overload_cast(&DyldChainedFixups::data_offset), - R"delim( - Offset of the LC_DYLD_CHAINED_FIXUPS chained payload. - This offset should point in the ``__LINKEDIT`` segment - )delim") - - .def_property("data_size", - py::overload_cast<>(&DyldChainedFixups::data_size, py::const_), - py::overload_cast(&DyldChainedFixups::data_size), - "Size of the LC_DYLD_CHAINED_FIXUPS payload") - - .def_property_readonly("bindings", - py::overload_cast<>(&DyldChainedFixups::bindings), - "Iterator over the bindings " RST_CLASS_REF(lief.MachO.ChainedBindingInfo) - " associated with this command") - - .def_property_readonly("chained_starts_in_segments", - py::overload_cast<>(&DyldChainedFixups::chained_starts_in_segments), - "Iterator over the chained fixup metadata: " RST_CLASS_REF(lief.MachO.DyldChainedFixups.chained_starts_in_segment) "") - - .def_property("fixups_version", - py::overload_cast<>(&DyldChainedFixups::fixups_version, py::const_), - py::overload_cast(&DyldChainedFixups::fixups_version), - R"delim( - Chained fixups version. The loader (as far of dyld v852.2) checks that this value is set to 0. - )delim") - - .def_property("starts_offset", - py::overload_cast<>(&DyldChainedFixups::starts_offset, py::const_), - py::overload_cast(&DyldChainedFixups::starts_offset), - R"delim( - offset of dyld_chained_starts_in_image in chain_data - )delim") - - .def_property("imports_offset", - py::overload_cast<>(&DyldChainedFixups::imports_offset, py::const_), - py::overload_cast(&DyldChainedFixups::imports_offset), - R"delim( - Offset of imports table in chain data - )delim") - - .def_property("symbols_offset", - py::overload_cast<>(&DyldChainedFixups::symbols_offset, py::const_), - py::overload_cast(&DyldChainedFixups::symbols_offset), - R"delim( - Offset of symbol strings in chain data - )delim") - - .def_property("imports_count", - py::overload_cast<>(&DyldChainedFixups::imports_count, py::const_), - py::overload_cast(&DyldChainedFixups::imports_count), - R"delim( - Number of imported symbol names - )delim") - - .def_property("symbols_format", - py::overload_cast<>(&DyldChainedFixups::symbols_format, py::const_), - py::overload_cast(&DyldChainedFixups::symbols_format), - R"delim( - The compression algorithm (if any) used to store the symbols - 0 means uncompressed while 1 means zlib compressed. - - As far of the version v852.2 of dyld loader, it only supports - **uncompressed** format - )delim") - - .def_property("imports_format", - py::overload_cast<>(&DyldChainedFixups::imports_format, py::const_), - py::overload_cast(&DyldChainedFixups::imports_format), - R"delim( - The format of the imports (:class:`~lief.MachO.ChainedBindingInfo`) - )delim") - - .def("__eq__", &DyldChainedFixups::operator==) - .def("__ne__", &DyldChainedFixups::operator!=) - .def("__hash__", - [] (const DyldChainedFixups& func) { - return Hash::hash(func); - }) - - .def("__str__", - [] (const DyldChainedFixups& fixups) { - std::ostringstream stream; - stream << fixups; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDyldEnvironment.cpp b/vendor/lief/api/python/MachO/objects/pyDyldEnvironment.cpp deleted file mode 100644 index 2dd4a05..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDyldEnvironment.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DyldEnvironment.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DyldEnvironment::*)(void) const; - -template -using setter_t = void (DyldEnvironment::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "DyldEnvironment", - R"delim( - Class that represents a LC_DYLD_ENVIRONMENT which is - used by the Mach-O linker/loader to initialize an environment variable - )delim") - - .def_property("value", - static_cast>(&DyldEnvironment::value), - static_cast>(&DyldEnvironment::value), - "Environment variable as a string", - py::return_value_policy::reference_internal) - - .def("__eq__", &DyldEnvironment::operator==) - .def("__ne__", &DyldEnvironment::operator!=) - .def("__hash__", - [] (const DyldEnvironment& env) { - return Hash::hash(env); - }) - - - .def("__str__", - [] (const DyldEnvironment& env) - { - std::ostringstream stream; - stream << env; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDyldExportsTrie.cpp b/vendor/lief/api/python/MachO/objects/pyDyldExportsTrie.cpp deleted file mode 100644 index 20db632..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDyldExportsTrie.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "pyIterators.hpp" - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DyldExportsTrie.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - py::class_ exports_trie(m, "DyldExportsTrie", - R"delim( - Class that represents the LC_DYLD_EXPORTS_TRIE command - - In recent Mach-O binaries, this command replace the DyldInfo export trie buffer - )delim"); - - try { - init_ref_iterator(exports_trie, "it_export_info"); - } catch (const std::runtime_error&) { } - - exports_trie - .def_property("data_offset", - py::overload_cast<>(&DyldExportsTrie::data_offset, py::const_), - py::overload_cast(&DyldExportsTrie::data_offset), - "Offset of the trie in the binary. This offset should point in the __LINKEDIT") - - .def_property("data_size", - py::overload_cast<>(&DyldExportsTrie::data_size, py::const_), - py::overload_cast(&DyldExportsTrie::data_size), - "Raw size of the trie") - - .def_property_readonly("content", - [] (const DyldExportsTrie& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The raw export trie") - - .def_property_readonly("exports", - py::overload_cast<>(&DyldExportsTrie::exports), - R"delim( - Iterator over the :class:`~lief.MachO.ExportInfo` associated with - this trie. - )delim") - - .def("show_export_trie", - &DyldExportsTrie::show_export_trie, - "Show the trie in a humman-readable way") - - .def("__eq__", &DyldExportsTrie::operator==) - .def("__ne__", &DyldExportsTrie::operator!=) - .def("__hash__", - [] (const DyldExportsTrie& info) { - return Hash::hash(info); - }) - - .def("__str__", - [] (const DyldExportsTrie& info) { - std::ostringstream stream; - std::string str = stream.str(); - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDyldInfo.cpp b/vendor/lief/api/python/MachO/objects/pyDyldInfo.cpp deleted file mode 100644 index 3913334..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDyldInfo.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DyldInfo.hpp" - -#include "pyIterators.hpp" -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DyldInfo::*)(void) const; - -template -using setter_t = void (DyldInfo::*)(T); - -template -using no_const_getter = T (DyldInfo::*)(void); - - -template<> -void create(py::module& m) { - - py::class_ dyld(m, "DyldInfo", - R"delim( - Class that represents the LC_DYLD_INFO and LC_DYLD_INFO_ONLY commands - )delim"); - - init_ref_iterator(dyld, "it_binding_info"); - - - try { - init_ref_iterator(dyld, "it_export_info"); - } catch (const std::runtime_error&) { } - - dyld - .def_property("rebase", - static_cast>(&DyldInfo::rebase), - static_cast>(&DyldInfo::rebase), - R"delim( - *Rebase* information as a tuple ``(offset, size)`` - - Dyld rebases an image whenever dyld loads it at an address different - from its preferred address. The rebase information is a stream - of byte sized opcodes for which symbolic names start with ``REBASE_OPCODE_``. - - Conceptually the rebase information is a table of tuples: ``(seg-index, seg-offset, type)`` - - The opcodes are a compressed way to encode the table by only - encoding when a column changes. In addition simple patterns - like "every n'th offset for m times" can be encoded in a few bytes - - .. seealso:: - - ``/usr/include/mach-o/loader.h`` - )delim") - - .def_property("rebase_opcodes", - [] (const DyldInfo& self) { - span content = self.rebase_opcodes(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast>(&DyldInfo::rebase_opcodes), - "Return the rebase's opcodes as ``list`` of bytes") - - .def_property_readonly("show_rebases_opcodes", - &DyldInfo::show_rebases_opcodes, - "Return the rebase opcodes in a humman-readable way") - - .def_property("bind", - static_cast>(&DyldInfo::bind), - static_cast>(&DyldInfo::bind), - R"delim( - *Bind* information as a tuple ``(offset, size)`` - - Dyld binds an image during the loading process, if the image - requires any pointers to be initialized to symbols in other images. - The rebase information is a stream of byte sized opcodes for which symbolic names start with ``BIND_OPCODE_``. - - Conceptually the bind information is a table of tuples: - ``(seg-index, seg-offset, type, symbol-library-ordinal, symbol-name, addend)`` - The opcodes are a compressed way to encode the table by only encoding when a column changes. In addition simple patterns - like for runs of pointers initialzed to the same value can be encoded in a few bytes. - - .. seealso:: - - ``/usr/include/mach-o/loader.h`` - )delim") - - - .def_property("bind_opcodes", - [] (const DyldInfo& self) { - span content = self.bind_opcodes(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast>(&DyldInfo::bind_opcodes), - "Return the binding's opcodes as ``list`` of bytes") - - .def_property_readonly("show_bind_opcodes", - &DyldInfo::show_bind_opcodes, - "Return the bind opcodes in a humman-readable way") - - - .def_property("weak_bind", - static_cast>(&DyldInfo::weak_bind), - static_cast>(&DyldInfo::weak_bind), - R"delim( - *Weak Bind* information as a tuple ``(offset, size)`` - - Some C++ programs require dyld to unique symbols so that all - images in the process use the same copy of some code/data. - - This step is done after binding. - The content of the weak_bind info is an opcode stream like the bind_info. - But it is sorted alphabetically by symbol name. This enables dyld to walk - all images with weak binding information in order and look for collisions. - If there are no collisions, dyld does no updating. - That means that some fixups are also encoded in the bind_info. - For instance, all calls to ``operator new`` are first bound to ``libstdc++.dylib`` - using the information in bind_info. - Then if some image overrides operator new that is detected when - the weak_bind information is processed and the call to operator new is then rebound. - - .. seealso:: - - ``/usr/include/mach-o/loader.h`` - )delim") - - - .def_property("weak_bind_opcodes", - [] (const DyldInfo& self) { - span content = self.weak_bind_opcodes(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast>(&DyldInfo::weak_bind_opcodes), - "Return **Weak** binding's opcodes as ``list`` of bytes") - - .def_property_readonly("show_weak_bind_opcodes", - &DyldInfo::show_weak_bind_opcodes, - "Return the weak bind opcodes in a humman-readable way") - - .def_property("lazy_bind", - static_cast>(&DyldInfo::lazy_bind), - static_cast>(&DyldInfo::lazy_bind), - R"delim( - *Lazy Bind* information as a tuple ``(offset, size)`` - - Some uses of external symbols do not need to be bound immediately. - Instead they can be lazily bound on first use. - The lazy_bind are contains a stream of BIND opcodes to bind all lazy symbols. - Normal use is that dyld ignores the lazy_bind section when loading an image. - Instead the static linker arranged for the lazy pointer to initially point - to a helper function which pushes the offset into the lazy_bind area for the symbol - needing to be bound, then jumps to dyld which simply adds the offset to - lazy_bind_off to get the information on what to bind. - - .. seealso:: - - ``/usr/include/mach-o/loader.h`` - )delim") - - - .def_property("lazy_bind_opcodes", - [] (const DyldInfo& self) { - span content = self.lazy_bind_opcodes(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast>(&DyldInfo::lazy_bind_opcodes), - "Return **lazy** binding's opcodes as ``list`` of bytes") - - .def_property_readonly("show_lazy_bind_opcodes", - &DyldInfo::show_lazy_bind_opcodes, - "Return the weak bind opcodes in a humman-readable way", - py::return_value_policy::reference_internal) - - .def_property_readonly("bindings", - static_cast>(&DyldInfo::bindings), - "Return an iterator over Dyld's " RST_CLASS_REF(lief.MachO.BindingInfo) "", - py::return_value_policy::reference_internal) - - .def_property("export_info", - static_cast>(&DyldInfo::export_info), - static_cast>(&DyldInfo::export_info), - R"delim( - *Export* information as a tuple ``(offset, size)`` - - The symbols exported by a dylib are encoded in a trie. - This is a compact representation that factors out common prefixes. - - It also reduces ``LINKEDIT`` pages in RAM because it encodes all - information (name, address, flags) in one small, contiguous range. - The export area is a stream of nodes. The first node sequentially - is the start node for the trie. - - Nodes for a symbol start with a byte that is the length of the exported - symbol information for the string so far. - If there is no exported symbol, the byte is zero. - If there is exported info, it follows the length byte. - The exported info normally consists of a flags and offset both encoded - in `uleb128 `_. - The offset is location of the content named by the symbol. - It is the offset from the mach_header for the image. - - After the initial byte and optional exported symbol information - is a byte of how many edges (0-255) that this node has leaving - it, followed by each edge. - Each edge is a zero terminated cstring of the addition chars - in the symbol, followed by a uleb128 offset for the node that - edge points to. - - .. seealso:: - - ``/usr/include/mach-o/loader.h`` - )delim") - - - .def_property("export_trie", - [] (const DyldInfo& self) { - span content = self.export_trie(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast>(&DyldInfo::export_trie), - "Return Export's trie as ``list`` of bytes") - - .def_property_readonly("exports", - static_cast>(&DyldInfo::exports), - "Return an iterator over Dyld's " RST_CLASS_REF(lief.MachO.ExportInfo) "", - py::return_value_policy::reference_internal) - - .def_property_readonly("show_export_trie", - &DyldInfo::show_export_trie, - "Return the export trie in a humman-readable way", - py::return_value_policy::reference_internal) - - .def("set_rebase_offset", - &DyldInfo::set_rebase_offset, - "offset"_a) - - .def("set_rebase_size", - &DyldInfo::set_rebase_size, - "size"_a) - - - .def("set_bind_offset", - &DyldInfo::set_bind_offset, - "offset"_a) - - .def("set_bind_size", - &DyldInfo::set_bind_size, - "size"_a) - - - .def("set_weak_bind_offset", - &DyldInfo::set_weak_bind_offset, - "offset"_a) - - .def("set_weak_bind_size", - &DyldInfo::set_weak_bind_size, - "size"_a) - - - .def("set_lazy_bind_offset", - &DyldInfo::set_lazy_bind_offset, - "offset"_a) - - .def("set_lazy_bind_size", - &DyldInfo::set_lazy_bind_size, - "size"_a) - - - .def("set_export_offset", - &DyldInfo::set_export_offset, - "offset"_a) - - .def("set_export_size", - &DyldInfo::set_export_size, - "size"_a) - - .def("__eq__", &DyldInfo::operator==) - .def("__ne__", &DyldInfo::operator!=) - .def("__hash__", - [] (const DyldInfo& info) { - return Hash::hash(info); - }) - - - .def("__str__", - [] (const DyldInfo& info) { - std::ostringstream stream; - stream << info; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDylibCommand.cpp b/vendor/lief/api/python/MachO/objects/pyDylibCommand.cpp deleted file mode 100644 index 028f68c..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDylibCommand.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DylibCommand.hpp" - -#include "pyMachO.hpp" - - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DylibCommand::*)(void) const; - -template -using setter_t = void (DylibCommand::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "DylibCommand", - R"delim( - Class which represents a library dependency - )delim") - - .def_property("name", - static_cast>(&DylibCommand::name), - static_cast>(&DylibCommand::name), - "Library's name", - py::return_value_policy::reference_internal) - - .def_property("timestamp", - static_cast>(&DylibCommand::timestamp), - static_cast>(&DylibCommand::timestamp), - "Library's timestamp", - py::return_value_policy::reference_internal) - - .def_property("current_version", - static_cast>(&DylibCommand::current_version), - static_cast>(&DylibCommand::current_version), - "Library's current version", - py::return_value_policy::reference_internal) - - .def_property("compatibility_version", - static_cast>(&DylibCommand::compatibility_version), - static_cast>(&DylibCommand::compatibility_version), - "Library's compatibility version", - py::return_value_policy::reference_internal) - - .def_static("weak_lib", - &DylibCommand::weak_dylib, - "Factory function to generate a " RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES.LOAD_WEAK_DYLIB) " library", - "name"_a, "timestamp"_a = 0, "current_version"_a = 0, "compat_version"_a = 0) - - .def_static("id_dylib", - &DylibCommand::id_dylib, - "Factory function to generate a " RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES.ID_DYLIB) " library", - "name"_a, "timestamp"_a = 0, "current_version"_a = 0, "compat_version"_a = 0) - - .def_static("load_dylib", - &DylibCommand::load_dylib, - "Factory function to generate a " RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES.LOAD_DYLIB) " library", - "name"_a, "timestamp"_a = 0, "current_version"_a = 0, "compat_version"_a = 0) - - .def_static("reexport_dylib", - &DylibCommand::reexport_dylib, - "Factory function to generate a " RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES.REEXPORT_DYLIB) " library", - "name"_a, "timestamp"_a = 0, "current_version"_a = 0, "compat_version"_a = 0) - - .def_static("load_upward_dylib", - &DylibCommand::load_upward_dylib, - "Factory function to generate a " RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES.LOAD_UPWARD_DYLIB) " library", - "name"_a, "timestamp"_a = 0, "current_version"_a = 0, "compat_version"_a = 0) - - .def_static("lazy_load_dylib", - &DylibCommand::lazy_load_dylib, - "Factory function to generate a " RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES.LAZY_LOAD_DYLIB) " library", - "name"_a, "timestamp"_a = 0, "current_version"_a = 0, "compat_version"_a = 0) - - .def("__eq__", &DylibCommand::operator==) - .def("__ne__", &DylibCommand::operator!=) - .def("__hash__", - [] (const DylibCommand& dylib_command) { - return Hash::hash(dylib_command); - }) - - - .def("__str__", - [] (const DylibCommand& command) - { - std::ostringstream stream; - stream << command; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDylinker.cpp b/vendor/lief/api/python/MachO/objects/pyDylinker.cpp deleted file mode 100644 index 8b9d959..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDylinker.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DylinkerCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DylinkerCommand::*)(void) const; - -template -using setter_t = void (DylinkerCommand::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "DylinkerCommand", - R"delim( - Class that represents the Mach-O linker, also named loader - Most of the time, :attr:`~lief.MachO.DylinkerCommand.name` returns ``/usr/lib/dyld`` - )delim") - - .def_property("name", - static_cast>(&DylinkerCommand::name), - static_cast>(&DylinkerCommand::name), - "Path to the loader/linker", - py::return_value_policy::reference_internal) - - .def("__eq__", &DylinkerCommand::operator==) - .def("__ne__", &DylinkerCommand::operator!=) - .def("__hash__", - [] (const DylinkerCommand& dylinker) { - return Hash::hash(dylinker); - }) - - - .def("__str__", - [] (const DylinkerCommand& dylinker) - { - std::ostringstream stream; - stream << dylinker; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyDynamicSymbolCommand.cpp b/vendor/lief/api/python/MachO/objects/pyDynamicSymbolCommand.cpp deleted file mode 100644 index 6c88653..0000000 --- a/vendor/lief/api/python/MachO/objects/pyDynamicSymbolCommand.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/DynamicSymbolCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (DynamicSymbolCommand::*)(void) const; - -template -using setter_t = void (DynamicSymbolCommand::*)(T); - -template -using no_const_getter = T (DynamicSymbolCommand::*)(void); - - -template<> -void create(py::module& m) { - - py::class_(m, "DynamicSymbolCommand", - R"delim( - Class that represents the LC_DYSYMTAB command. - This command completes the LC_SYMTAB (SymbolCommand) to provide - a better granularity over the symbols layout. - )delim") - - .def_property("idx_local_symbol", - static_cast>(&DynamicSymbolCommand::idx_local_symbol), - static_cast>(&DynamicSymbolCommand::idx_local_symbol), - "Index of the first symbol in the group of local symbols." - ) - - .def_property("nb_local_symbols", - static_cast>(&DynamicSymbolCommand::nb_local_symbols), - static_cast>(&DynamicSymbolCommand::nb_local_symbols), - "Number of symbols in the group of local symbols." - ) - - .def_property("idx_external_define_symbol", - static_cast>(&DynamicSymbolCommand::idx_external_define_symbol), - static_cast>(&DynamicSymbolCommand::idx_external_define_symbol), - "Index of the first symbol in the group of defined external symbols." - ) - - .def_property("nb_external_define_symbols", - static_cast>(&DynamicSymbolCommand::nb_external_define_symbols), - static_cast>(&DynamicSymbolCommand::nb_external_define_symbols), - "Number of symbols in the group of defined external symbols." - ) - - .def_property("idx_undefined_symbol", - static_cast>(&DynamicSymbolCommand::idx_undefined_symbol), - static_cast>(&DynamicSymbolCommand::idx_undefined_symbol), - "Index of the first symbol in the group of undefined external symbols." - ) - - .def_property("nb_undefined_symbols", - static_cast>(&DynamicSymbolCommand::nb_undefined_symbols), - static_cast>(&DynamicSymbolCommand::nb_undefined_symbols), - "Number of symbols in the group of undefined external symbols." - ) - - .def_property("toc_offset", - static_cast>(&DynamicSymbolCommand::toc_offset), - static_cast>(&DynamicSymbolCommand::toc_offset), - R"delim( - Byte offset from the start of the file to the table of contents data. - Table of content is used by legacy Mach-O loader and this field should be set to 0 - )delim") - - .def_property("nb_toc", - static_cast>(&DynamicSymbolCommand::nb_toc), - static_cast>(&DynamicSymbolCommand::nb_toc), - R"delim( - Number of entries in the table of contents - Should be set to 0 on recent Mach-O - )delim") - - .def_property("module_table_offset", - static_cast>(&DynamicSymbolCommand::module_table_offset), - static_cast>(&DynamicSymbolCommand::module_table_offset), - R"delim( - Byte offset from the start of the file to the module table data. - This field seems unused by recent Mach-O loader and should be set to 0 - )delim") - - .def_property("nb_module_table", - static_cast>(&DynamicSymbolCommand::nb_module_table), - static_cast>(&DynamicSymbolCommand::nb_module_table), - R"delim( - Number of entries in the module table. - This field seems unused by recent Mach-O loader and should be set to 0. - )delim") - - .def_property("external_reference_symbol_offset", - static_cast>(&DynamicSymbolCommand::external_reference_symbol_offset), - static_cast>(&DynamicSymbolCommand::external_reference_symbol_offset), - R"delim( - Byte offset from the start of the file to the external reference table data. - This field seems unused by recent Mach-O loader and should be set to 0 - )delim") - - .def_property("nb_external_reference_symbols", - static_cast>(&DynamicSymbolCommand::nb_external_reference_symbols), - static_cast>(&DynamicSymbolCommand::nb_external_reference_symbols), - R"delim( - Number of entries in the external reference table. - This field seems unused by recent Mach-O loader and should be set to 0. - )delim") - - .def_property("indirect_symbol_offset", - static_cast>(&DynamicSymbolCommand::indirect_symbol_offset), - static_cast>(&DynamicSymbolCommand::indirect_symbol_offset), - R"delim( - Byte offset from the start of the file to the indirect symbol table data. - - Indirect symbol table is used by the loader to speed-up symbol resolution during - the *lazy binding* process - - References: - - * ``dyld-519.2.1/src/ImageLoaderMachOCompressed.cpp`` - * ``dyld-519.2.1/src/ImageLoaderMachOClassic.cpp`` - )delim") - - .def_property("nb_indirect_symbols", - static_cast>(&DynamicSymbolCommand::nb_indirect_symbols), - static_cast>(&DynamicSymbolCommand::nb_indirect_symbols), - "Number of entries in the indirect symbol table.") - - .def_property("external_relocation_offset", - static_cast>(&DynamicSymbolCommand::external_relocation_offset), - static_cast>(&DynamicSymbolCommand::external_relocation_offset), - R"delim( - Byte offset from the start of the file to the module table data. - This field seems unused by recent Mach-O loader and should be set to 0 - )delim") - - .def_property("nb_external_relocations", - static_cast>(&DynamicSymbolCommand::nb_external_relocations), - static_cast>(&DynamicSymbolCommand::nb_external_relocations), - R"delim( - Number of entries in the external relocation table. - This field seems unused by recent Mach-O loader and should be set to 0 - )delim") - - .def_property("local_relocation_offset", - static_cast>(&DynamicSymbolCommand::local_relocation_offset), - static_cast>(&DynamicSymbolCommand::local_relocation_offset), - R"delim( - Byte offset from the start of the file to the local relocation table data. - This field seems unused by recent Mach-O loader and should be set to 0 - )delim") - - .def_property("nb_local_relocations", - static_cast>(&DynamicSymbolCommand::nb_local_relocations), - static_cast>(&DynamicSymbolCommand::nb_local_relocations), - R"delim( - Number of entries in the local relocation table. - This field seems unused by recent Mach-O loader and should be set to 0 - )delim") - - .def("__eq__", &DynamicSymbolCommand::operator==) - .def("__ne__", &DynamicSymbolCommand::operator!=) - .def("__hash__", - [] (const DynamicSymbolCommand& cmd) { - return Hash::hash(cmd); - }) - - - .def("__str__", - [] (const DynamicSymbolCommand& info) - { - std::ostringstream stream; - stream << info; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyEncryptionInfo.cpp b/vendor/lief/api/python/MachO/objects/pyEncryptionInfo.cpp deleted file mode 100644 index a936061..0000000 --- a/vendor/lief/api/python/MachO/objects/pyEncryptionInfo.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/EncryptionInfo.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (EncryptionInfo::*)(void) const; - -template -using setter_t = void (EncryptionInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "EncryptionInfo", - R"delim( - Class that represents the LC_ENCRYPTION_INFO / LC_ENCRYPTION_INFO_64 commands - - The encryption info is usually present in Mach-O executables that - target iOS to encrypt some sections of the binary - )delim") - - .def_property("crypt_offset", - static_cast>(&EncryptionInfo::crypt_offset), - static_cast>(&EncryptionInfo::crypt_offset), - "File offset of encrypted range") - - .def_property("crypt_size", - static_cast>(&EncryptionInfo::crypt_size), - static_cast>(&EncryptionInfo::crypt_size), - "File size of encrypted range") - - .def_property("crypt_id", - static_cast>(&EncryptionInfo::crypt_id), - static_cast>(&EncryptionInfo::crypt_id), - "The encryption system. 0 means no encrypted") - - - - .def("__eq__", &EncryptionInfo::operator==) - .def("__ne__", &EncryptionInfo::operator!=) - .def("__hash__", - [] (const EncryptionInfo& uuid) { - return Hash::hash(uuid); - }) - - - .def("__str__", - [] (const EncryptionInfo& uuid) - { - std::ostringstream stream; - stream << uuid; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyExportInfo.cpp b/vendor/lief/api/python/MachO/objects/pyExportInfo.cpp deleted file mode 100644 index 8b4731d..0000000 --- a/vendor/lief/api/python/MachO/objects/pyExportInfo.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/ExportInfo.hpp" -#include "LIEF/MachO/Symbol.hpp" -#include "LIEF/MachO/DylibCommand.hpp" - -#include "pyMachO.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (ExportInfo::*)(void) const; - -template -using no_const_getter_t = T (ExportInfo::*)(void); - -template -using setter_t = void (ExportInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "ExportInfo", - R"delim( - Class that provides an interface over the Dyld export info - - This class does not represent a structure that exists in the Mach-O format - specification but provides a *view* on an entry of the Dyld export trie. - )delim") - - .def_property_readonly("node_offset", - static_cast>(&ExportInfo::node_offset), - "Original offset in the export Trie") - - .def_property_readonly("kind", - static_cast>(&ExportInfo::kind), - "The export's kind: regular, thread local, absolute, ... (" RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_KINDS) ")") - - .def_property_readonly("flags_list", - static_cast>(&ExportInfo::flags_list), - "Return flags as a list of " RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_KINDS) "") - - .def_property("flags", - static_cast>(&ExportInfo::flags), - static_cast>(&ExportInfo::flags), - "Some information (" RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_FLAGS) ") about the export (like weak export, reexport, ...)") - - .def_property("address", - static_cast>(&ExportInfo::address), - static_cast>(&ExportInfo::address), - "The address of the export") - - .def_property_readonly("alias", - static_cast>(&ExportInfo::alias), - "" RST_CLASS_REF(lief.MachO.Symbol) " alias if the current symbol is re-exported", - py::return_value_policy::reference) - - .def_property_readonly("alias_library", - static_cast>(&ExportInfo::alias_library), - "If the current symbol has an alias, it returns the " RST_CLASS_REF(lief.MachO.DylibCommand) " " - " command associated with", - py::return_value_policy::reference) - - .def_property_readonly("has_symbol", - &ExportInfo::has_symbol, - "``True`` if the export info has a " RST_CLASS_REF(lief.MachO.Symbol) " associated with") - - .def("has", - &ExportInfo::has, - "Check if the flag " RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_FLAGS) " given in first parameter is present" - "flag"_a) - - .def_property_readonly("symbol", - static_cast(&ExportInfo::symbol), - "" RST_CLASS_REF(lief.MachO.Symbol) " associated with the export if any, or None ", - py::return_value_policy::reference) - - - .def("__eq__", &ExportInfo::operator==) - .def("__ne__", &ExportInfo::operator!=) - .def("__hash__", - [] (const ExportInfo& export_info) { - return Hash::hash(export_info); - }) - - - .def("__str__", - [] (const ExportInfo& export_info) - { - std::ostringstream stream; - stream << export_info; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyFatBinary.cpp b/vendor/lief/api/python/MachO/objects/pyFatBinary.cpp deleted file mode 100644 index 9bb1ecb..0000000 --- a/vendor/lief/api/python/MachO/objects/pyFatBinary.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include "LIEF/MachO/FatBinary.hpp" - -#include "pyIterators.hpp" -#include "pyMachO.hpp" - - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - - py::class_ fat(m, "FatBinary", - R"delim( - Class which represent a Mach-O (fat) binary - This object is also used for representing Mach-O binaries that are **NOT FAT** - )delim"); - - init_ref_iterator(fat, "it_binaries"); - - fat - .def_property_readonly("size", - &FatBinary::size, - "Number of " RST_CLASS_REF(lief.MachO.Binary) " registred") - - .def("at", - static_cast(&FatBinary::at), - "Return the " RST_CLASS_REF(lief.MachO.Binary) " at the given index or None if it is not present", - "index"_a, - py::return_value_policy::reference_internal) - - .def("take", - static_cast(FatBinary::*)(CPU_TYPES)>(&FatBinary::take), - "Return the " RST_CLASS_REF(lief.MachO.Binary) " that matches the " - "given " RST_CLASS_REF(lief.MachO.CPU_TYPES) "", - "cpu"_a, - py::return_value_policy::take_ownership) - - .def("write", - &FatBinary::write, - "Build a Mach-O universal binary", - "filename"_a) - - .def("raw", - &FatBinary::raw, - "Build a Mach-O universal binary and return its bytes") - - .def("__len__", - &FatBinary::size) - - .def("__getitem__", - static_cast(&FatBinary::operator[]), - "", - py::return_value_policy::reference_internal) - - .def("__iter__", - static_cast(&FatBinary::begin), - py::return_value_policy::reference_internal) - - .def("__str__", - [] (const FatBinary& fat_binary) - { - std::ostringstream stream; - stream << fat_binary; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyFilesetCommand.cpp b/vendor/lief/api/python/MachO/objects/pyFilesetCommand.cpp deleted file mode 100644 index 7bb917d..0000000 --- a/vendor/lief/api/python/MachO/objects/pyFilesetCommand.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/FilesetCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (FilesetCommand::*)(void) const; - -template -using setter_t = void (FilesetCommand::*)(T); - -template -using no_const_getter_t = T (FilesetCommand::*)(); - - - -template<> -void create(py::module& m) { - - py::class_(m, "FilesetCommand", - "Class associated with the LC_FILESET_ENTRY commands") - .def_property("name", - static_cast>(&FilesetCommand::name), - static_cast>(&FilesetCommand::name), - "Name of the underlying MachO binary") - - .def_property("virtual_address", - static_cast>(&FilesetCommand::virtual_address), - static_cast>(&FilesetCommand::virtual_address), - "Memory address where the MachO file should be mapped") - - .def_property("file_offset", - static_cast>(&FilesetCommand::file_offset), - static_cast>(&FilesetCommand::file_offset), - "Original offset in the kernel cache") - - .def_property_readonly("binary", - static_cast>(&FilesetCommand::binary), - "Return the " RST_CLASS_REF(lief.MachO.Binary) " object associated with the entry", - py::return_value_policy::reference) - - .def("__eq__", &FilesetCommand::operator==) - .def("__ne__", &FilesetCommand::operator!=) - .def("__hash__", - [] (const FilesetCommand& main) { - return Hash::hash(main); - }) - - - .def("__str__", - [] (const FilesetCommand& main) - { - std::ostringstream stream; - stream << main; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyFunctionStarts.cpp b/vendor/lief/api/python/MachO/objects/pyFunctionStarts.cpp deleted file mode 100644 index 73a088b..0000000 --- a/vendor/lief/api/python/MachO/objects/pyFunctionStarts.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/FunctionStarts.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (FunctionStarts::*)(void) const; - -template -using setter_t = void (FunctionStarts::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "FunctionStarts", - R"delim( - Class which represents the LC_FUNCTION_STARTS command - - This command is an array of ULEB128 encoded values - )delim") - - .def_property("data_offset", - static_cast>(&FunctionStarts::data_offset), - static_cast>(&FunctionStarts::data_offset), - "Offset in the binary where *start functions* are located") - - .def_property("data_size", - static_cast>(&FunctionStarts::data_size), - static_cast>(&FunctionStarts::data_size), - "Size of the functions list in the binary") - - .def_property("functions", - static_cast&>>(&FunctionStarts::functions), - static_cast&>>(&FunctionStarts::functions), - R"delim( - Addresses of every function entry point in the executable - - This allows functions to exist for which there are no entries in the symbol table. - - .. warning:: - - The address is relative to the ``__TEXT`` segment - )delim", - py::return_value_policy::reference_internal) - - .def("add_function", - &FunctionStarts::add_function, - "Add a new function", - "address"_a) - - .def_property_readonly("content", - [] (const FunctionStarts& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The original content as a bytes stream") - - .def("__eq__", &FunctionStarts::operator==) - .def("__ne__", &FunctionStarts::operator!=) - .def("__hash__", - [] (const FunctionStarts& func) { - return Hash::hash(func); - }) - - - .def("__str__", - [] (const FunctionStarts& func) - { - std::ostringstream stream; - stream << func; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyHeader.cpp b/vendor/lief/api/python/MachO/objects/pyHeader.cpp deleted file mode 100644 index fc024fb..0000000 --- a/vendor/lief/api/python/MachO/objects/pyHeader.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/Header.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - - -template<> -void create
(py::module& m) { - - py::class_(m, "Header", - "Class that represents the Mach-O header") - .def(py::init<>()) - - .def_property("magic", - static_cast>(&Header::magic), - static_cast>(&Header::magic), - R"delim( - The Mach-O magic bytes. These bytes determine whether it is - a 32 bits Mach-O, a 64 bits Mach-O files etc. - )delim") - - .def_property("cpu_type", - static_cast>(&Header::cpu_type), - static_cast>(&Header::cpu_type), - "Target CPU ( " RST_CLASS_REF(lief.MachO.CPU_TYPES) ")") - - .def_property("cpu_subtype", - static_cast>(&Header::cpu_subtype), - static_cast>(&Header::cpu_subtype), - R"delim( - Return the CPU subtype supported by the Mach-O binary. - For ARM architectures, this value could represent the minimum version - for which the Mach-O binary has been compiled for. - )delim") - - .def_property("file_type", - static_cast>(&Header::file_type), - static_cast>(&Header::file_type), - "Binary's type ( " RST_CLASS_REF(lief.MachO.FILE_TYPES) ")") - - .def_property("flags", - static_cast>(&Header::flags), - static_cast>(&Header::flags), - "Binary's flags ( " RST_CLASS_REF(lief.MachO.HEADER_FLAGS) ")") - - .def_property("nb_cmds", - static_cast>(&Header::nb_cmds), - static_cast>(&Header::nb_cmds), - "Number of " RST_CLASS_REF(lief.MachO.LoadCommand) "") - - .def_property("sizeof_cmds", - static_cast>(&Header::sizeof_cmds), - static_cast>(&Header::sizeof_cmds), - "Size of all " RST_CLASS_REF(lief.MachO.LoadCommand) "") - - .def_property("reserved", - static_cast>(&Header::reserved), - static_cast>(&Header::reserved), - "According to the official documentation, a reserved value") - - .def_property_readonly("flags_list", - &Header::flags_list, - "" RST_CLASS_REF(lief.PE.HEADER_FLAGS) " as a list") - - .def("add", - static_cast(&Header::add), - "Add the given " RST_CLASS_REF(lief.MachO.HEADER_FLAGS) "", - "flag"_a) - - .def("remove", - static_cast(&Header::remove), - "Remove the given " RST_CLASS_REF(lief.MachO.HEADER_FLAGS) "", - "flag"_a) - - .def("has", - static_cast(&Header::has), - "``True`` if the given " RST_CLASS_REF(lief.MachO.HEADER_FLAGS) " is in the " - ":attr:`~lief.MachO.Header.flags`", - "flag"_a) - - - .def("__eq__", &Header::operator==) - .def("__ne__", &Header::operator!=) - .def("__hash__", - [] (const Header& header) { - return Hash::hash(header); - }) - - .def(py::self += HEADER_FLAGS()) - .def(py::self -= HEADER_FLAGS()) - - .def("__contains__", - static_cast(&Header::has), - "Check if the given " RST_CLASS_REF(lief.MachO.HEADER_FLAGS) " is present") - - - .def("__str__", - [] (const Header& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyLinkerOptHint.cpp b/vendor/lief/api/python/MachO/objects/pyLinkerOptHint.cpp deleted file mode 100644 index f46609a..0000000 --- a/vendor/lief/api/python/MachO/objects/pyLinkerOptHint.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/LinkerOptHint.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - py::class_(m, "LinkerOptHint", - R"delim( - Class which represents the `LC_LINKER_OPTIMIZATION_HINT` command - )delim") - - .def_property("data_offset", - py::overload_cast<>(&LinkerOptHint::data_offset, py::const_), - py::overload_cast(&LinkerOptHint::data_offset), - "Offset in the binary where the payload starts") - - .def_property("data_size", - py::overload_cast<>(&LinkerOptHint::data_offset, py::const_), - py::overload_cast(&LinkerOptHint::data_offset), - "Size of the raw payload") - - .def_property_readonly("content", - [] (const LinkerOptHint& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The raw payload") - - .def("__eq__", &LinkerOptHint::operator==) - .def("__ne__", &LinkerOptHint::operator!=) - .def("__hash__", - [] (const LinkerOptHint& opt) { - return Hash::hash(opt); - }) - - .def("__str__", - [] (const LinkerOptHint& opt) - { - std::ostringstream stream; - stream << opt; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyLoadCommand.cpp b/vendor/lief/api/python/MachO/objects/pyLoadCommand.cpp deleted file mode 100644 index fd9f3c2..0000000 --- a/vendor/lief/api/python/MachO/objects/pyLoadCommand.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/LoadCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (LoadCommand::*)(void) const; - -template -using setter_t = void (LoadCommand::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "LoadCommand", - "Based class for the Mach-O load commands") - .def(py::init<>()) - - .def_property("command", - static_cast>(&LoadCommand::command), - static_cast>(&LoadCommand::command), - "Command type ( " RST_CLASS_REF(lief.MachO.LOAD_COMMAND_TYPES) ")" - ) - - .def_property("size", - static_cast>(&LoadCommand::size), - static_cast>(&LoadCommand::size), - "Size of the command (should be greather than ``sizeof(load_command)``)") - - .def_property("data", - static_cast>(&LoadCommand::data), - static_cast>(&LoadCommand::data), - "Command's data") - - .def_property("command_offset", - static_cast>(&LoadCommand::command_offset), - static_cast>(&LoadCommand::command_offset), - "Offset of the command within the *Load Command Table*") - - .def("__eq__", &LoadCommand::operator==) - .def("__ne__", &LoadCommand::operator!=) - .def("__hash__", - [] (const LoadCommand& load_command) { - return Hash::hash(load_command); - }) - - .def("__str__", - [] (const LoadCommand& command) - { - std::ostringstream stream; - stream << command; - std::string str = stream.str(); - return str; - }); -} - - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyMainCommand.cpp b/vendor/lief/api/python/MachO/objects/pyMainCommand.cpp deleted file mode 100644 index 76d5a60..0000000 --- a/vendor/lief/api/python/MachO/objects/pyMainCommand.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/MainCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (MainCommand::*)(void) const; - -template -using setter_t = void (MainCommand::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "MainCommand", - R"delim( - Class that represent the LC_MAIN command. This kind - of command can be used to determine the entrypoint of an executable - )delim") - - .def_property("entrypoint", - static_cast>(&MainCommand::entrypoint), - static_cast>(&MainCommand::entrypoint), - "Offset of the *main* function relative to the ``__TEXT`` segment") - - .def_property("stack_size", - static_cast>(&MainCommand::stack_size), - static_cast>(&MainCommand::stack_size), - "The initial stack size (if not 0)") - - - .def("__eq__", &MainCommand::operator==) - .def("__ne__", &MainCommand::operator!=) - .def("__hash__", - [] (const MainCommand& main) { - return Hash::hash(main); - }) - - - .def("__str__", - [] (const MainCommand& main) - { - std::ostringstream stream; - stream << main; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyParser.cpp b/vendor/lief/api/python/MachO/objects/pyParser.cpp deleted file mode 100644 index b3f13c0..0000000 --- a/vendor/lief/api/python/MachO/objects/pyParser.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/MachO/Parser.hpp" -#include "LIEF/MachO/FatBinary.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - // Parser (Parser) - m.def("parse", - static_cast (*) (const std::string&, const ParserConfig&)>(&LIEF::MachO::Parser::parse), - R"delim( - Parse the given binary and return a :class:`~lief.MachO.FatBinary` object - - One can configure the parsing with the ``config`` parameter. See :class:`~lief.MachO.ParserConfig`, - )delim", - "filename"_a, - "config"_a = ParserConfig::deep(), - py::return_value_policy::take_ownership); - - - m.def("parse", - static_cast (*) (const std::vector&, const std::string&, const ParserConfig&)>(&LIEF::MachO::Parser::parse), - R"delim( - Parse the given binary (from raw bytes) and return a :class:`~lief.MachO.FatBinary` object - - One can configure the parsing with the ``config`` parameter. See :class:`~lief.MachO.ParserConfig` - )delim", - "raw"_a, - "name"_a = "", - "config"_a = ParserConfig::quick(), - py::return_value_policy::take_ownership); - - - m.def("parse", - [] (py::object byteio, std::string name, const ParserConfig& config) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str))}; - - return LIEF::MachO::Parser::parse(std::move(raw), name, config); - }, - R"delim( - Parse the given binary from a Python IO interface and return a :class:`~lief.MachO.FatBinary` object - - One can configure the parsing with the ``config`` parameter. See :class:`~lief.MachO.ParserConfig` - )delim", - "io"_a, - "name"_a = "", - "config"_a = ParserConfig::quick(), - py::return_value_policy::take_ownership); -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyParserConfig.cpp b/vendor/lief/api/python/MachO/objects/pyParserConfig.cpp deleted file mode 100644 index 5bee190..0000000 --- a/vendor/lief/api/python/MachO/objects/pyParserConfig.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include "LIEF/MachO/ParserConfig.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - py::class_(m, "ParserConfig", - R"delim( - This class is used to tweak the MachO Parser (:class:`~lief.MachO.Parser`) - )delim") - - .def(py::init<>()) - .def_readwrite("parse_dyld_exports", &ParserConfig::parse_dyld_exports, - "Parse the Dyld export trie") - - .def_readwrite("parse_dyld_bindings", &ParserConfig::parse_dyld_bindings, - "Parse the Dyld binding opcodes") - - .def_readwrite("parse_dyld_rebases", &ParserConfig::parse_dyld_rebases, - "Parse the Dyld rebase opcodes") - - .def("full_dyldinfo", &ParserConfig::full_dyldinfo, - R"delim( - If ``flag`` is set to ``true``, Exports, Bindings and Rebases opcodes are parsed. - - .. warning:: - - Enabling this flag can slow down the parsing - )delim", - "flag"_a) - - .def_property_readonly_static("deep", - [] (py::object /* self */) { return ParserConfig::deep(); }, - R"delim( - Return a parser configuration such as all the objects supported by LIEF are parsed - )delim") - - .def_property_readonly_static("quick", - [] (py::object /* self */) { return ParserConfig::quick(); }, - R"delim( - Return a configuration to parse the most important MachO structures - )delim"); -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyRPathCommand.cpp b/vendor/lief/api/python/MachO/objects/pyRPathCommand.cpp deleted file mode 100644 index 15c6833..0000000 --- a/vendor/lief/api/python/MachO/objects/pyRPathCommand.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2017 - 2021 J.Rieck (based on R. Thomas's work) - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/RPathCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (RPathCommand::*)(void) const; - -template -using setter_t = void (RPathCommand::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "RPathCommand") - - .def_property("path", - static_cast>(&RPathCommand::path), - static_cast>(&RPathCommand::path), - "@rpath path", - py::return_value_policy::reference_internal) - - - .def("__eq__", &RPathCommand::operator==) - .def("__ne__", &RPathCommand::operator!=) - .def("__hash__", - [] (const RPathCommand& rpath_command) { - return Hash::hash(rpath_command); - }) - - - .def("__str__", - [] (const RPathCommand& rpath_command) - { - std::ostringstream stream; - stream << rpath_command; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyRelocation.cpp b/vendor/lief/api/python/MachO/objects/pyRelocation.cpp deleted file mode 100644 index 47d9ef8..0000000 --- a/vendor/lief/api/python/MachO/objects/pyRelocation.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/Relocation.hpp" -#include "LIEF/MachO/Symbol.hpp" -#include "LIEF/MachO/Section.hpp" -#include "LIEF/MachO/SegmentCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (Relocation::*)(void) const; - -template -using setter_t = void (Relocation::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "Relocation", - R"delim( - It extends the LIEF :class:`lief.Relocation` abstract class and it is sub-classed by - - 1. :class:`~lief.MachO.RelocationObject` - 2. :class:`~lief.MachO.RelocationDyld` - )delim") - - .def_property("address", - static_cast>(&Relocation::address), - static_cast>(&Relocation::address), - R"delim( - For :attr:`~lief.MachO.FILE_TYPES.OBJECT` or (:attr:`~lief.MachO.Relocation.origin` is :attr:`~lief.MachO.RELOCATION_ORIGINS.RELOC_TABLE`) this is an " - offset from the start of the :class:`~lief.MachO.Section` - to the item containing the address requiring relocation. - - For :attr:`~lief.MachO.FILE_TYPES.EXECUTE` / :attr:`~lief.MachO.FILE_TYPES.DYLIB` or - (:attr:`~lief.MachO.Relocation.origin` is :attr:`~lief.MachO.RELOCATION_ORIGINS.DYLDINFO`) - this is a :attr:`~lief.MachO.SegmentCommand.virtual_address`. - )delim") - - .def_property("pc_relative", - static_cast>(&Relocation::is_pc_relative), - static_cast>(&Relocation::pc_relative), - R"delim( - Indicates whether the item containing the address to be - relocated is part of a CPU instruction that uses PC-relative addressing. - - For addresses contained in PC-relative instructions, the CPU adds the address of - the instruction to the address contained in the instruction. - )delim") - - .def_property("type", - static_cast>(&Relocation::type), - static_cast>(&Relocation::type), - R"delim( - Type of the relocation according to the :attr:`~lief.MachO.Relocation.architecture` and/or :attr:`~lief.MachO.Relocation.origin` - - If :attr:`~lief.MachO.Relocation.origin` is :attr:`~lief.MachO.RELOCATION_ORIGINS.RELOC_TABLE`: - - See: - - * :class:`lief.MachO.X86_RELOCATION` - * :class:`lief.MachO.X86_64_RELOCATION` - * :class:`lief.MachO.PPC_RELOCATION` - * :class:`lief.MachO.ARM_RELOCATION` - * :class:`lief.MachO.ARM64_RELOCATION` - - If :attr:`~lief.MachO.Relocation.origin` is :attr:`~lief.MachO.RELOCATION_ORIGINS.DYLDINFO`, - the value is associated with :class:`~lief.MachO.REBASE_TYPES`. - )delim") - - .def_property_readonly("architecture", - &Relocation::architecture, - "" RST_CLASS_REF(lief.MachO.CPU_TYPES) " of the relocation") - - .def_property_readonly("has_symbol", - &Relocation::has_symbol, - "``True`` if the relocation has a " RST_CLASS_REF(lief.MachO.Symbol) " associated with") - - .def_property_readonly("symbol", - static_cast(&Relocation::symbol), - "" RST_CLASS_REF(lief.MachO.Symbol) " associated with the relocation if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_section", - &Relocation::has_section, - "``True`` if the relocation has a " RST_CLASS_REF(lief.MachO.Section) " associated with") - - .def_property_readonly("section", - static_cast(&Relocation::section), - "" RST_CLASS_REF(lief.MachO.Section) " associated with the relocation if any, or None", - py::return_value_policy::reference) - - - .def_property_readonly("origin", - &Relocation::origin, - R"delim( - :class:`~lief.MachO.RELOCATION_ORIGINS` of the relocation - - * For :attr:`~lief.MachO.FILE_TYPES.OBJECT` file it should be :attr:`~lief.MachO.RELOCATION_ORIGINS.RELOC_TABLE` - * For :attr:`~lief.MachO.FILE_TYPES.EXECUTE` or :attr:`~lief.MachO.FILE_TYPES.DYLIB` it should be :attr:`~lief.MachO.RELOCATION_ORIGINS.DYLDINFO`") - )delim") - - .def_property_readonly("has_segment", - &Relocation::has_segment, - "``True`` if the relocation has a " RST_CLASS_REF(lief.MachO.SegmentCommand) " associated with") - - .def_property_readonly("segment", - static_cast(&Relocation::segment), - "" RST_CLASS_REF(lief.MachO.SegmentCommand) " associated with the relocation if any, or None", - py::return_value_policy::reference) - - .def("__eq__", &Relocation::operator==) - .def("__ne__", &Relocation::operator!=) - .def("__hash__", - [] (const Relocation& relocation) { - return Hash::hash(relocation); - }) - - - .def("__str__", - [] (const Relocation& relocation) - { - std::ostringstream stream; - stream << relocation; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyRelocationDyld.cpp b/vendor/lief/api/python/MachO/objects/pyRelocationDyld.cpp deleted file mode 100644 index 0057b6a..0000000 --- a/vendor/lief/api/python/MachO/objects/pyRelocationDyld.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/RelocationDyld.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (RelocationDyld::*)(void) const; - -template -using setter_t = void (RelocationDyld::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "RelocationDyld", - R"delim( - Class that represents a relocation found in the :class:`~lief.MachO.DyldInfo` structure. - - While this class does not have an associated structure in the Mach-O format specification, - it provides a convenient interface for the :attr:`lief.MachO.DyldInfo.rebase` values - - See also: :class:`~lief.MachO.RelocationObject` - )delim") - - .def("__le__", &RelocationDyld::operator<=) - .def("__lt__", &RelocationDyld::operator<) - .def("__ge__", &RelocationDyld::operator>=) - .def("__gt__", &RelocationDyld::operator>) - .def("__eq__", &RelocationDyld::operator==) - .def("__ne__", &RelocationDyld::operator!=) - .def("__hash__", - [] (const RelocationDyld& relocation) { - return Hash::hash(relocation); - }) - - .def("__str__", - [] (const RelocationDyld& relocation) - { - std::ostringstream stream; - stream << relocation; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyRelocationFixup.cpp b/vendor/lief/api/python/MachO/objects/pyRelocationFixup.cpp deleted file mode 100644 index 0b48544..0000000 --- a/vendor/lief/api/python/MachO/objects/pyRelocationFixup.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/RelocationFixup.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (RelocationFixup::*)() const; - -template -using setter_t = void (RelocationFixup::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "RelocationFixup", - R"delim( - Class that represents a rebase relocation found in the LC_DYLD_CHAINED_FIXUPS command. - - This class extends :class:`lief.Relocation` (and :class:`lief.MachO.Relocation`) in which - :attr:`~lief.Relocation.address` is set to the absolute virtual address - where the relocation must take place (e.g. `0x10000d270`). - - On the other hand, :attr:`~lief.MachO.RelocationFixup.target` contains the value - that should be set at :attr:`~lief.Relocation.address` if the - imagebase is :attr:`~lief.Binary.imagebase` (e.g. `0x1000073a8`). - - If the Mach-O loader chooses another base address (like 0x7ff100000), it must set - `0x10000d270` to `0x7ff1073a8`. - )delim") - - .def_property("target", - py::overload_cast<>(&RelocationFixup::target, py::const_), - py::overload_cast(&RelocationFixup::target)) - - .def("__eq__", &RelocationFixup::operator==) - .def("__ne__", &RelocationFixup::operator!=) - .def("__hash__", - [] (const RelocationFixup& relocation) { - return Hash::hash(relocation); - }) - - .def("__str__", - [] (const RelocationFixup& relocation) { - std::ostringstream stream; - std::string str = stream.str(); - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyRelocationObject.cpp b/vendor/lief/api/python/MachO/objects/pyRelocationObject.cpp deleted file mode 100644 index 7c8d4e8..0000000 --- a/vendor/lief/api/python/MachO/objects/pyRelocationObject.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/RelocationObject.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (RelocationObject::*)(void) const; - -template -using setter_t = void (RelocationObject::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "RelocationObject", - R"delim( - Class that represents a relocation presents in the MachO object - file (``.o``). Usually, this kind of relocation is found in the :class:`lief.MachO.Section`. - )delim") - - .def_property("value", - static_cast>(&RelocationObject::value), - static_cast>(&RelocationObject::value), - R"delim( - For **scattered** relocations, the address of the relocatable expression - for the item in the file that needs to be updated if the address is changed. - - For relocatable expressions with the difference of two section addresses, - the address from which to subtract (in mathematical terms, the minuend) - is contained in the first relocation entry and the address to subtract (the subtrahend) - is contained in the second relocation entry.", - )delim") - - - .def_property_readonly("is_scattered", - &RelocationObject::is_scattered, - "``True`` if the relocation is a scattered one") - - .def("__eq__", &RelocationObject::operator==) - .def("__ne__", &RelocationObject::operator!=) - .def("__hash__", - [] (const RelocationObject& relocation) { - return Hash::hash(relocation); - }) - - - .def("__str__", - [] (const RelocationObject& relocation) - { - std::ostringstream stream; - stream << relocation; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pySection.cpp b/vendor/lief/api/python/MachO/objects/pySection.cpp deleted file mode 100644 index 1561dbb..0000000 --- a/vendor/lief/api/python/MachO/objects/pySection.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/Section.hpp" -#include "LIEF/MachO/Relocation.hpp" -#include "LIEF/MachO/SegmentCommand.hpp" - -#include "pyMachO.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (Section::*)(void) const; - -template -using setter_t = void (Section::*)(T); - -template -using no_const_getter = T (Section::*)(void); - - -template<> -void create
(py::module& m) { - - py::class_ sec(m, "Section", - "Class that represents a Mach-O section"); - try { - /* - * it_relocations could be already registered by the SegmentCommand - */ - init_ref_iterator(sec, "it_relocations"); - } catch (const std::runtime_error&) { } - - sec - .def(py::init<>()) - - .def(py::init(), - "Constructor from a section's name", - "section_name"_a) - - .def(py::init(), - "Constructor from a section's name and its content", - "section_name"_a, "content"_a) - - .def_property("alignment", - static_cast>(&Section::alignment), - static_cast>(&Section::alignment), - "Section's alignment as a power of 2") - - .def_property("relocation_offset", - static_cast>(&Section::relocation_offset), - static_cast>(&Section::relocation_offset), - R"delim( - Offset of the relocation table. This value should be 0 - for executable and libraries as the relocations are managed by the :attr:`lief.MachO.DyldInfo.rebase` - - Other the other hand, for object files (``.o``) this value should not be 0 - )delim") - - .def_property("numberof_relocations", - static_cast>(&Section::numberof_relocations), - static_cast>(&Section::numberof_relocations), - "Number of relocations associated with this section") - - .def_property("type", - static_cast>(&Section::type), - static_cast>(&Section::type), - R"delim( - Type of the section. This value can help to determine - the purpose of the section (c.f. :class:`~lief.MachO.MACHO_SECTION_TYPES`) - )delim") - - .def_property_readonly("relocations", - static_cast>(&Section::relocations), - "Iterator over the " RST_CLASS_REF(lief.MachO.Relocation) " (if any)", - py::return_value_policy::reference_internal) - - .def_property("reserved1", - static_cast>(&Section::reserved1), - static_cast>(&Section::reserved1), - "According to the official ``loader.h`` file, this value is reserved for *offset* or *index*") - - .def_property("reserved2", - static_cast>(&Section::reserved2), - static_cast>(&Section::reserved2), - "According to the official ``loader.h`` file, this value is reserved for *offset* or *index*") - - .def_property("reserved3", - static_cast>(&Section::reserved3), - static_cast>(&Section::reserved3), - "According to the official ``loader.h`` file, this value is reserved for *offset* or *index*") - - .def_property("flags", - static_cast>(&Section::flags), - static_cast>(&Section::flags), - "Section's flags masked with SECTION_FLAGS_MASK (see: :class:`~lief.MachO.MACHO_SECTION_FLAGS`)") - - .def_property_readonly("flags_list", - static_cast>(&Section::flags_list), - py::return_value_policy::reference_internal) - - .def_property_readonly("segment", - static_cast(&Section::segment), - "" RST_CLASS_REF(lief.MachO.SegmentCommand) " associated with the section or None if not present", - py::return_value_policy::reference) - - .def_property("segment_name", - static_cast>(&Section::segment_name), - static_cast>(&Section::segment_name), - R"delim( - The segment name associated with the section - )delim") - - .def_property_readonly("has_segment", - &Section::has_segment, - "True if the current section has a segment associated with") - - .def("has", - static_cast(&Section::has), - "Check if the section has the given " RST_CLASS_REF(lief.MachO.SECTION_FLAGS) "", - "flag"_a) - - .def("add", - static_cast(&Section::add), - "Add the given " RST_CLASS_REF(lief.MachO.SECTION_FLAGS) "", - "flag"_a) - - .def("remove", - static_cast(&Section::remove), - "Remove the given " RST_CLASS_REF(lief.MachO.SECTION_FLAGS) "", - "flag"_a) - - .def(py::self += MACHO_SECTION_FLAGS()) - .def(py::self -= MACHO_SECTION_FLAGS()) - - .def("__contains__", - static_cast(&Section::has), - "Check if the given " RST_CLASS_REF(lief.MachO.MACHO_SECTION_FLAGS) " is present") - - - - .def("__eq__", &Section::operator==) - .def("__ne__", &Section::operator!=) - .def("__hash__", - [] (const Section& section) { - return Hash::hash(section); - }) - - - .def("__str__", - [] (const Section& section) - { - std::ostringstream stream; - stream << section; - std::string str = stream.str(); - return str; - }); - -} - -} -} - diff --git a/vendor/lief/api/python/MachO/objects/pySegmentCommand.cpp b/vendor/lief/api/python/MachO/objects/pySegmentCommand.cpp deleted file mode 100644 index 42ed1cf..0000000 --- a/vendor/lief/api/python/MachO/objects/pySegmentCommand.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyMachO.hpp" -#include "pyIterators.hpp" - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/SegmentCommand.hpp" -#include "LIEF/MachO/Section.hpp" - -#include -#include - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (SegmentCommand::*)(void) const; - -template -using setter_t = void (SegmentCommand::*)(T); - -template -using no_const_getter = T (SegmentCommand::*)(void); - - -template<> -void create(py::module& m) { - - py::class_ seg_cmd(m, "SegmentCommand", - R"delim( - Class which represents a LOAD_COMMAND_TYPES::LC_SEGMENT / LOAD_COMMAND_TYPES::LC_SEGMENT_64 command - )delim"); - - init_ref_iterator(seg_cmd, "it_sections"); - - try { - /* - * it_relocations could be already registered by the Section - */ - init_ref_iterator(seg_cmd, "it_relocations"); - } catch (const std::runtime_error&) { } - - seg_cmd - .def(py::init<>()) - .def(py::init()) - .def(py::init()) - - .def_property("name", - [] (const SegmentCommand& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&SegmentCommand::name), - "Segment's name") - - .def_property("virtual_address", - static_cast>(&SegmentCommand::virtual_address), - static_cast>(&SegmentCommand::virtual_address), - "Segment's virtual address") - - .def_property("virtual_size", - static_cast>(&SegmentCommand::virtual_size), - static_cast>(&SegmentCommand::virtual_size), - "Segment's virtual size") - - .def_property("file_size", - static_cast>(&SegmentCommand::file_size), - static_cast>(&SegmentCommand::file_size), - "Segment's file size") - - .def_property("file_offset", - static_cast>(&SegmentCommand::file_offset), - static_cast>(&SegmentCommand::file_offset), - "Segment's file offset") - - .def_property("max_protection", - static_cast>(&SegmentCommand::max_protection), - static_cast>(&SegmentCommand::max_protection), - "Segment's max protection") - - .def_property("init_protection", - static_cast>(&SegmentCommand::init_protection), - static_cast>(&SegmentCommand::init_protection), - "Segment's initial protection") - - .def_property("numberof_sections", - static_cast>(&SegmentCommand::numberof_sections), - static_cast>(&SegmentCommand::numberof_sections), - "Number of sections in this segment") - - .def_property_readonly("sections", - static_cast>(&SegmentCommand::sections), - "Segment's sections") - - .def_property_readonly("relocations", - static_cast>(&SegmentCommand::relocations), - "Segment's relocations") - - .def_property_readonly("index", &SegmentCommand::index, - "Relative index of the segment in the segment table") - - .def_property("content", - [] (const SegmentCommand& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, - static_cast>(&SegmentCommand::content), - "Segment's content") - - .def_property("flags", - static_cast>(&SegmentCommand::flags), - static_cast>(&SegmentCommand::flags), - "Segment's flags") - - .def("has", - static_cast(&SegmentCommand::has), - "Check if the given " RST_CLASS_REF(lief.MachO.Section) " belongs to the current segment", - "section"_a) - - .def("has_section", - static_cast(&SegmentCommand::has_section), - "Check if the given section name belongs to the current segment", - "section_name"_a) - - .def("add_section", - static_cast(&SegmentCommand::add_section), - "", - "section"_a, - py::return_value_policy::reference) - - .def("get_section", - py::overload_cast(&SegmentCommand::get_section), - R"delim( - Get the :class:`~lief.MachO.Section` with the given name - )delim", - "name"_a, - py::return_value_policy::reference_internal) - - .def("__eq__", &SegmentCommand::operator==) - .def("__ne__", &SegmentCommand::operator!=) - .def("__hash__", - [] (const SegmentCommand& segment_command) { - return Hash::hash(segment_command); - }) - - - .def("__str__", - [] (const SegmentCommand& segment) - { - std::ostringstream stream; - stream << segment; - std::string str = stream.str(); - return str; - }); - -} - -} -} - - diff --git a/vendor/lief/api/python/MachO/objects/pySegmentSplitInfo.cpp b/vendor/lief/api/python/MachO/objects/pySegmentSplitInfo.cpp deleted file mode 100644 index 0567ecf..0000000 --- a/vendor/lief/api/python/MachO/objects/pySegmentSplitInfo.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/SegmentSplitInfo.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (SegmentSplitInfo::*)(void) const; - -template -using setter_t = void (SegmentSplitInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "SegmentSplitInfo", - "Class that represents the LOAD_COMMAND_TYPES::LC_SEGMENT_SPLIT_INFO command") - - .def_property("data_offset", - static_cast>(&SegmentSplitInfo::data_offset), - static_cast>(&SegmentSplitInfo::data_offset), - "Offset in the binary where the data start") - - .def_property("data_size", - static_cast>(&SegmentSplitInfo::data_size), - static_cast>(&SegmentSplitInfo::data_size), - "Size of the raw data") - - .def_property_readonly("content", - [] (const SegmentSplitInfo& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The original content as a bytes stream") - - .def("__eq__", &SegmentSplitInfo::operator==) - .def("__ne__", &SegmentSplitInfo::operator!=) - .def("__hash__", - [] (const SegmentSplitInfo& func) { - return Hash::hash(func); - }) - - - .def("__str__", - [] (const SegmentSplitInfo& func) - { - std::ostringstream stream; - stream << func; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pySourceVersion.cpp b/vendor/lief/api/python/MachO/objects/pySourceVersion.cpp deleted file mode 100644 index 16b6187..0000000 --- a/vendor/lief/api/python/MachO/objects/pySourceVersion.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/SourceVersion.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (SourceVersion::*)(void) const; - -template -using setter_t = void (SourceVersion::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "SourceVersion", - R"delim( - Class that represents the MachO LOAD_COMMAND_TYPES::LC_SOURCE_VERSION - This command is used to provide the *version* of the sources used to build the binary - )delim") - - .def_property("version", - static_cast>(&SourceVersion::version), - static_cast>(&SourceVersion::version), - "Version as a tuple of **5** integers", - py::return_value_policy::reference_internal) - - - .def("__eq__", &SourceVersion::operator==) - .def("__ne__", &SourceVersion::operator!=) - .def("__hash__", - [] (const SourceVersion& version) { - return Hash::hash(version); - }) - - - .def("__str__", - [] (const SourceVersion& version) - { - std::ostringstream stream; - stream << version; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pySubFramework.cpp b/vendor/lief/api/python/MachO/objects/pySubFramework.cpp deleted file mode 100644 index f836a63..0000000 --- a/vendor/lief/api/python/MachO/objects/pySubFramework.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/SubFramework.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (SubFramework::*)(void) const; - -template -using setter_t = void (SubFramework::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "SubFramework", - R"delim( - Class that represents the SubFramework command. - Accodring to the Mach-O ``loader.h`` documentation: - - - > A dynamically linked shared library may be a subframework of an umbrella - > framework. If so it will be linked with "-umbrella umbrella_name" where - > Where "umbrella_name" is the name of the umbrella framework. A subframework - > can only be linked against by its umbrella framework or other subframeworks - > that are part of the same umbrella framework. Otherwise the static link - > editor produces an error and states to link against the umbrella framework. - > The name of the umbrella framework for subframeworks is recorded in the - > following structure. - )delim") - - .def_property("umbrella", - static_cast>(&SubFramework::umbrella), - static_cast>(&SubFramework::umbrella), - "Name of the umbrella framework") - - .def("__eq__", &SubFramework::operator==) - .def("__ne__", &SubFramework::operator!=) - .def("__hash__", - [] (const SubFramework& func) { - return Hash::hash(func); - }) - - - .def("__str__", - [] (const SubFramework& func) - { - std::ostringstream stream; - stream << func; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pySymbol.cpp b/vendor/lief/api/python/MachO/objects/pySymbol.cpp deleted file mode 100644 index d3df007..0000000 --- a/vendor/lief/api/python/MachO/objects/pySymbol.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/Section.hpp" -#include "LIEF/MachO/Symbol.hpp" - -#include "pyIterators.hpp" -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (Symbol::*)(void) const; - -template -using setter_t = void (Symbol::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ symbol(m, "Symbol", - R"delim( - Class that represents a Symbol in a Mach-O file. - - A Mach-O symbol can come from: - - 1. The symbols command (LC_SYMTAB / SymbolCommand) - 2. The Dyld Export trie - 3. The Dyld Symbol bindings - )delim"); - - py::enum_(symbol, "TOOLS") - .value("NONE", Symbol::CATEGORY::NONE) - .value("LOCAL", Symbol::CATEGORY::LOCAL) - .value("EXTERNAL", Symbol::CATEGORY::EXTERNAL) - .value("UNDEFINED", Symbol::CATEGORY::UNDEFINED) - .value("INDIRECT_ABS", Symbol::CATEGORY::INDIRECT_ABS) - .value("INDIRECT_LOCAL", Symbol::CATEGORY::INDIRECT_LOCAL); - - symbol - .def(py::init<>()) - - .def_property_readonly("demangled_name", - &Symbol::demangled_name, - "Symbol's unmangled name") - - .def_property("type", - static_cast>(&Symbol::type), - static_cast>(&Symbol::type)) - - .def_property("numberof_sections", - static_cast>(&Symbol::numberof_sections), - static_cast>(&Symbol::numberof_sections), - R"delim( - It returns the number of sections in which this symbol can be found. - If the symbol can't be found in any section, it returns 0 (NO_SECT) - )delim") - - .def_property("description", - static_cast>(&Symbol::description), - static_cast>(&Symbol::description), - "Return information about the symbol (:class:`~lief.MachO.SYMBOL_DESCRIPTIONS`)") - - .def_property_readonly("has_export_info", - &Symbol::has_export_info, - "``True`` if the symbol has an " RST_CLASS_REF(lief.MachO.ExportInfo) " associated with") - - .def_property_readonly("origin", - &Symbol::origin, - "Return the " RST_CLASS_REF(lief.MachO.SYMBOL_ORIGINS) " of this symbol") - - .def_property_readonly("export_info", - static_cast(&Symbol::export_info), - "" RST_CLASS_REF(lief.MachO.ExportInfo) " associated with the symbol if any, or None", - py::return_value_policy::reference) - - .def_property_readonly("has_binding_info", - &Symbol::has_binding_info, - "``True`` if the symbol has an " RST_CLASS_REF(lief.MachO.BindingInfo) " associated with") - - .def_property_readonly("binding_info", - static_cast(&Symbol::binding_info), - "" RST_CLASS_REF(lief.MachO.BindingInfo) " associated with the symbol if any, or None", - py::return_value_policy::reference) - - .def("__eq__", &Symbol::operator==) - .def("__ne__", &Symbol::operator!=) - .def("__hash__", - [] (const Symbol& symbol) { - return Hash::hash(symbol); - }) - - - .def("__str__", - [] (const Symbol& symbol) { - std::ostringstream stream; - stream << symbol; - std::string str = stream.str(); - return str; - }); - -} - -} -} - - - diff --git a/vendor/lief/api/python/MachO/objects/pySymbolCommand.cpp b/vendor/lief/api/python/MachO/objects/pySymbolCommand.cpp deleted file mode 100644 index 4656840..0000000 --- a/vendor/lief/api/python/MachO/objects/pySymbolCommand.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/SymbolCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (SymbolCommand::*)(void) const; - -template -using setter_t = void (SymbolCommand::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "SymbolCommand", - R"delim( - Class that represents the LC_SYMTAB command - )delim") - .def(py::init<>()) - - .def_property("symbol_offset", - static_cast>(&SymbolCommand::symbol_offset), - static_cast>(&SymbolCommand::symbol_offset), - "Offset from the start of the file to the n_list associated with the command") - - .def_property("numberof_symbols", - static_cast>(&SymbolCommand::numberof_symbols), - static_cast>(&SymbolCommand::numberof_symbols), - "Number of symbols registered") - - .def_property("strings_offset", - static_cast>(&SymbolCommand::strings_offset), - static_cast>(&SymbolCommand::strings_offset), - "Offset from the start of the file to the string table") - - .def_property("strings_size", - static_cast>(&SymbolCommand::strings_size), - static_cast>(&SymbolCommand::strings_size), - "Size of the size string table") - - - .def("__eq__", &SymbolCommand::operator==) - .def("__ne__", &SymbolCommand::operator!=) - .def("__hash__", - [] (const SymbolCommand& symbolcmd) { - return Hash::hash(symbolcmd); - }) - - .def("__str__", - [] (const SymbolCommand& symbolcmd) - { - std::ostringstream stream; - stream << symbolcmd; - std::string str = stream.str(); - return str; - }); - -} - -} -} - - diff --git a/vendor/lief/api/python/MachO/objects/pyThreadCommand.cpp b/vendor/lief/api/python/MachO/objects/pyThreadCommand.cpp deleted file mode 100644 index 3a49575..0000000 --- a/vendor/lief/api/python/MachO/objects/pyThreadCommand.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/ThreadCommand.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (ThreadCommand::*)(void) const; - -template -using setter_t = void (ThreadCommand::*)(T); - - - -template<> -void create(py::module& m) { - - py::class_(m, "ThreadCommand", - R"delim( - Class that represents the LC_THREAD / LC_UNIXTHREAD commands and that - can be used to get the binary entrypoint when the LC_MAIN (MainCommand) is not present - - Generally speaking, this command aims at defining the original state - of the main thread which includes the registers' values - )delim") - - .def_property("flavor", - static_cast>(&ThreadCommand::flavor), - static_cast>(&ThreadCommand::flavor), - R"delim( - Integer that defines a special *flavor* for the thread. - - The meaning of this value depends on the :attr:`~lief.MachO.ThreadCommand.architecture`. - The list of the values can be found in the XNU kernel files: - - - xnu/osfmk/mach/arm/thread_status.h for the ARM/AArch64 architectures - - xnu/osfmk/mach/i386/thread_status.h for the x86/x86-64 architectures - )delim") - - - .def_property("state", - static_cast&>>(&ThreadCommand::state), - static_cast&>>(&ThreadCommand::state), - R"delim( - The actual thread state as a vector of bytes. Depending on the architecture(), - these data can be casted into x86_thread_state_t, x86_thread_state64_t, ... - )delim") - - - .def_property("count", - static_cast>(&ThreadCommand::count), - static_cast>(&ThreadCommand::count), - R"delim( - Size of the thread state data with 32-bits alignment. - - This value should match len(:attr:`~lief.MachO.ThreadCommand.state`) - )delim") - - .def_property_readonly("pc", - static_cast>(&ThreadCommand::pc), - R"delim( - Return the initial Program Counter regardless of the underlying architecture. - This value, when non null, can be used to determine the binary's entrypoint. - - Underneath, it works by looking for the PC register value in the :attr:`~lief.MachO.ThreadCommand.state` data - )delim") - - .def_property("architecture", - static_cast>(&ThreadCommand::architecture), - static_cast>(&ThreadCommand::architecture), - "The CPU architecture that is targeted by this ThreadCommand") - - .def("__eq__", &ThreadCommand::operator==) - .def("__ne__", &ThreadCommand::operator!=) - .def("__hash__", - [] (const ThreadCommand& thread) { - return LIEF::Hash::hash(thread); - }) - - - .def("__str__", - [] (const ThreadCommand& thread) - { - std::ostringstream stream; - stream << thread; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyTwoLevelHints.cpp b/vendor/lief/api/python/MachO/objects/pyTwoLevelHints.cpp deleted file mode 100644 index 368acb0..0000000 --- a/vendor/lief/api/python/MachO/objects/pyTwoLevelHints.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/TwoLevelHints.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template<> -void create(py::module& m) { - - py::class_ cmd(m, "TwoLevelHints", - R"delim( - Class which represents the `LC_TWOLEVEL_HINTS` command - )delim"); - - cmd - .def_property_readonly("hints", - py::overload_cast<>(&TwoLevelHints::hints)) - .def_property_readonly("content", - [] (const TwoLevelHints& self) { - span content = self.content(); - return py::memoryview::from_memory(content.data(), content.size()); - }, "The original content as a bytes stream") - - .def("__eq__", &TwoLevelHints::operator==) - .def("__ne__", &TwoLevelHints::operator!=) - .def("__hash__", - [] (const TwoLevelHints& two) { - return Hash::hash(two); - }) - - .def("__str__", - [] (const TwoLevelHints& two) { - std::ostringstream stream; - stream << two; - return stream.str(); - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyUUID.cpp b/vendor/lief/api/python/MachO/objects/pyUUID.cpp deleted file mode 100644 index ebfec67..0000000 --- a/vendor/lief/api/python/MachO/objects/pyUUID.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/UUIDCommand.hpp" - -#include "pyMachO.hpp" - -#ifdef uuid_t -#pragma message("Windows #define uuid_t, undefine it for this file.") -#undef uuid_t -#endif - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (UUIDCommand::*)(void) const; - -template -using setter_t = void (UUIDCommand::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "UUIDCommand", - "Class that represents the UUID command") - - .def_property("uuid", - static_cast>(&UUIDCommand::uuid), - static_cast>(&UUIDCommand::uuid), - "UUID as a list", - py::return_value_policy::reference_internal) - - - .def("__eq__", &UUIDCommand::operator==) - .def("__ne__", &UUIDCommand::operator!=) - .def("__hash__", - [] (const UUIDCommand& uuid) { - return Hash::hash(uuid); - }) - - - .def("__str__", - [] (const UUIDCommand& uuid) - { - std::ostringstream stream; - stream << uuid; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/MachO/objects/pyVersionMin.cpp b/vendor/lief/api/python/MachO/objects/pyVersionMin.cpp deleted file mode 100644 index 6644eb5..0000000 --- a/vendor/lief/api/python/MachO/objects/pyVersionMin.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include -#include - -#include "LIEF/MachO/hash.hpp" -#include "LIEF/MachO/VersionMin.hpp" - -#include "pyMachO.hpp" - -namespace LIEF { -namespace MachO { - -template -using getter_t = T (VersionMin::*)(void) const; - -template -using setter_t = void (VersionMin::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "VersionMin", - "Class that wraps the LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS, ... commands") - - .def_property("version", - static_cast>(&VersionMin::version), - static_cast>(&VersionMin::version), - "Version as a tuple of **3** integers", - py::return_value_policy::reference_internal) - - - .def_property("sdk", - static_cast>(&VersionMin::sdk), - static_cast>(&VersionMin::sdk), - "SDK as a tuple of **3** integers", - py::return_value_policy::reference_internal) - - - .def("__eq__", &VersionMin::operator==) - .def("__ne__", &VersionMin::operator!=) - .def("__hash__", - [] (const VersionMin& version) { - return Hash::hash(version); - }) - - - .def("__str__", - [] (const VersionMin& version) - { - std::ostringstream stream; - stream << version; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/MachO/pyEnums.cpp b/vendor/lief/api/python/MachO/pyEnums.cpp deleted file mode 100644 index 9af1da5..0000000 --- a/vendor/lief/api/python/MachO/pyEnums.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyMachO.hpp" -#include "LIEF/MachO/enums.hpp" -#include "LIEF/MachO/EnumToString.hpp" -#include "enums_wrapper.hpp" - -#define PY_ENUM(x) LIEF::MachO::to_string(x), x - -namespace LIEF { -namespace MachO { - -void init_enums(py::module& m) { - - LIEF::enum_(m, "CPU_TYPES") - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_ANY)) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_X86)) - .value("I386", LIEF::MachO::CPU_TYPES::CPU_TYPE_I386) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_X86_64)) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_MC98000)) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_ARM)) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_ARM64)) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_SPARC)) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_POWERPC)) - .value(PY_ENUM(LIEF::MachO::CPU_TYPES::CPU_TYPE_POWERPC64)); - - LIEF::enum_(m, "MACHO_TYPES") - .value(PY_ENUM(LIEF::MachO::MACHO_TYPES::MH_MAGIC)) - .value(PY_ENUM(LIEF::MachO::MACHO_TYPES::MH_CIGAM)) - .value(PY_ENUM(LIEF::MachO::MACHO_TYPES::MH_MAGIC_64)) - .value(PY_ENUM(LIEF::MachO::MACHO_TYPES::MH_CIGAM_64)) - .value(PY_ENUM(LIEF::MachO::MACHO_TYPES::FAT_MAGIC)) - .value(PY_ENUM(LIEF::MachO::MACHO_TYPES::FAT_CIGAM)); - - - LIEF::enum_(m, "FILE_TYPES") - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_OBJECT)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_EXECUTE)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_FVMLIB)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_CORE)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_PRELOAD)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_DYLIB)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_DYLINKER)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_BUNDLE)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_DYLIB_STUB)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_DSYM)) - .value(PY_ENUM(LIEF::MachO::FILE_TYPES::MH_KEXT_BUNDLE)); - - LIEF::enum_(m, "HEADER_FLAGS") - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_NOUNDEFS)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_INCRLINK)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_DYLDLINK)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_BINDATLOAD)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_PREBOUND)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_SPLIT_SEGS)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_LAZY_INIT)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_TWOLEVEL)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_FORCE_FLAT)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_NOMULTIDEFS)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_NOFIXPREBINDING)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_PREBINDABLE)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_ALLMODSBOUND)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_SUBSECTIONS_VIA_SYMBOLS)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_CANONICAL)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_WEAK_DEFINES)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_BINDS_TO_WEAK)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_ALLOW_STACK_EXECUTION)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_ROOT_SAFE)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_SETUID_SAFE)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_NO_REEXPORTED_DYLIBS)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_PIE)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_DEAD_STRIPPABLE_DYLIB)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_HAS_TLV_DESCRIPTORS)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_NO_HEAP_EXECUTION)) - .value(PY_ENUM(LIEF::MachO::HEADER_FLAGS::MH_APP_EXTENSION_SAFE)); - - - - LIEF::enum_(m, "LOAD_COMMAND_TYPES") - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SEGMENT)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SYMTAB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SYMSEG)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_THREAD)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_UNIXTHREAD)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LOADFVMLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_IDFVMLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_IDENT)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_FVMFILE)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_PREPAGE)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DYSYMTAB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LOAD_DYLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_ID_DYLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LOAD_DYLINKER)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_ID_DYLINKER)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_PREBOUND_DYLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_ROUTINES)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SUB_FRAMEWORK)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SUB_UMBRELLA)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SUB_CLIENT)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SUB_LIBRARY)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_TWOLEVEL_HINTS)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_PREBIND_CKSUM)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LOAD_WEAK_DYLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SEGMENT_64)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_ROUTINES_64)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_UUID)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_RPATH)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_CODE_SIGNATURE)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SEGMENT_SPLIT_INFO)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_REEXPORT_DYLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LAZY_LOAD_DYLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_ENCRYPTION_INFO)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DYLD_INFO)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DYLD_INFO_ONLY)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LOAD_UPWARD_DYLIB)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_VERSION_MIN_MACOSX)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_VERSION_MIN_IPHONEOS)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_FUNCTION_STARTS)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DYLD_ENVIRONMENT)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_MAIN)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DATA_IN_CODE)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_SOURCE_VERSION)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DYLIB_CODE_SIGN_DRS)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_ENCRYPTION_INFO_64)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LINKER_OPTION)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_LINKER_OPTIMIZATION_HINT)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_VERSION_MIN_TVOS)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_VERSION_MIN_WATCHOS)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_NOTE)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_BUILD_VERSION)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DYLD_EXPORTS_TRIE)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_DYLD_CHAINED_FIXUPS)) - .value(PY_ENUM(LIEF::MachO::LOAD_COMMAND_TYPES::LC_FILESET_ENTRY)); - - - LIEF::enum_(m, "SECTION_TYPES") - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_REGULAR)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_ZEROFILL)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_CSTRING_LITERALS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_4BYTE_LITERALS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_8BYTE_LITERALS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_LITERAL_POINTERS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_NON_LAZY_SYMBOL_POINTERS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_LAZY_SYMBOL_POINTERS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_SYMBOL_STUBS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_MOD_INIT_FUNC_POINTERS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_MOD_TERM_FUNC_POINTERS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_COALESCED)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_GB_ZEROFILL)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_INTERPOSING)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_16BYTE_LITERALS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_DTRACE_DOF)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_LAZY_DYLIB_SYMBOL_POINTERS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_THREAD_LOCAL_REGULAR)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_THREAD_LOCAL_ZEROFILL)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_THREAD_LOCAL_VARIABLES)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_THREAD_LOCAL_VARIABLE_POINTERS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_TYPES::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS)); - - - LIEF::enum_(m, "X86_RELOCATION") - .value(PY_ENUM(LIEF::MachO::X86_RELOCATION::GENERIC_RELOC_VANILLA)) - .value(PY_ENUM(LIEF::MachO::X86_RELOCATION::GENERIC_RELOC_PAIR)) - .value(PY_ENUM(LIEF::MachO::X86_RELOCATION::GENERIC_RELOC_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::X86_RELOCATION::GENERIC_RELOC_PB_LA_PTR)) - .value(PY_ENUM(LIEF::MachO::X86_RELOCATION::GENERIC_RELOC_LOCAL_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::X86_RELOCATION::GENERIC_RELOC_TLV)); - - LIEF::enum_(m, "X86_64_RELOCATION") - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_UNSIGNED)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_SIGNED)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_BRANCH)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_GOT_LOAD)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_GOT)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_SUBTRACTOR)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_SIGNED_1)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_SIGNED_2)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_SIGNED_4)) - .value(PY_ENUM(LIEF::MachO::X86_64_RELOCATION::X86_64_RELOC_TLV)); - - LIEF::enum_(m, "PPC_RELOCATION") - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_VANILLA)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_PAIR)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_BR14)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_BR24)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_HI16)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_LO16)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_HA16)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_LO14)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_PB_LA_PTR)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_HI16_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_LO16_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_HA16_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_JBSR)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_LO14_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::PPC_RELOCATION::PPC_RELOC_LOCAL_SECTDIFF)); - - LIEF::enum_(m, "ARM_RELOCATION") - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_VANILLA)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_PAIR)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_LOCAL_SECTDIFF)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_PB_LA_PTR)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_BR24)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_THUMB_RELOC_BR22)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_THUMB_32BIT_BRANCH)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_HALF)) - .value(PY_ENUM(LIEF::MachO::ARM_RELOCATION::ARM_RELOC_HALF_SECTDIFF)); - - LIEF::enum_(m, "ARM64_RELOCATION") - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_UNSIGNED)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_SUBTRACTOR)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_BRANCH26)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_PAGE21)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_PAGEOFF12)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_GOT_LOAD_PAGE21)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_GOT_LOAD_PAGEOFF12)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_POINTER_TO_GOT)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_TLVP_LOAD_PAGE21)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_TLVP_LOAD_PAGEOFF12)) - .value(PY_ENUM(LIEF::MachO::ARM64_RELOCATION::ARM64_RELOC_ADDEND)); - - - LIEF::enum_(m, "RELOCATION_ORIGINS") - .value(PY_ENUM(LIEF::MachO::RELOCATION_ORIGINS::ORIGIN_UNKNOWN)) - .value(PY_ENUM(LIEF::MachO::RELOCATION_ORIGINS::ORIGIN_DYLDINFO)) - .value(PY_ENUM(LIEF::MachO::RELOCATION_ORIGINS::ORIGIN_RELOC_TABLE)) - .value(PY_ENUM(LIEF::MachO::RELOCATION_ORIGINS::ORIGIN_CHAINED_FIXUPS)); - - - LIEF::enum_(m, "REBASE_TYPES") - .value(PY_ENUM(LIEF::MachO::REBASE_TYPES::REBASE_TYPE_POINTER)) - .value(PY_ENUM(LIEF::MachO::REBASE_TYPES::REBASE_TYPE_TEXT_ABSOLUTE32)) - .value(PY_ENUM(LIEF::MachO::REBASE_TYPES::REBASE_TYPE_TEXT_PCREL32)); - - - LIEF::enum_(m, "BINDING_CLASS") - .value(PY_ENUM(LIEF::MachO::BINDING_CLASS::BIND_CLASS_WEAK)) - .value(PY_ENUM(LIEF::MachO::BINDING_CLASS::BIND_CLASS_LAZY)) - .value(PY_ENUM(LIEF::MachO::BINDING_CLASS::BIND_CLASS_STANDARD)) - .value(PY_ENUM(LIEF::MachO::BINDING_CLASS::BIND_CLASS_THREADED)); - - - LIEF::enum_(m, "REBASE_OPCODES") - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_DONE)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_SET_TYPE_IMM)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_ADD_ADDR_ULEB)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_ADD_ADDR_IMM_SCALED)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_DO_REBASE_IMM_TIMES)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_DO_REBASE_ULEB_TIMES)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB)) - .value(PY_ENUM(LIEF::MachO::REBASE_OPCODES::REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB)); - - - LIEF::enum_(m, "BIND_TYPES") - .value(PY_ENUM(LIEF::MachO::BIND_TYPES::BIND_TYPE_POINTER)) - .value(PY_ENUM(LIEF::MachO::BIND_TYPES::BIND_TYPE_TEXT_ABSOLUTE32)) - .value(PY_ENUM(LIEF::MachO::BIND_TYPES::BIND_TYPE_TEXT_PCREL32)); - - - LIEF::enum_(m, "BIND_SPECIAL_DYLIB") - .value(PY_ENUM(LIEF::MachO::BIND_SPECIAL_DYLIB::BIND_SPECIAL_DYLIB_SELF)) - .value(PY_ENUM(LIEF::MachO::BIND_SPECIAL_DYLIB::BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE)) - .value(PY_ENUM(LIEF::MachO::BIND_SPECIAL_DYLIB::BIND_SPECIAL_DYLIB_FLAT_LOOKUP)); - - - LIEF::enum_(m, "BIND_OPCODES") - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_DONE)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_SET_DYLIB_ORDINAL_IMM)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_SET_DYLIB_SPECIAL_IMM)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_SET_TYPE_IMM)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_SET_ADDEND_SLEB)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_ADD_ADDR_ULEB)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_DO_BIND)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB)) - .value(PY_ENUM(LIEF::MachO::BIND_OPCODES::BIND_OPCODE_THREADED)); - - - LIEF::enum_(m, "EXPORT_SYMBOL_KINDS") - .value(PY_ENUM(LIEF::MachO::EXPORT_SYMBOL_KINDS::EXPORT_SYMBOL_FLAGS_KIND_REGULAR)) - .value(PY_ENUM(LIEF::MachO::EXPORT_SYMBOL_KINDS::EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL)) - .value(PY_ENUM(LIEF::MachO::EXPORT_SYMBOL_KINDS::EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE)); - - py::enum_(m, "EXPORT_SYMBOL_FLAGS") - .value(PY_ENUM(LIEF::MachO::EXPORT_SYMBOL_FLAGS::EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION)) - .value(PY_ENUM(LIEF::MachO::EXPORT_SYMBOL_FLAGS::EXPORT_SYMBOL_FLAGS_REEXPORT)) - .value(PY_ENUM(LIEF::MachO::EXPORT_SYMBOL_FLAGS::EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER)); - - - LIEF::enum_(m, "VM_PROTECTIONS") - .value(PY_ENUM(LIEF::MachO::VM_PROTECTIONS::VM_PROT_READ)) - .value(PY_ENUM(LIEF::MachO::VM_PROTECTIONS::VM_PROT_WRITE)) - .value(PY_ENUM(LIEF::MachO::VM_PROTECTIONS::VM_PROT_EXECUTE)); - - - LIEF::enum_(m, "SYMBOL_ORIGINS") - .value(PY_ENUM(LIEF::MachO::SYMBOL_ORIGINS::SYM_ORIGIN_UNKNOWN)) - .value(PY_ENUM(LIEF::MachO::SYMBOL_ORIGINS::SYM_ORIGIN_DYLD_EXPORT)) - .value(PY_ENUM(LIEF::MachO::SYMBOL_ORIGINS::SYM_ORIGIN_LC_SYMTAB)); - - LIEF::enum_(m, "SECTION_FLAGS") - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_PURE_INSTRUCTIONS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_NO_TOC)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_STRIP_STATIC_SYMS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_NO_DEAD_STRIP)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_LIVE_SUPPORT)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_SELF_MODIFYING_CODE)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_DEBUG)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_SOME_INSTRUCTIONS)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_EXT_RELOC)) - .value(PY_ENUM(LIEF::MachO::MACHO_SECTION_FLAGS::S_ATTR_LOC_RELOC)); - - LIEF::enum_(m, "DYLD_CHAINED_FORMAT") - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_FORMAT::IMPORT)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_FORMAT::IMPORT_ADDEND)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_FORMAT::IMPORT_ADDEND64)); - - LIEF::enum_(m, "DYLD_CHAINED_PTR_FORMAT") - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_ARM64E)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_64)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_32)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_32_CACHE)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_32_FIRMWARE)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_64_OFFSET)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_ARM64E_KERNEL)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_64_KERNEL_CACHE)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_ARM64E_USERLAND)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_ARM64E_FIRMWARE)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_X86_64_KERNEL_CACHE)) - .value(PY_ENUM(LIEF::MachO::DYLD_CHAINED_PTR_FORMAT::PTR_ARM64E_USERLAND24)); -} - -} -} diff --git a/vendor/lief/api/python/MachO/pyMachO.cpp b/vendor/lief/api/python/MachO/pyMachO.cpp deleted file mode 100644 index 1d36eea..0000000 --- a/vendor/lief/api/python/MachO/pyMachO.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#include "pyMachO.hpp" - - -namespace LIEF { -namespace MachO { - -void init_python_module(py::module& m) { - py::module LIEF_MachO_module = m.def_submodule("MachO", "Python API for the MachO format"); - - init_enums(LIEF_MachO_module); - init_objects(LIEF_MachO_module); - init_utils(LIEF_MachO_module); -} - -void init_objects(py::module& m) { - - CREATE(ParserConfig, m); - CREATE(Parser, m); - - CREATE(FatBinary, m); - CREATE(Binary, m); - CREATE(Header, m); - CREATE(LoadCommand, m); - CREATE(UUIDCommand, m); - CREATE(SymbolCommand, m); - CREATE(SegmentCommand, m); - CREATE(Section, m); - CREATE(MainCommand, m); - CREATE(DynamicSymbolCommand, m); - CREATE(DylinkerCommand, m); - CREATE(DyldInfo, m); - CREATE(DyldChainedFixups, m); - CREATE(DyldExportsTrie, m); - CREATE(DylibCommand, m); - CREATE(ThreadCommand, m); - CREATE(RPathCommand, m); - CREATE(Symbol, m); - CREATE(Relocation, m); - CREATE(RelocationObject, m); - CREATE(RelocationDyld, m); - CREATE(RelocationFixup, m); - CREATE(BindingInfo, m); - CREATE(DyldBindingInfo, m); - CREATE(ExportInfo, m); - CREATE(FunctionStarts, m); - CREATE(CodeSignature, m); - CREATE(CodeSignatureDir, m); - CREATE(DataInCode, m); - CREATE(DataCodeEntry, m); - CREATE(SourceVersion, m); - CREATE(VersionMin, m); - CREATE(SegmentSplitInfo, m); - CREATE(SubFramework, m); - CREATE(DyldEnvironment, m); - CREATE(EncryptionInfo, m); - CREATE(BuildVersion, m); - CREATE(FilesetCommand, m); - CREATE(ChainedBindingInfo, m); - CREATE(TwoLevelHints, m); - CREATE(LinkerOptHint, m); - CREATE(Builder, m); -} - -} -} diff --git a/vendor/lief/api/python/MachO/pyMachO.hpp b/vendor/lief/api/python/MachO/pyMachO.hpp deleted file mode 100644 index 6358ca7..0000000 --- a/vendor/lief/api/python/MachO/pyMachO.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_MACHO_H_ -#define PY_LIEF_MACHO_H_ - -#include "LIEF/MachO/Parser.hpp" -#include "LIEF/MachO/Binary.hpp" -#include "LIEF/MachO/Builder.hpp" - -#include -#include - -#include "pyLIEF.hpp" - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - - -namespace LIEF { -namespace MachO { - -template -void create(py::module&); - -void init_python_module(py::module& m); -void init_objects(py::module&); -void init_enums(py::module&); -void init_utils(py::module&); - - -SPECIALIZE_CREATE(Parser); -SPECIALIZE_CREATE(ParserConfig); - -SPECIALIZE_CREATE(Binary); -SPECIALIZE_CREATE(BindingInfo); -SPECIALIZE_CREATE(BuildVersion); -SPECIALIZE_CREATE(ChainedBindingInfo); -SPECIALIZE_CREATE(CodeSignature); -SPECIALIZE_CREATE(CodeSignatureDir); -SPECIALIZE_CREATE(DataCodeEntry); -SPECIALIZE_CREATE(DataInCode); -SPECIALIZE_CREATE(DyldBindingInfo); -SPECIALIZE_CREATE(DyldChainedFixups); -SPECIALIZE_CREATE(DyldEnvironment); -SPECIALIZE_CREATE(DyldExportsTrie); -SPECIALIZE_CREATE(DyldInfo); -SPECIALIZE_CREATE(DylibCommand); -SPECIALIZE_CREATE(DylinkerCommand); -SPECIALIZE_CREATE(DynamicSymbolCommand); -SPECIALIZE_CREATE(EncryptionInfo); -SPECIALIZE_CREATE(ExportInfo); -SPECIALIZE_CREATE(FatBinary); -SPECIALIZE_CREATE(FilesetCommand); -SPECIALIZE_CREATE(FunctionStarts); -SPECIALIZE_CREATE(Header); -SPECIALIZE_CREATE(LinkerOptHint); -SPECIALIZE_CREATE(LoadCommand); -SPECIALIZE_CREATE(MainCommand); -SPECIALIZE_CREATE(RPathCommand); -SPECIALIZE_CREATE(Relocation); -SPECIALIZE_CREATE(RelocationDyld); -SPECIALIZE_CREATE(RelocationFixup); -SPECIALIZE_CREATE(RelocationObject); -SPECIALIZE_CREATE(Section); -SPECIALIZE_CREATE(SegmentCommand); -SPECIALIZE_CREATE(SegmentSplitInfo); -SPECIALIZE_CREATE(SourceVersion); -SPECIALIZE_CREATE(SubFramework); -SPECIALIZE_CREATE(Symbol); -SPECIALIZE_CREATE(SymbolCommand); -SPECIALIZE_CREATE(ThreadCommand); -SPECIALIZE_CREATE(TwoLevelHints); -SPECIALIZE_CREATE(UUIDCommand); -SPECIALIZE_CREATE(VersionMin); -SPECIALIZE_CREATE(Builder); - -} -} - - -// Opaque containers -PYBIND11_MAKE_OPAQUE(std::vector) - - -#endif diff --git a/vendor/lief/api/python/MachO/pyUtils.cpp b/vendor/lief/api/python/MachO/pyUtils.cpp deleted file mode 100644 index d2124ad..0000000 --- a/vendor/lief/api/python/MachO/pyUtils.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyMachO.hpp" - -#include "LIEF/MachO/utils.hpp" -#include "LIEF/MachO/FatBinary.hpp" - -namespace LIEF { -namespace MachO { - -void init_utils(py::module& m) { - - m.def("is_macho", - static_cast(&is_macho), - "Check if the given file is a ``MachO`` (from filename)", - "filename"_a); - - - m.def("is_macho", - static_cast&)>(&is_macho), - "Check if the given raw data is a ``MachO``", - "raw"_a); - - m.def("is_fat", - &is_fat, - "Check if the given Mach-O is fat", - "file"_a); - - m.def("is_64", - &is_64, - "Check if the given Mach-O is 64-bits", - "file"_a); - - m.def("check_layout", - [] (const Binary& bin) { - std::string on_error; - bool is_valid = check_layout(bin, &on_error); - return std::pair{is_valid, on_error}; - }, - "Check the layout of the given Mach-O binary. It checks if it can be signed " - "according to ``cctools-921/libstuff/checkout.c``", - "file"_a); - - m.def("check_layout", - [] (const FatBinary& bin) { - std::string on_error; - bool is_valid = check_layout(bin, &on_error); - return std::pair{is_valid, on_error}; - }, - R"delim( - Check the layout of the given FAT Mach-O by checking individually the layout - of the binaries embedded in the FAT. - )delim", - "file"_a); - - -} - -} // namespace Mach-O -} - diff --git a/vendor/lief/api/python/OAT/CMakeLists.txt b/vendor/lief/api/python/OAT/CMakeLists.txt deleted file mode 100644 index a4aaad9..0000000 --- a/vendor/lief/api/python/OAT/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -set(LIEF_PYTHON_OAT_OBJECTS_SRC - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDexFile.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyClass.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyMethod.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBinary.cpp" -) - -set(LIEF_PYTHON_OAT_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyOAT.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyEnums.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyUtils.cpp" -) - - -set(LIEF_PYTHON_OAT_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyOAT.hpp") - - -list(APPEND LIEF_PYTHON_OAT_SRC ${LIEF_PYTHON_OAT_OBJECTS_SRC}) - -source_group("Source Files\\OAT" FILES ${LIEF_PYTHON_OAT_SRC}) -source_group("Header Files\\OAT" FILES ${LIEF_PYTHON_OAT_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_OAT_SRC}" "${LIEF_PYTHON_OAT_HDR}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/../") - - diff --git a/vendor/lief/api/python/OAT/objects/pyBinary.cpp b/vendor/lief/api/python/OAT/objects/pyBinary.cpp deleted file mode 100644 index 8d41818..0000000 --- a/vendor/lief/api/python/OAT/objects/pyBinary.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/OAT/Binary.hpp" -#include "LIEF/OAT/hash.hpp" -#include "LIEF/ELF/Binary.hpp" -#include "pyIterators.hpp" - -#include "pyOAT.hpp" - -namespace LIEF { -namespace OAT { - -template -using no_const_getter = T (Binary::*)(); - -template -using no_const_func = T (Binary::*)(P); - -template -using getter_t = T (Binary::*)() const; - -template -using setter_t = void (Binary::*)(T); - -template<> -void create(py::module& m) { - - // Binary object - py::class_ bin(m, "Binary", "OAT binary representation"); - - init_ref_iterator(bin, "it_dex_files"); - init_ref_iterator(bin, "it_oat_dex_files"); - init_ref_iterator(bin, "it_classes"); - init_ref_iterator(bin, "it_methods"); - - bin - .def_property_readonly("header", - static_cast>(&Binary::header), - "Return the OAT " RST_CLASS_REF(lief.OAT.Header) "", - py::return_value_policy::reference) - - .def_property_readonly("dex_files", - static_cast>(&Binary::dex_files), - "Return an iterator over " RST_CLASS_REF(lief.DEX.File) "") - - .def_property_readonly("oat_dex_files", - static_cast>(&Binary::oat_dex_files), - "Return an iterator over " RST_CLASS_REF(lief.OAT.DexFile) "") - - .def_property_readonly("classes", - static_cast>(&Binary::classes), - "Return an iterator over " RST_CLASS_REF(lief.OAT.Class) "", - py::return_value_policy::reference) - - .def_property_readonly("methods", - static_cast>(&Binary::methods), - "Return an iterator over " RST_CLASS_REF(lief.OAT.Method) "", - py::return_value_policy::reference) - - .def_property_readonly("has_class", - &Binary::has_class, - "Check if the class if the given name is present in the current OAT binary") - - .def("get_class", - static_cast>(&Binary::get_class), - "Return the " RST_CLASS_REF(lief.OAT.Class) " from its name", - "class_name"_a, - py::return_value_policy::reference) - - .def("get_class", - static_cast>(&Binary::get_class), - "Return the " RST_CLASS_REF(lief.OAT.Class) " from its **index**", - "class_index"_a, - py::return_value_policy::reference) - - .def_property_readonly("dex2dex_json_info", - &Binary::dex2dex_json_info) - - .def("__eq__", &Binary::operator==) - .def("__ne__", &Binary::operator!=) - .def("__hash__", - [] (const Binary& bin) { - return Hash::hash(bin); - }) - - .def("__str__", - [] (const Binary& binary) - { - std::ostringstream stream; - stream << binary; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/OAT/objects/pyClass.cpp b/vendor/lief/api/python/OAT/objects/pyClass.cpp deleted file mode 100644 index e887b37..0000000 --- a/vendor/lief/api/python/OAT/objects/pyClass.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/OAT/Class.hpp" -#include "LIEF/OAT/hash.hpp" - -#include "pyIterators.hpp" -#include "pyOAT.hpp" - -namespace LIEF { -namespace OAT { - -template -using getter_t = T (Class::*)(void) const; - -template -using setter_t = void (Class::*)(T); - -template -using no_const_getter = T (Class::*)(void); - -template<> -void create(py::module& m) { - - py::class_ cls(m, "Class", "OAT Class representation"); - - init_ref_iterator(cls, "it_methods"); - - cls - .def(py::init<>()) - - .def("has_dex_class", - &Class::has_dex_class, - "True if a " RST_CLASS_REF_FULL(lief.DEX.Class) " object " - "is associated with this **OAT** Class") - - .def_property_readonly("status", - &Class::status, - "Class " RST_CLASS_REF(lief.OAT.OAT_CLASS_STATUS) "") - - .def_property_readonly("type", - &Class::type, - "Information (" RST_CLASS_REF(lief.OAT.OAT_CLASS_TYPES) ") about how methods " - "are optimized") - - .def_property_readonly("fullname", - &Class::fullname, - "Class mangled name (e.g. ``Lcom/android/MyActivity;``)") - - .def_property_readonly("index", - &Class::index, - "Index the **DEX** classes pool (" RST_ATTR_REF_FULL(lief.DEX.File.classes) ")") - - .def_property_readonly("methods", - static_cast>(&Class::methods), - "Iterator over " RST_CLASS_REF_FULL(lief.OAT.Method) "") - - .def_property_readonly("bitmap", - &Class::bitmap, - "Bitmap information used to quickly find which methods are " - "optimized") - - .def("is_quickened", - static_cast(&Class::is_quickened), - "Check if the given " RST_CLASS_REF_FULL(lief.DEX.Method) " is compiled into native code", - "dex_method"_a) - - .def("is_quickened", - static_cast(&Class::is_quickened), - "Check if the Method at the given index is compiled into native code", - "method_index"_a) - - .def("method_offsets_index", - static_cast(&Class::method_offsets_index)) - - .def("method_offsets_index", - static_cast(&Class::method_offsets_index)) - - .def("__eq__", &Class::operator==) - .def("__ne__", &Class::operator!=) - .def("__hash__", - [] (const Class& cls) { - return Hash::hash(cls); - }) - - .def("__str__", - [] (const Class& cls) { - std::ostringstream stream; - stream << cls; - return stream.str(); - }); -} - - -} -} diff --git a/vendor/lief/api/python/OAT/objects/pyDexFile.cpp b/vendor/lief/api/python/OAT/objects/pyDexFile.cpp deleted file mode 100644 index 20ac3a6..0000000 --- a/vendor/lief/api/python/OAT/objects/pyDexFile.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/OAT/DexFile.hpp" -#include "LIEF/OAT/hash.hpp" - -#include "pyOAT.hpp" - -namespace LIEF { -namespace OAT { - -template -using getter_t = T (DexFile::*)(void) const; - -template -using setter_t = void (DexFile::*)(T); - -template -using no_const_getter = T (DexFile::*)(void); - -template<> -void create(py::module& m) { - - py::class_(m, "DexFile", "OAT DexFile representation") - .def(py::init<>()) - - .def_property("location", - static_cast>(&DexFile::location), - static_cast>(&DexFile::location), - "Original location of the DEX file") - - .def_property("checksum", - static_cast>(&DexFile::checksum), - static_cast>(&DexFile::checksum), - "Checksum of the underlying DEX file") - - .def_property("dex_offset", - static_cast>(&DexFile::dex_offset), - static_cast>(&DexFile::dex_offset), - "Offset to the raw " RST_CLASS_REF_FULL(lief.DEX.File) "") - - .def_property_readonly("has_dex_file", - &DexFile::has_dex_file, - "Check if the " RST_CLASS_REF_FULL(lief.DEX.File) " is present") - - .def_property_readonly("dex_file", - static_cast>(&DexFile::dex_file), - "Associated " RST_CLASS_REF_FULL(lief.DEX.File) "") - - .def("__eq__", &DexFile::operator==) - .def("__ne__", &DexFile::operator!=) - .def("__hash__", - [] (const DexFile& dex_file) { - return Hash::hash(dex_file); - }) - - .def("__str__", - [] (const DexFile& dexfile) { - std::ostringstream stream; - stream << dexfile; - return stream.str(); - }); -} - -} -} - diff --git a/vendor/lief/api/python/OAT/objects/pyHeader.cpp b/vendor/lief/api/python/OAT/objects/pyHeader.cpp deleted file mode 100644 index 8dd233c..0000000 --- a/vendor/lief/api/python/OAT/objects/pyHeader.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/OAT/Header.hpp" -#include "LIEF/OAT/hash.hpp" - -#include "pyOAT.hpp" - -namespace LIEF { -namespace OAT { - -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - -template -using no_const_getter = T (Header::*)(void); - -template<> -void create
(py::module& m) { - - py::class_ hdr(m, "Header", "OAT Header representation"); - py::class_ it_key_values_t(hdr, "it_key_values_t"); - - py::class_(it_key_values_t, "value_type") - .def_property_readonly("key", - [] (Header::it_key_values_t::reference p) { - return p.first; - }, py::return_value_policy::reference_internal) - - .def_property("value", - [] (Header::it_key_values_t::reference p) { - return p.second; - }, - [] (Header::it_key_values_t::reference p, const std::string& value) { - std::string& ref_value = p.second; - ref_value = value; - }, - py::return_value_policy::reference_internal); - - it_key_values_t - .def("__getitem__", - [] (Header::it_key_values_t& v, size_t i) -> Header::it_key_values_t::value_type { - if (i >= v.size()) - throw py::index_error(); - return v[i]; - }, - py::return_value_policy::reference_internal) - - .def("__len__", - [](Header::it_key_values_t& v) { - return v.size(); - }) - - .def("__iter__", - [](Header::it_key_values_t& v) -> Header::it_key_values_t { - return std::begin(v); - }, py::return_value_policy::reference_internal) - - .def("__next__", - [] (Header::it_key_values_t& v) -> Header::it_key_values_t::value_type { - if (v == std::end(v)) { - throw py::stop_iteration(); - } - return *(v++); - - }, py::return_value_policy::reference_internal); - - hdr - .def(py::init<>()) - - .def_property_readonly("key_values", - static_cast>(&Header::key_values), - "Configuration used for the ``dex2oat`` transformation", - py::return_value_policy::reference_internal) - - .def_property_readonly("keys", - &Header::keys, - "List of " RST_CLASS_REF(lief.OAT.HEADER_KEYS) " present", - py::return_value_policy::reference_internal) - - .def_property_readonly("values", - &Header::values, - "List of values associated with " RST_ATTR_REF(lief.OAT.Header.keys) "", - py::return_value_policy::move) - - .def_property_readonly("magic", - static_cast>(&Header::magic), - "Magic number: ``oat\\x0A``") - - .def_property_readonly("version", - static_cast>(&Header::version), - "Underlying version of the OAT file") - - .def_property_readonly("checksum", - static_cast>(&Header::checksum), - "Checksum of the OAT file") - - .def_property_readonly("instruction_set", - static_cast>(&Header::instruction_set), - "List of " RST_CLASS_REF(lief.OAT.INSTRUCTION_SETS) "") - - .def_property_readonly("nb_dex_files", - static_cast>(&Header::nb_dex_files), - "Number of " RST_CLASS_REF_FULL(lief.DEX.File) " registred in the current OAT") - - .def_property_readonly("oat_dex_files_offset", - static_cast>(&Header::oat_dex_files_offset), - "Offset to the raw " RST_CLASS_REF_FULL(lief.OAT.DexFile) "\n\n" - ".. warning::\n\n" - "\tThis attribute is only relevant for OAT for which the version is above 131") - - .def_property_readonly("executable_offset", - static_cast>(&Header::executable_offset)) - - .def_property_readonly("i2i_bridge_offset", - static_cast>(&Header::i2i_bridge_offset)) - - .def_property_readonly("i2c_code_bridge_offset", - static_cast>(&Header::i2c_code_bridge_offset)) - - .def_property_readonly("jni_dlsym_lookup_offset", - static_cast>(&Header::jni_dlsym_lookup_offset)) - - .def_property_readonly("quick_generic_jni_trampoline_offset", - static_cast>(&Header::quick_generic_jni_trampoline_offset)) - - .def_property_readonly("quick_imt_conflict_trampoline_offset", - static_cast>(&Header::quick_imt_conflict_trampoline_offset)) - - .def_property_readonly("quick_resolution_trampoline_offset", - static_cast>(&Header::quick_resolution_trampoline_offset)) - - .def_property_readonly("quick_to_interpreter_bridge_offset", - static_cast>(&Header::quick_to_interpreter_bridge_offset)) - - .def_property_readonly("image_patch_delta", - static_cast>(&Header::image_patch_delta)) - - .def_property_readonly("image_file_location_oat_checksum", - static_cast>(&Header::image_file_location_oat_checksum)) - - .def_property_readonly("image_file_location_oat_data_begin", - static_cast>(&Header::image_file_location_oat_data_begin)) - - .def_property_readonly("key_value_size", - static_cast>(&Header::key_value_size)) - - .def("get", - static_cast(&Header::get), - "key"_a, - py::return_value_policy::reference) - - - .def("set", - static_cast(&Header::set), - "key"_a, "value"_a, - py::return_value_policy::reference) - - .def("__getitem__", - static_cast(&Header::operator[]), - "", - py::return_value_policy::reference) - - .def("__setitem__", - static_cast(&Header::set), - "", - py::return_value_policy::reference) - - - .def("__eq__", &Header::operator==) - .def("__ne__", &Header::operator!=) - .def("__hash__", - [] (const Header& header) { - return Hash::hash(header); - }) - - - - .def("__str__", - [] (const Header& header) { - std::ostringstream stream; - stream << header; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/OAT/objects/pyMethod.cpp b/vendor/lief/api/python/OAT/objects/pyMethod.cpp deleted file mode 100644 index 0f74c82..0000000 --- a/vendor/lief/api/python/OAT/objects/pyMethod.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/OAT/Method.hpp" -#include "LIEF/OAT/hash.hpp" - -#include "pyOAT.hpp" - -namespace LIEF { -namespace OAT { - -template -using getter_t = T (Method::*)(void) const; - -template -using setter_t = void (Method::*)(T); - -template -using no_const_getter = T (Method::*)(void); - -template<> -void create(py::module& m) { - - py::class_(m, "Method", "OAT Method representation") - .def(py::init<>()) - - .def_property_readonly("name", - &Method::name, - "Method's name") - - .def_property_readonly("oat_class", - static_cast>(&Method::oat_class), - "" RST_CLASS_REF(lief.OAT.Class) " associated with the method (or None)", - py::return_value_policy::reference) - - .def_property_readonly("dex_method", - static_cast>(&Method::dex_method), - "Mirrored " RST_CLASS_REF(lief.DEX.Method) " associated with the OAT method (or None)", - py::return_value_policy::reference) - - .def_property_readonly("has_dex_method", - &Method::has_dex_method, - "Check if a " RST_CLASS_REF(lief.DEX.Method) " is associated with the OAT method", - py::return_value_policy::reference) - - .def_property_readonly("is_dex2dex_optimized", - &Method::is_dex2dex_optimized, - "True if the optimization is **DEX**") - - .def_property_readonly("is_compiled", - &Method::is_compiled, - "True if the optimization is **native**") - - .def_property("quick_code", - static_cast>(&Method::quick_code), - static_cast>(&Method::quick_code), - "Quick code associated with the method") - - .def("__eq__", &Method::operator==) - .def("__ne__", &Method::operator!=) - .def("__hash__", - [] (const Method& method) { - return Hash::hash(method); - }) - - .def("__str__", - [] (const Method& method) { - std::ostringstream stream; - stream << method; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/OAT/objects/pyParser.cpp b/vendor/lief/api/python/OAT/objects/pyParser.cpp deleted file mode 100644 index af26ef0..0000000 --- a/vendor/lief/api/python/OAT/objects/pyParser.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyOAT.hpp" - -#include "LIEF/OAT/Parser.hpp" - -#include - -namespace LIEF { -namespace OAT { - -template<> -void create(py::module& m) { - - // Parser (Parser) - m.def("parse", - static_cast (*) (const std::string&)>(&Parser::parse), - "Parse the given OAT file and return a " RST_CLASS_REF(lief.OAT.Binary) " object", - "oat_file"_a, - py::return_value_policy::take_ownership); - - m.def("parse", - static_cast (*) (const std::string&, const std::string&)>(&Parser::parse), - "Parse the given OAT with its VDEX file and return a " RST_CLASS_REF(lief.OAT.Binary) " object", - "oat_file"_a, "vdex_file"_a, - py::return_value_policy::take_ownership); - - m.def("parse", - static_cast (*) (std::vector, const std::string&)>(&Parser::parse), - "Parse the given raw data and return a " RST_CLASS_REF(lief.OAT.Binary) " object", - "raw"_a, "name"_a = "", - py::return_value_policy::take_ownership); - - - m.def("parse", - [] (py::object byteio, const std::string& name) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str))}; - - return LIEF::OAT::Parser::parse(std::move(raw), name); - }, - "io"_a, "name"_a = "", - py::return_value_policy::take_ownership); -} -} -} diff --git a/vendor/lief/api/python/OAT/pyEnums.cpp b/vendor/lief/api/python/OAT/pyEnums.cpp deleted file mode 100644 index fa01588..0000000 --- a/vendor/lief/api/python/OAT/pyEnums.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyOAT.hpp" -#include "LIEF/OAT/enums.hpp" -#include "LIEF/OAT/EnumToString.hpp" - -#define PY_ENUM(x) to_string(x), x - -namespace LIEF { -namespace OAT { - -void init_enums(py::module& m) { - - py::enum_(m, "OAT_CLASS_TYPES") - .value(PY_ENUM(OAT_CLASS_TYPES::OAT_CLASS_ALL_COMPILED)) - .value(PY_ENUM(OAT_CLASS_TYPES::OAT_CLASS_SOME_COMPILED)) - .value(PY_ENUM(OAT_CLASS_TYPES::OAT_CLASS_NONE_COMPILED)); - - py::enum_(m, "OAT_CLASS_STATUS") - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_RETIRED)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_ERROR)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_NOTREADY)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_IDX)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_LOADED)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_RESOLVING)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_RESOLVED)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_VERIFYING)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_RETRY_VERIFICATION_AT_RUNTIME)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_VERIFYING_AT_RUNTIME)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_VERIFIED)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_INITIALIZING)) - .value(PY_ENUM(OAT_CLASS_STATUS::STATUS_INITIALIZED)); - - py::enum_(m, "HEADER_KEYS") - .value(PY_ENUM(HEADER_KEYS::KEY_IMAGE_LOCATION)) - .value(PY_ENUM(HEADER_KEYS::KEY_DEX2OAT_CMD_LINE)) - .value(PY_ENUM(HEADER_KEYS::KEY_DEX2OAT_HOST)) - .value(PY_ENUM(HEADER_KEYS::KEY_PIC)) - .value(PY_ENUM(HEADER_KEYS::KEY_HAS_PATCH_INFO)) - .value(PY_ENUM(HEADER_KEYS::KEY_DEBUGGABLE)) - .value(PY_ENUM(HEADER_KEYS::KEY_NATIVE_DEBUGGABLE)) - .value(PY_ENUM(HEADER_KEYS::KEY_COMPILER_FILTER)) - .value(PY_ENUM(HEADER_KEYS::KEY_CLASS_PATH)) - .value(PY_ENUM(HEADER_KEYS::KEY_BOOT_CLASS_PATH)) - .value(PY_ENUM(HEADER_KEYS::KEY_CONCURRENT_COPYING)); - - - py::enum_(m, "INSTRUCTION_SETS") - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_NONE)) - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_ARM)) - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_ARM_64)) - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_THUMB2)) - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_X86)) - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_X86_64)) - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_MIPS)) - .value(PY_ENUM(INSTRUCTION_SETS::INST_SET_MIPS_64)); - -} - -} -} diff --git a/vendor/lief/api/python/OAT/pyOAT.cpp b/vendor/lief/api/python/OAT/pyOAT.cpp deleted file mode 100644 index 0e0c9bf..0000000 --- a/vendor/lief/api/python/OAT/pyOAT.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyOAT.hpp" - -namespace LIEF { -namespace OAT { - -void init_python_module(py::module& m) { - py::module LIEF_OAT_module = m.def_submodule("OAT", "Python API for OAT format"); - - init_enums(LIEF_OAT_module); - init_utils(LIEF_OAT_module); - - init_objects(LIEF_OAT_module); -} - - -void init_objects(py::module& m) { - CREATE(Parser, m); - CREATE(Binary, m); - CREATE(Header, m); - CREATE(DexFile, m); - CREATE(Class, m); - CREATE(Method, m); -} -} -} diff --git a/vendor/lief/api/python/OAT/pyOAT.hpp b/vendor/lief/api/python/OAT/pyOAT.hpp deleted file mode 100644 index 65c3ead..0000000 --- a/vendor/lief/api/python/OAT/pyOAT.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_OAT_H_ -#define PY_LIEF_OAT_H_ - -#include "LIEF/OAT.hpp" -#include "pyLIEF.hpp" - -#include -#include - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - - -PYBIND11_MAKE_OPAQUE(LIEF::OAT::Header::it_key_values_t::value_type); // std::pair> - -namespace LIEF { -namespace OAT { - -template -void create(py::module&); - -void init_python_module(py::module& m); - -void init_objects(py::module&); - -void init_enums(py::module&); -void init_utils(py::module&); - -SPECIALIZE_CREATE(Parser); -SPECIALIZE_CREATE(Binary); -SPECIALIZE_CREATE(Header); -SPECIALIZE_CREATE(DexFile); -SPECIALIZE_CREATE(Class); -SPECIALIZE_CREATE(Method); -} -} - - -#endif diff --git a/vendor/lief/api/python/OAT/pyUtils.cpp b/vendor/lief/api/python/OAT/pyUtils.cpp deleted file mode 100644 index 734a340..0000000 --- a/vendor/lief/api/python/OAT/pyUtils.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyOAT.hpp" - -#include "LIEF/OAT/utils.hpp" - -namespace LIEF { -namespace OAT { - -void init_utils(py::module& m) { - - m.def("is_oat", - static_cast(&is_oat), - "Check if the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter is a OAT one", - "binary"_a); - - m.def("is_oat", - static_cast(&is_oat), - "Check if the **file** given in parameter is a OAT one", - "path"_a); - - m.def("is_oat", - static_cast&)>(&is_oat), - "Check if the **raw data** given in parameter is a OAT one", - "raw"_a); - - - m.def("version", - static_cast(&version), - "Return the OAT version of the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter", - "binary"_a); - - m.def("version", - static_cast(&version), - "Return the OAT version of the **file** given in parameter", - "file"_a); - - m.def("version", - static_cast&)>(&version), - "Return the OAT version of the **raw data** given in parameter", - "raw"_a); - - - m.def("android_version", - &android_version, - "Return the " RST_CLASS_REF(lief.Android.ANDROID_VERSIONS) " associated with the given OAT version"); -} - -} -} - diff --git a/vendor/lief/api/python/PE/CMakeLists.txt b/vendor/lief/api/python/PE/CMakeLists.txt deleted file mode 100644 index 15d8ee1..0000000 --- a/vendor/lief/api/python/PE/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -set(LIEF_PYTHON_PE_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyUtils.cpp" - - "${CMAKE_CURRENT_LIST_DIR}/objects/pyResourceNode.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyResourceData.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyResourceDirectory.cpp" - - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceIcon.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceVersion.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceVarFileInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceFixedFileInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceStringFileInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyLangCodeItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceDialog.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceDialogItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceStringTable.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/resources/pyResourceAccelerator.cpp" - - "${CMAKE_CURRENT_LIST_DIR}/objects/pyCodeIntegrity.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDataDirectory.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDosHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRichHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRichEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBuilder.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyOptionalHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocationEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyBinary.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyResourcesManager.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDebug.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyCodeView.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyCodeViewPDB.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyPogo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyPogoEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySection.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyExport.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyImport.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyExportEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyRelocation.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyImportEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDelayImport.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyDelayImportEntry.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pySymbol.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyTLS.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyEnums.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyPE.cpp" -) - -set(LIEF_PYTHON_PE_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyPE.hpp") - -source_group("Source Files\\PE" FILES ${LIEF_PYTHON_PE_SRC}) -source_group("Header Files\\PE" FILES ${LIEF_PYTHON_PE_HDR}) - -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}") -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_PE_SRC}" "${LIEF_PYTHON_PE_HDR}") - - -include("${CMAKE_CURRENT_LIST_DIR}/objects/LoadConfigurations/CMakeLists.txt") -include("${CMAKE_CURRENT_LIST_DIR}/objects/signature/CMakeLists.txt") - - diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/CMakeLists.txt b/vendor/lief/api/python/PE/objects/LoadConfigurations/CMakeLists.txt deleted file mode 100644 index e9870c0..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -set(LIEF_PYTHON_PE_LOAD_CONFIGURE_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfiguration.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV0.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV1.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV2.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV3.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV4.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV5.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV6.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyLoadConfigurationV7.cpp" -) - -source_group("Source Files\\PE\\Load Configuration" FILES ${LIEF_PYTHON_PE_LOAD_CONFIGURE_SRC}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_PE_LOAD_CONFIGURE_SRC}") - - - diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfiguration.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfiguration.cpp deleted file mode 100644 index f5d2114..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfiguration.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfiguration::*)(void) const; - -template -using setter_t = void (LoadConfiguration::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfiguration", - R"delim( - Class that represents the default PE's ``LoadConfiguration`` - It's the base class for any future versions of the structure - )delim") - .def(py::init<>()) - - .def_property_readonly("version", - &LoadConfiguration::version, - "(SDK) Version of the structure. (" RST_CLASS_REF(lief.PE.WIN_VERSION) ")") - - .def_property("characteristics", - static_cast>(&LoadConfiguration::characteristics), - static_cast>(&LoadConfiguration::characteristics), - "Characteristics of the structure.") - - .def_property_readonly("size", - static_cast>(&LoadConfiguration::size), - "Size of the structure which is an alias for " RST_ATTR_REF(lief.PE.LoadConfiguration.characteristics) "") - - .def_property("timedatestamp", - static_cast>(&LoadConfiguration::timedatestamp), - static_cast>(&LoadConfiguration::timedatestamp), - "Date and time stamp value") - - .def_property("major_version", - static_cast>(&LoadConfiguration::major_version), - static_cast>(&LoadConfiguration::major_version), - "Major Version") - - .def_property("minor_version", - static_cast>(&LoadConfiguration::minor_version), - static_cast>(&LoadConfiguration::minor_version), - "Minor version") - - .def_property("global_flags_clear", - static_cast>(&LoadConfiguration::global_flags_clear), - static_cast>(&LoadConfiguration::global_flags_clear), - "The global loader flags to clear for this process as the loader start the process.") - - .def_property("global_flags_set", - static_cast>(&LoadConfiguration::global_flags_set), - static_cast>(&LoadConfiguration::global_flags_set), - "The global loader flags to set for this process as the loader starts the process.") - - .def_property("critical_section_default_timeout", - static_cast>(&LoadConfiguration::critical_section_default_timeout), - static_cast>(&LoadConfiguration::critical_section_default_timeout), - "The default timeout value to use for is process’s critical sections that are abandoned.") - - .def_property("decommit_free_block_threshold", - static_cast>(&LoadConfiguration::decommit_free_block_threshold), - static_cast>(&LoadConfiguration::decommit_free_block_threshold), - "Memory that must be freed before it is returned to the system, in bytes.") - - .def_property("decommit_total_free_threshold", - static_cast>(&LoadConfiguration::decommit_total_free_threshold), - static_cast>(&LoadConfiguration::decommit_total_free_threshold), - "Total amount of free memory, in bytes") - - .def_property("lock_prefix_table", - static_cast>(&LoadConfiguration::lock_prefix_table), - static_cast>(&LoadConfiguration::lock_prefix_table), - "The **VA** of a list of addresses where the ``LOCK`` prefix " - "is used so that they can be replaced with ``NOP`` on single processor machines.") - - .def_property("maximum_allocation_size", - static_cast>(&LoadConfiguration::maximum_allocation_size), - static_cast>(&LoadConfiguration::maximum_allocation_size), - "Maximum allocation size, in bytes.") - - .def_property("virtual_memory_threshold", - static_cast>(&LoadConfiguration::virtual_memory_threshold), - static_cast>(&LoadConfiguration::virtual_memory_threshold), - "Maximum virtual memory size, in bytes.") - - .def_property("process_affinity_mask", - static_cast>(&LoadConfiguration::process_affinity_mask), - static_cast>(&LoadConfiguration::process_affinity_mask), - "Setting this field to a non-zero value is equivalent to calling " - "``SetProcessAffinityMask`` with this value during process startup (.exe only)") - - .def_property("process_heap_flags", - static_cast>(&LoadConfiguration::process_heap_flags), - static_cast>(&LoadConfiguration::process_heap_flags), - R"delim( - Process heap flags that correspond to the first argument of the ``HeapCreate`` - function. These flags apply to the process heap that is created during process startup. - )delim") - - .def_property("csd_version", - static_cast>(&LoadConfiguration::csd_version), - static_cast>(&LoadConfiguration::csd_version), - "The service pack version identifier.") - - .def_property("reserved1", - static_cast>(&LoadConfiguration::reserved1), - static_cast>(&LoadConfiguration::reserved1), - "Must be zero.") - - .def_property("dependent_load_flags", - static_cast>(&LoadConfiguration::dependent_load_flags), - static_cast>(&LoadConfiguration::dependent_load_flags), - "On recent the version of the structure, Microsoft renamed reserved1 to DependentLoadFlags. " - "This is an alias for " RST_ATTR_REF(lief.PE.LoadConfiguration.reserved1) "") - - .def_property("editlist", - static_cast>(&LoadConfiguration::editlist), - static_cast>(&LoadConfiguration::editlist), - "Reserved for use by the system.") - - .def_property("security_cookie", - static_cast>(&LoadConfiguration::security_cookie), - static_cast>(&LoadConfiguration::security_cookie), - "A pointer to a cookie that is used by Visual C++ or GS implementation.") - - .def("__eq__", &LoadConfiguration::operator==) - .def("__ne__", &LoadConfiguration::operator!=) - .def("__hash__", - [] (const LoadConfiguration& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfiguration& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV0.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV0.cpp deleted file mode 100644 index 977f533..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV0.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV0::*)(void) const; - -template -using setter_t = void (LoadConfigurationV0::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV0", - R"delim( - :class:`~lief.PE.LoadConfiguration` enhanced with SEH. - It is associated with the :class:`~lief.PE.WIN_VERSION`: :attr:`~lief.PE.WIN_VERSION.SEH` - )delim") - - .def(py::init<>()) - - .def_property("se_handler_table", - static_cast>(&LoadConfigurationV0::se_handler_table), - static_cast>(&LoadConfigurationV0::se_handler_table), - "The VA of the sorted table of RVAs of each valid, unique " - "SE handler in the image.") - - .def_property("se_handler_count", - static_cast>(&LoadConfigurationV0::se_handler_count), - static_cast>(&LoadConfigurationV0::se_handler_count), - "The count of unique handlers in the table.") - - - .def("__eq__", &LoadConfigurationV0::operator==) - .def("__ne__", &LoadConfigurationV0::operator!=) - .def("__hash__", - [] (const LoadConfigurationV0& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfigurationV0& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV1.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV1.cpp deleted file mode 100644 index d2da0a4..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV1.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV1::*)(void) const; - -template -using setter_t = void (LoadConfigurationV1::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV1", - R"delim( - :class:`~lief.PE.LoadConfigurationV0` enhanced with *Control Flow Guard*. - It is associated with the :class:`~lief.PE.WIN_VERSION` set to :attr:`~lief.PE.WIN_VERSION.WIN_8_1` - )delim") - .def(py::init<>()) - - .def_property("guard_cf_check_function_pointer", - static_cast>(&LoadConfigurationV1::guard_cf_check_function_pointer), - static_cast>(&LoadConfigurationV1::guard_cf_check_function_pointer), - "The VA where Control Flow Guard check-function pointer is stored.") - - .def_property("guard_cf_dispatch_function_pointer", - static_cast>(&LoadConfigurationV1::guard_cf_dispatch_function_pointer), - static_cast>(&LoadConfigurationV1::guard_cf_dispatch_function_pointer), - "The VA where Control Flow Guard dispatch-function pointer is stored.") - - .def_property("guard_cf_function_table", - static_cast>(&LoadConfigurationV1::guard_cf_function_table), - static_cast>(&LoadConfigurationV1::guard_cf_function_table), - "The VA of the sorted table of RVAs of each Control Flow Guard function in the image.") - - .def_property("guard_cf_function_count", - static_cast>(&LoadConfigurationV1::guard_cf_function_count), - static_cast>(&LoadConfigurationV1::guard_cf_function_count), - "The count of unique RVAs in the :attr:`~lief.PE.LoadConfigurationV1.guard_cf_function_table`") - - .def_property("guard_flags", - static_cast>(&LoadConfigurationV1::guard_flags), - static_cast>(&LoadConfigurationV1::guard_flags), - "Control Flow Guard related flags.") - - .def("has", - static_cast(&LoadConfigurationV1::has), - "Check if the given " RST_CLASS_REF(lief.PE.GUARD_CF_FLAGS) " is present in " - ":attr:`~lief.PE.LoadConfigurationV1.guard_flags`", - "flag"_a) - - .def_property_readonly("guard_cf_flags_list", - &LoadConfigurationV1::guard_cf_flags_list, - "Return list of " RST_CLASS_REF(lief.PE.GUARD_CF_FLAGS) " present in " - ":attr:`~lief.PE.LoadConfigurationV1.guard_flags`", - py::return_value_policy::reference_internal) - - .def("__eq__", &LoadConfigurationV1::operator==) - .def("__ne__", &LoadConfigurationV1::operator!=) - .def("__hash__", - [] (const LoadConfigurationV1& config) { - return Hash::hash(config); - }) - - - .def("__contains__", - static_cast(&LoadConfigurationV1::has)) - - - .def("__str__", [] (const LoadConfigurationV1& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV2.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV2.cpp deleted file mode 100644 index d5dc472..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV2.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV2::*)(void) const; - -template -using setter_t = void (LoadConfigurationV2::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV2", - R"delim( - :class:`~lief.PE.LoadConfigurationV1` enhanced with *code integrity*. - It is associated with the :class:`~lief.PE.WIN_VERSION` set to :attr:`~lief.PE.WIN_VERSION.WIN10_0_9879` - )delim") - - .def(py::init<>()) - - .def_property_readonly("code_integrity", - static_cast(&LoadConfigurationV2::code_integrity), - "" RST_CLASS_REF(lief.PE.CodeIntegrity) " object", - py::return_value_policy::reference) - - - .def("__eq__", &LoadConfigurationV2::operator==) - .def("__ne__", &LoadConfigurationV2::operator!=) - .def("__hash__", - [] (const LoadConfigurationV2& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfigurationV2& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV3.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV3.cpp deleted file mode 100644 index dd96f8c..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV3.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV3::*)(void) const; - -template -using setter_t = void (LoadConfigurationV3::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV3", - R"delim( - :class:`~lief.PE.LoadConfigurationV2` with Control Flow Guard improved. - - It is associated with the :class:`~lief.PE.WIN_VERSION` set to :attr:`~lief.PE.WIN_VERSION.WIN10_0_14286` - )delim") - - .def(py::init<>()) - - .def_property("guard_address_taken_iat_entry_table", - static_cast>(&LoadConfigurationV3::guard_address_taken_iat_entry_table), - static_cast>(&LoadConfigurationV3::guard_address_taken_iat_entry_table), - "VA of a table associated with CFG's *IAT* checks") - - .def_property("guard_address_taken_iat_entry_count", - static_cast>(&LoadConfigurationV3::guard_address_taken_iat_entry_count), - static_cast>(&LoadConfigurationV3::guard_address_taken_iat_entry_count), - "Number of entries in the :attr:`~lief.PE.guard_address_taken_iat_entry_table`") - - .def_property("guard_long_jump_target_table", - static_cast>(&LoadConfigurationV3::guard_long_jump_target_table), - static_cast>(&LoadConfigurationV3::guard_long_jump_target_table), - "VA of a table associated with CFG's *long jump*") - - .def_property("guard_long_jump_target_count", - static_cast>(&LoadConfigurationV3::guard_long_jump_target_count), - static_cast>(&LoadConfigurationV3::guard_long_jump_target_count), - "Number of entries in the :attr:`~lief.PE.guard_address_taken_iat_entry_table`") - - .def("__eq__", &LoadConfigurationV3::operator==) - .def("__ne__", &LoadConfigurationV3::operator!=) - .def("__hash__", - [] (const LoadConfigurationV3& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfigurationV3& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV4.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV4.cpp deleted file mode 100644 index 0eb8bc0..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV4.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV4::*)(void) const; - -template -using setter_t = void (LoadConfigurationV4::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV4", - R"delim( - :class:`~lief.PE.LoadConfigurationV3` enhanced with: - - * Kind of dynamic relocations - * *Hybrid Metadata Pointer* - - It is associated with the :class:`~lief.PE.WIN_VERSION` set to :attr:`~lief.PE.WIN_VERSION.WIN10_0_14383` - )delim") - .def(py::init<>()) - - .def_property("dynamic_value_reloc_table", - static_cast>(&LoadConfigurationV4::dynamic_value_reloc_table), - static_cast>(&LoadConfigurationV4::dynamic_value_reloc_table), - "VA of pointing to a ``IMAGE_DYNAMIC_RELOCATION_TABLE``") - - .def_property("hybrid_metadata_pointer", - static_cast>(&LoadConfigurationV4::hybrid_metadata_pointer), - static_cast>(&LoadConfigurationV4::hybrid_metadata_pointer), - "") - - - .def("__eq__", &LoadConfigurationV4::operator==) - .def("__ne__", &LoadConfigurationV4::operator!=) - .def("__hash__", - [] (const LoadConfigurationV4& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfigurationV4& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV5.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV5.cpp deleted file mode 100644 index 7a7ac3b..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV5.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV5::*)(void) const; - -template -using setter_t = void (LoadConfigurationV5::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV5", - R"delim( - :class:`~lief.PE.LoadConfigurationV4` enhanced nhanced with Return Flow Guard. - - It is associated with the :class:`~lief.PE.WIN_VERSION` set to :attr:`~lief.PE.WIN_VERSION.WIN10_0_14901` - )delim") - - .def(py::init<>()) - - .def_property("guard_rf_failure_routine", - static_cast>(&LoadConfigurationV5::guard_rf_failure_routine), - static_cast>(&LoadConfigurationV5::guard_rf_failure_routine), - "VA of the failure routine") - - .def_property("guard_rf_failure_routine_function_pointer", - static_cast>(&LoadConfigurationV5::guard_rf_failure_routine_function_pointer), - static_cast>(&LoadConfigurationV5::guard_rf_failure_routine_function_pointer), - "VA of the failure routine ``fptr``") - - .def_property("dynamic_value_reloctable_offset", - static_cast>(&LoadConfigurationV5::dynamic_value_reloctable_offset), - static_cast>(&LoadConfigurationV5::dynamic_value_reloctable_offset), - "Offset of dynamic relocation table relative to the relocation table") - - .def_property("dynamic_value_reloctable_section", - static_cast>(&LoadConfigurationV5::dynamic_value_reloctable_section), - static_cast>(&LoadConfigurationV5::dynamic_value_reloctable_section), - "The section index of the dynamic value relocation table") - - .def_property("reserved2", - static_cast>(&LoadConfigurationV5::reserved2), - static_cast>(&LoadConfigurationV5::reserved2), - "Must be zero") - - - .def("__eq__", &LoadConfigurationV5::operator==) - .def("__ne__", &LoadConfigurationV5::operator!=) - .def("__hash__", - [] (const LoadConfigurationV5& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfigurationV5& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV6.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV6.cpp deleted file mode 100644 index 33fc9c9..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV6.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV6::*)(void) const; - -template -using setter_t = void (LoadConfigurationV6::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV6", - R"delim( - :class:`~lief.PE.LoadConfigurationV5` enhanced with Hotpatch and improved RFG. - - It is associated with the :class:`~lief.PE.WIN_VERSION` set to :attr:`~lief.PE.WIN_VERSION.WIN10_0_15002` - )delim") - - .def(py::init<>()) - - .def_property("guard_rf_verify_stackpointer_function_pointer", - static_cast>(&LoadConfigurationV6::guard_rf_verify_stackpointer_function_pointer), - static_cast>(&LoadConfigurationV6::guard_rf_verify_stackpointer_function_pointer), - "VA of the Function verifying the stack pointer") - - .def_property("hotpatch_table_offset", - static_cast>(&LoadConfigurationV6::hotpatch_table_offset), - static_cast>(&LoadConfigurationV6::hotpatch_table_offset), - "Offset to the *hotpatch* table") - - - .def("__eq__", &LoadConfigurationV6::operator==) - .def("__ne__", &LoadConfigurationV6::operator!=) - .def("__hash__", - [] (const LoadConfigurationV6& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfigurationV6& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV7.cpp b/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV7.cpp deleted file mode 100644 index caa9a28..0000000 --- a/vendor/lief/api/python/PE/objects/LoadConfigurations/pyLoadConfigurationV7.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/LoadConfigurations.hpp" - -#include -#include - - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LoadConfigurationV7::*)(void) const; - -template -using setter_t = void (LoadConfigurationV7::*)(T); - -template<> -void create(py::module& m) { - py::class_(m, "LoadConfigurationV7") - .def(py::init<>()) - - .def_property("reserved3", - static_cast>(&LoadConfigurationV7::reserved3), - static_cast>(&LoadConfigurationV7::reserved3), - "") - - .def_property("addressof_unicode_string", - static_cast>(&LoadConfigurationV7::addressof_unicode_string), - static_cast>(&LoadConfigurationV7::addressof_unicode_string), - "") - - - .def("__eq__", &LoadConfigurationV7::operator==) - .def("__ne__", &LoadConfigurationV7::operator!=) - .def("__hash__", - [] (const LoadConfigurationV7& config) { - return Hash::hash(config); - }) - - - .def("__str__", [] (const LoadConfigurationV7& config) - { - std::ostringstream stream; - stream << config; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyBinary.cpp b/vendor/lief/api/python/PE/objects/pyBinary.cpp deleted file mode 100644 index 1108b1d..0000000 --- a/vendor/lief/api/python/PE/objects/pyBinary.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/PE/Parser.hpp" -#include "LIEF/PE/Builder.hpp" -#include "LIEF/PE/Binary.hpp" -#include "LIEF/Abstract/Binary.hpp" - -#include "pyPE.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace PE { - -template -using no_const_func = T (Binary::*)(P); - -template -using no_const_getter = T (Binary::*)(void); - -template -using getter_t = T (Binary::*)(void) const; - -template -using setter_t = void (Binary::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ bin(m, "Binary", - R"delim( - Class which represents a PE binary which is the main interface - to manage and modify a PE executable. - - This object can be instantiated through :func:`lief.parse` or :func:`lief.PE.parse` while - the constructor of this object can be used to craft a binary from scratch (see: :ref:`02-pe-from-scratch`) - )delim"); - - init_ref_iterator(bin, "it_section"); - init_ref_iterator(bin, "it_data_directories"); - init_ref_iterator(bin, "it_relocations"); - init_ref_iterator(bin, "it_imports"); - init_ref_iterator(bin, "it_delay_imports"); - init_ref_iterator(bin, "it_symbols"); - init_ref_iterator(bin, "it_const_signatures"); - - bin - .def(py::init(), - "name"_a, "type"_a) - - .def_property_readonly("sections", - static_cast>(&Binary::sections), - "Return binary's an iterator over the PE's " RST_CLASS_REF(lief.PE.Section) "", - py::return_value_policy::reference) - - .def_property_readonly("dos_header", - static_cast(&Binary::dos_header), - "Return the " RST_CLASS_REF(lief.PE.DosHeader) "", - py::return_value_policy::reference) - - .def_property_readonly("header", - static_cast(&Binary::header), - "Return the " RST_CLASS_REF(lief.PE.Header) "", - py::return_value_policy::reference) - - .def_property_readonly("optional_header", - static_cast(&Binary::optional_header), - "Return the " RST_CLASS_REF(lief.PE.OptionalHeader) "", - py::return_value_policy::reference) - - .def_property_readonly("virtual_size", - &Binary::virtual_size, - R"delim( - Return the binary's virtual size. - - This value should match :attr:`~lief.PE.OptionalHeader.sizeof_image` - )delim") - - .def_property_readonly("sizeof_headers", - &Binary::sizeof_headers, - "Size of all the PE headers") - - .def("rva_to_offset", - &Binary::rva_to_offset, - "rva_address"_a, - R"delim( - Convert a relative virtual address to an offset - - The conversion is performed by looking for the section that encompasses the provided RVA. - )delim") - - .def("va_to_offset", - &Binary::va_to_offset, - "va_address"_a, - R"delim( - Convert an **absolute** virtual address into an offset - - See: :meth:`~lief.PE.Binary.rva_to_offset` - )delim") - - .def("section_from_offset", - static_cast(&Binary::section_from_offset), - R"delim( - Return the :class:`~lief.PE.Section` which encompasses the provided offset. - It returns None if a section can't be found. - )delim", - "offset"_a, - py::return_value_policy::reference) - - .def("section_from_rva", - static_cast(&Binary::section_from_rva), - R"delim( - Return the :class:`~lief.PE.Section` which encompasses the provided **relative** virtual address. - If a section can't be found, it returns None. - )delim", - "rva"_a, - py::return_value_policy::reference) - - .def_property("tls", - static_cast(&Binary::tls), - static_cast(&Binary::tls), - "" RST_CLASS_REF(lief.PE.TLS) " object (if present)", - py::return_value_policy::reference) - - .def_property("rich_header", - static_cast(&Binary::rich_header), - static_cast(&Binary::rich_header), - "" RST_CLASS_REF(lief.PE.RichHeader) " object (if present)", - py::return_value_policy::reference) - - .def_property_readonly("has_rich_header", &Binary::has_rich_header, - "``True`` if the current binary has a " RST_CLASS_REF(lief.PE.RichHeader) " object") - - .def_property_readonly("has_debug", &Binary::has_debug, - "``True`` if the current binary has a " RST_CLASS_REF(lief.PE.Debug) " object") - - .def_property_readonly("has_tls", &Binary::has_tls, - "``True`` if the current binary has a " RST_CLASS_REF(lief.PE.TLS) " object") - - .def_property_readonly("has_imports", &Binary::has_imports, - "``True`` if the current binary has imports (" RST_CLASS_REF(lief.PE.Import) ")") - - .def_property_readonly("has_exports", &Binary::has_exports, - "``True`` if the current binary has a " RST_CLASS_REF(lief.PE.Export) " object") - - .def_property_readonly("has_resources", &Binary::has_resources, - "``True`` if the current binary has a " RST_CLASS_REF(lief.PE.Resources) " object") - - .def_property_readonly("has_exceptions", &Binary::has_exceptions, - "``True`` if the current binary uses ``Exceptions``") - - .def_property_readonly("has_relocations", &Binary::has_relocations, - "``True`` if the current binary uses " RST_CLASS_REF(lief.PE.Relocation) "") - - .def_property_readonly("has_configuration", &Binary::has_configuration, - "``True`` if the current binary has " RST_CLASS_REF(lief.PE.LoadConfiguration) "") - - .def_property_readonly("has_signatures", &Binary::has_signatures, - "``True`` if the binary is signed with the PE authenticode (" RST_CLASS_REF(lief.PE.Signature) ")") - - .def_property_readonly("is_reproducible_build", &Binary::is_reproducible_build, - "``True`` if the binary was compiled with a reproducible build directive (" RST_CLASS_REF(lief.PE.Debug) ")") - - .def_property_readonly("functions", - &Binary::functions, - "**All** " RST_CLASS_REF(lief.Function) " found in the binary") - - .def_property_readonly("exception_functions", - &Binary::exception_functions, - "" RST_CLASS_REF(lief.Function) " found in the Exception directory") - - .def("predict_function_rva", - static_cast(&Binary::predict_function_rva), - "Try to predict the RVA of the given function name in the given import library name", - "library"_a, "function"_a) - - .def_property_readonly("signatures", - static_cast(&Binary::signatures), - "Return an iterator over the " RST_CLASS_REF(lief.PE.Signature) " objects", - py::return_value_policy::reference) - - .def("authentihash", - [] (const Binary& bin, ALGORITHMS algo) { - const std::vector& data = bin.authentihash(algo); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Compute the authentihash according to the " RST_CLASS_REF(lief.PE.ALGORITHMS) " " - "given in the first parameter", - "algorithm"_a) - - .def("verify_signature", - static_cast(&Binary::verify_signature), - R"delim( - Verify the binary against the embedded signature(s) (if any) - - First off, it checks that the embedded signatures are correct (c.f. :meth:`lief.PE.Signature.check`) - and then it checks that the authentihash matches :attr:`lief.PE.ContentInfo.digest` - - One can tweak the verification process with the :class:`lief.PE.Signature.VERIFICATION_CHECKS` flags - - .. seealso:: - - :meth:`lief.PE.Signature.check` - )delim", - "checks"_a = Signature::VERIFICATION_CHECKS::DEFAULT) - - .def("verify_signature", - static_cast(&Binary::verify_signature), - R"delim( - Verify the binary with the Signature object provided in the first parameter - It can be used to verify a detached signature: - - .. code-block:: python - - detached = lief.PE.Signature.parse("sig.pkcs7") - binary.verify_signature(detached) - )delim", - "signature"_a, "checks"_a = Signature::VERIFICATION_CHECKS::DEFAULT) - - .def_property_readonly("authentihash_md5", - [] (const Binary& bin) { - const std::vector& data = bin.authentihash(ALGORITHMS::MD5); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Authentihash **MD5** value") - - .def_property_readonly("authentihash_sha1", - [] (const Binary& bin) { - const std::vector& data = bin.authentihash(ALGORITHMS::SHA_1); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Authentihash **SHA1** value") - - .def_property_readonly("authentihash_sha256", - [] (const Binary& bin) { - const std::vector& data = bin.authentihash(ALGORITHMS::SHA_256); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Authentihash **SHA-256** value") - - .def_property_readonly("authentihash_sha512", - [] (const Binary& bin) { - const std::vector& data = bin.authentihash(ALGORITHMS::SHA_512); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Authentihash **SHA-512** value") - - .def_property_readonly("debug", - static_cast(&Binary::debug), - "Return the " RST_CLASS_REF(lief.PE.Debug) "", - py::return_value_policy::reference) - - .def_property_readonly("load_configuration", - static_cast(&Binary::load_configuration), - "Return the " RST_CLASS_REF(lief.PE.LoadConfiguration) " object or None if not present", - py::return_value_policy::reference) - - .def("get_export", - static_cast(&Binary::get_export), - "Return the " RST_CLASS_REF(lief.PE.Export) " object", - py::return_value_policy::reference) - - .def_property_readonly("symbols", - static_cast& (Binary::*)(void)>(&Binary::symbols), - "Return binary's " RST_CLASS_REF(lief.PE.Symbol) "", - py::return_value_policy::reference) - - .def("get_section", - static_cast>(&Binary::get_section), - "Return the " RST_CLASS_REF(lief.PE.Section) " object from the given name or None if not not found", - "section_name"_a, - py::return_value_policy::reference) - - .def("add_section", - &Binary::add_section, - "Add a " RST_CLASS_REF(lief.PE.Section) " to the binary.", - "section"_a, py::arg("type") = PE_SECTION_TYPES::UNKNOWN, - py::return_value_policy::reference) - - .def_property_readonly("relocations", - static_cast>(&Binary::relocations), - "Return an iterator over the " RST_CLASS_REF(lief.PE.Relocation) "", - py::return_value_policy::reference) - - .def("add_relocation", - &Binary::add_relocation, - "Add a " RST_CLASS_REF(lief.PE.Relocation) " to the binary", - "relocation"_a) - - .def("remove_all_relocations", &Binary::remove_all_relocations) - - .def("remove", - static_cast(&Binary::remove), - "Remove the " RST_CLASS_REF(lief.PE.Section) " given in first parameter", - "section"_a, "clear"_a = false) - - .def_property_readonly("data_directories", - static_cast>(&Binary::data_directories), - "Return an iterator over the " RST_CLASS_REF(lief.PE.DataDirectory) "", - py::return_value_policy::reference) - - .def("data_directory", - static_cast(&Binary::data_directory), - "Return the " RST_CLASS_REF(lief.PE.DataDirectory) " object from the given " RST_CLASS_REF(lief.PE.DATA_DIRECTORY) " type", - "type"_a, - py::return_value_policy::reference) - - .def_property_readonly("imports", - static_cast>(&Binary::imports), - "Return an iterator over the " RST_CLASS_REF(lief.PE.Import) " libraries", - py::return_value_policy::reference) - - .def("has_import", - &Binary::has_import, - "``True`` if the binary imports the given library name", - "import_name"_a) - - .def("get_import", - static_cast>(&Binary::get_import), - "Return the " RST_CLASS_REF(lief.PE.Import) " from the given name or None if not not found", - "import_name"_a, - py::return_value_policy::reference) - - .def_property_readonly("delay_imports", - static_cast>(&Binary::delay_imports), - "Return an iterator over the " RST_CLASS_REF(lief.PE.DelayImport) " ") - - .def_property_readonly("has_delay_imports", &Binary::has_delay_imports, - "``True`` if the current binary has delay imports (" RST_CLASS_REF(lief.PE.DelayImport) ")") - - .def("has_delay_import", - &Binary::has_delay_import, - "``True`` if the binary imports the given library name", - "import_name"_a) - - .def("get_delay_import", - static_cast>(&Binary::get_delay_import), - "Return the " RST_CLASS_REF(lief.PE.DelayImport) " from the given name or None if not not found", - "import_name"_a, - py::return_value_policy::reference) - - .def_property_readonly("resources_manager", - [] (Binary& self) { - return error_or(&Binary::resources_manager, self); - }, - "Return the " RST_CLASS_REF(lief.PE.ResourcesManager) " to manage resources") - - .def_property_readonly("resources", - static_cast>(&Binary::resources), - "Return the " RST_CLASS_REF(lief.PE.ResourceNode) " tree or None if not not present", - py::return_value_policy::reference) - - .def_property_readonly("overlay", - static_cast&>>(&Binary::overlay), - "Return the overlay content as a ``list`` of bytes", - py::return_value_policy::reference) - - .def_property("dos_stub", - static_cast&>>(&Binary::dos_stub), - static_cast&>>(&Binary::dos_stub), - "DOS stub content as a ``list`` of bytes") - - .def("add_import_function", - &Binary::add_import_function, - "Add a function to the given " RST_CLASS_REF(lief.PE.Import) " name", - "import_name"_a, "function_name"_a, - py::return_value_policy::reference) - - .def("add_library", - &Binary::add_library, - "Add an " RST_CLASS_REF(lief.PE.Import) " by name", - "import_name"_a, - py::return_value_policy::reference) - - .def("remove_library", - &Binary::remove_library, - "Remove the " RST_CLASS_REF(lief.PE.Import) " from the given name", - "import_name"_a) - - .def("hook_function", - static_cast(&Binary::hook_function), - "**DEPRECATED**", - "function_name"_a, "hook_address"_a) - - .def("hook_function", - static_cast(&Binary::hook_function), - "**DEPRECATED**", - "library_name"_a, "function_name"_a, "hook_address"_a) - - .def("remove_all_libraries", - &Binary::remove_all_libraries, - "Remove all imported libraries") - - .def("write", - static_cast(&Binary::write), - "Build the binary and write the result to the given ``output`` file", - "output_path"_a) - - .def("__str__", - [] (const Binary& binary) - { - std::ostringstream stream; - stream << binary; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyBuilder.cpp b/vendor/lief/api/python/PE/objects/pyBuilder.cpp deleted file mode 100644 index 1f5602f..0000000 --- a/vendor/lief/api/python/PE/objects/pyBuilder.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/Builder.hpp" - -#include -#include - -//template>{}, int> = 0 > -//constexpr decltype(auto) my_invoke(Fn&& f, Args&&... args) -// noexcept(noexcept(std::mem_fn(f)(std::forward(args)...))) -//{ -// return std::mem_fn(f)(std::forward(args)...); -//} - -namespace LIEF { -namespace PE { - -template<> -void create(py::module& m) { - - py::class_(m, "Builder", - R"delim( - Class that is used to rebuild a raw PE binary from a PE::Binary object - )delim") - - .def(py::init(), - "Constructor that takes a " RST_CLASS_REF(lief.PE.Binary) "", - "pe_binary"_a) - - .def("build", - [] (Builder& self) -> py::object { - return error_or(static_cast(&Builder::build), self); - }, - "Perform the build process") - - .def("build_imports", - &Builder::build_imports, - "Rebuild the import table into another section", - py::arg("enable") = true, - py::return_value_policy::reference) - - .def("patch_imports", - &Builder::patch_imports, - "Patch the original import table in order to redirect functions to " - "the new import table.\n\n" - "This setting should be used with ``build_imports`` set to ``True``", - py::arg("enable") = true, - py::return_value_policy::reference) - - .def("build_relocations", - &Builder::build_relocations, - "Rebuild the relocation table in another section", - py::arg("enable") = true, - py::return_value_policy::reference) - - .def("build_tls", - static_cast(&Builder::build_tls), - "Rebuild TLS object in another section", - py::arg("enable") = true, - py::return_value_policy::reference) - - .def("build_resources", - static_cast(&Builder::build_resources), - "Rebuid the resources in another section", - py::arg("enable") = true, - py::return_value_policy::reference) - - .def("build_overlay", - static_cast(&Builder::build_overlay), - "Rebuild the binary's overlay", - py::arg("enable") = true, - py::return_value_policy::reference) - - .def("build_dos_stub", - static_cast(&Builder::build_dos_stub), - "Rebuild the DOS stub", - py::arg("enable") = true, - py::return_value_policy::reference) - - .def("write", - static_cast(&Builder::write), - "Write the build result into the ``output`` file", - "output"_a) - - .def("get_build", - &Builder::get_build, - "Return the build result as a ``list`` of bytes", - py::return_value_policy::reference_internal) - - - .def("__str__", - [] (const Builder& builder) { - std::ostringstream stream; - stream << builder; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyCodeIntegrity.cpp b/vendor/lief/api/python/PE/objects/pyCodeIntegrity.cpp deleted file mode 100644 index b946a61..0000000 --- a/vendor/lief/api/python/PE/objects/pyCodeIntegrity.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/CodeIntegrity.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (CodeIntegrity::*)(void) const; - -template -using setter_t = void (CodeIntegrity::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "CodeIntegrity") - .def(py::init<>()) - - .def_property("flags", - static_cast>(&CodeIntegrity::flags), - static_cast>(&CodeIntegrity::flags), - "Flags to indicate if CI information is available, etc.") - - .def_property("catalog", - static_cast>(&CodeIntegrity::catalog), - static_cast>(&CodeIntegrity::catalog), - "``0xFFFF`` means not available") - - .def_property("catalog_offset", - static_cast>(&CodeIntegrity::catalog_offset), - static_cast>(&CodeIntegrity::catalog_offset), - "") - - .def_property("reserved", - static_cast>(&CodeIntegrity::reserved), - static_cast>(&CodeIntegrity::reserved), - "Additional bitmask to be defined later") - - - .def("__eq__", &CodeIntegrity::operator==) - .def("__ne__", &CodeIntegrity::operator!=) - .def("__hash__", - [] (const CodeIntegrity& code) { - return Hash::hash(code); - }) - - - .def("__str__", [] (const CodeIntegrity& code) - { - std::ostringstream stream; - stream << code; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyCodeView.cpp b/vendor/lief/api/python/PE/objects/pyCodeView.cpp deleted file mode 100644 index 1a53335..0000000 --- a/vendor/lief/api/python/PE/objects/pyCodeView.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/CodeView.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (CodeView::*)(void) const; - -template -using setter_t = void (CodeView::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "CodeView") - .def_property_readonly("cv_signature", - static_cast>(&CodeView::cv_signature), - "Type of the code view (" RST_CLASS_REF(lief.PE.CODE_VIEW_SIGNATURES) ")") - - .def("__eq__", &CodeView::operator==) - .def("__ne__", &CodeView::operator!=) - .def("__hash__", - [] (const CodeView& codeview) { - return Hash::hash(codeview); - }) - - .def("__str__", [] (const CodeView& cv) - { - std::ostringstream stream; - stream << cv; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyCodeViewPDB.cpp b/vendor/lief/api/python/PE/objects/pyCodeViewPDB.cpp deleted file mode 100644 index 49a5c49..0000000 --- a/vendor/lief/api/python/PE/objects/pyCodeViewPDB.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/CodeViewPDB.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (CodeViewPDB::*)(void) const; - -template -using setter_t = void (CodeViewPDB::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "CodeViewPDB") - .def(py::init<>()) - - .def_property("signature", - static_cast>(&CodeViewPDB::signature), - static_cast>(&CodeViewPDB::signature)) - - .def_property("age", - static_cast>(&CodeViewPDB::age), - static_cast>(&CodeViewPDB::age)) - - .def_property("filename", - static_cast>(&CodeViewPDB::filename), - static_cast>(&CodeViewPDB::filename)) - - .def("__eq__", &CodeViewPDB::operator==) - .def("__ne__", &CodeViewPDB::operator!=) - .def("__hash__", - [] (const CodeViewPDB& codeview) { - return Hash::hash(codeview); - }) - - .def("__str__", [] (const CodeViewPDB& cv) - { - std::ostringstream stream; - stream << cv; - return stream.str(); - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyDataDirectory.cpp b/vendor/lief/api/python/PE/objects/pyDataDirectory.cpp deleted file mode 100644 index 05a5d57..0000000 --- a/vendor/lief/api/python/PE/objects/pyDataDirectory.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/DataDirectory.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (DataDirectory::*)(void) const; - -template -using setter_t = void (DataDirectory::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "DataDirectory", - R"delim( - Class that represents a PE data directory entry - )delim") - .def(py::init<>()) - .def_property("rva", - static_cast>(&DataDirectory::RVA), - static_cast>(&DataDirectory::RVA), - "**Relative** virtual address of the content associated with the current data directory") - - .def_property("size", - static_cast>(&DataDirectory::size), - static_cast>(&DataDirectory::size), - "Size in bytes of the content associated with the current data directory") - - .def_property_readonly("section", - static_cast(&DataDirectory::section), - "" RST_CLASS_REF(lief.PE.Section) " associated with the current data directory or None if not linked", - py::return_value_policy::reference) - - .def_property_readonly("type", - &DataDirectory::type, - "Type (" RST_CLASS_REF(lief.PE.DATA_DIRECTORY) ") of the current data directory", - py::return_value_policy::reference_internal) - - .def_property_readonly("has_section", - &DataDirectory::has_section, - "``True`` if the current data directory is tied to a " RST_CLASS_REF(lief.PE.Section) "") - - .def("__eq__", &DataDirectory::operator==) - .def("__ne__", &DataDirectory::operator!=) - .def("__hash__", - [] (const DataDirectory& data_directory) { - return Hash::hash(data_directory); - }) - - .def("__str__", [] (const DataDirectory& datadir) - { - std::ostringstream stream; - stream << datadir; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyDebug.cpp b/vendor/lief/api/python/PE/objects/pyDebug.cpp deleted file mode 100644 index 33b6913..0000000 --- a/vendor/lief/api/python/PE/objects/pyDebug.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/Debug.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Debug::*)(void) const; - -template -using setter_t = void (Debug::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "Debug") - .def(py::init<>()) - - .def_property("characteristics", - static_cast>(&Debug::characteristics), - static_cast>(&Debug::characteristics), - "Reserved should be 0") - - .def_property("timestamp", - static_cast>(&Debug::timestamp), - static_cast>(&Debug::timestamp), - "The time and date that the debug data was created.") - - .def_property("major_version", - static_cast>(&Debug::major_version), - static_cast>(&Debug::major_version), - "The major version number of the debug data format.") - - .def_property("minor_version", - static_cast>(&Debug::minor_version), - static_cast>(&Debug::minor_version), - "The minor version number of the debug data format.") - - .def_property("type", - static_cast>(&Debug::type), - static_cast>(&Debug::type), - "The format (" RST_CLASS_REF(lief.PE.DEBUG_TYPES) ") of the debugging information") - - .def_property("sizeof_data", - static_cast>(&Debug::sizeof_data), - static_cast>(&Debug::sizeof_data), - "Size of the debug data") - - .def_property("addressof_rawdata", - static_cast>(&Debug::addressof_rawdata), - static_cast>(&Debug::addressof_rawdata), - "Address of the debug data relative to the image base") - - .def_property("pointerto_rawdata", - static_cast>(&Debug::pointerto_rawdata), - static_cast>(&Debug::pointerto_rawdata), - "File offset of the debug data") - - .def_property_readonly("has_code_view", - &Debug::has_code_view, - "Whether or not a code view is present") - - .def_property_readonly("code_view", - static_cast(&Debug::code_view), - R"delim( - Return an object which subclass :class:`~lief.PE.CodeView` representing the code view" - The subclassed object can be one of: - - * :class:`~lief.PE.CodeViewPDB` - - If a code view is not present, it is set to None - )delim", - py::return_value_policy::reference) - - .def_property_readonly("has_pogo", - &Debug::has_pogo, - "Whether or not a pogo is present") - - .def_property_readonly("pogo", - static_cast(&Debug::pogo), - R"delim( - Return an object which subclasses :class:`~lief.PE.Pogo` representing the pogo entry. - It returns None if not present. - )delim", - py::return_value_policy::reference) - - .def("__eq__", &Debug::operator==) - .def("__ne__", &Debug::operator!=) - .def("__hash__", - [] (const Debug& debug) { - return Hash::hash(debug); - }) - - .def("__str__", [] (const Debug& debug) - { - std::ostringstream stream; - stream << debug; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyDelayImport.cpp b/vendor/lief/api/python/PE/objects/pyDelayImport.cpp deleted file mode 100644 index cb99b24..0000000 --- a/vendor/lief/api/python/PE/objects/pyDelayImport.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/DelayImport.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (DelayImport::*)() const; - -template -using setter_t = void (DelayImport::*)(T); - -template -using no_const_getter = T (DelayImport::*)(); - -template -using no_const_func = T (DelayImport::*)(P); - - -template<> -void create(py::module& m) { - py::class_ imp(m, "DelayImport", - R"delim( - Class that represents a PE delay import - )delim"); - - init_ref_iterator(imp, "it_entries"); - - imp - .def(py::init(), - "Constructor from a library name", - "library_name"_a) - - .def_property_readonly("entries", - static_cast>(&DelayImport::entries), - "Iterator over the " RST_CLASS_REF(lief.PE.DelayImportEntry) " (functions)", - py::return_value_policy::reference) - - .def_property("name", - [] (const DelayImport& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&DelayImport::name), - "Library name (e.g. ``kernel32.dll``)", - py::return_value_policy::reference_internal) - - .def_property("attribute", - static_cast>(&DelayImport::attribute), - static_cast>(&DelayImport::attribute), - R"delim( - Reserved and **should** be zero according to the PE specifications - )delim") - - .def_property("handle", - static_cast>(&DelayImport::handle), - static_cast>(&DelayImport::handle), - R"delim( - The RVA of the module handle (in the ``.data`` section) - It is used for storage by the routine that is supplied to manage delay-loading. - )delim") - - .def_property("iat", - static_cast>(&DelayImport::iat), - static_cast>(&DelayImport::iat), - R"delim( - RVA of the delay-load import address table. - )delim") - - .def_property("names_table", - static_cast>(&DelayImport::names_table), - static_cast>(&DelayImport::names_table), - R"delim( - RVA of the delay-load import names table. - The content of this table has the layout as the Import lookup table - )delim") - - .def_property("biat", - static_cast>(&DelayImport::biat), - static_cast>(&DelayImport::biat), - R"delim( - RVA of the **bound** delay-load import address table or 0 - if the table does not exist. - )delim") - - - .def_property("uiat", - static_cast>(&DelayImport::uiat), - static_cast>(&DelayImport::uiat), - R"delim( - RVA of the **unload** delay-load import address table or 0 - if the table does not exist. - - According to the PE specifications, this table is an - exact copy of the delay import address table that can be - used to to restore the original IAT the case of unloading. - )delim") - - .def_property("timestamp", - static_cast>(&DelayImport::timestamp), - static_cast>(&DelayImport::timestamp), - R"delim( - The timestamp of the DLL to which this image has been bound. - )delim") - - .def("__eq__", &DelayImport::operator==) - .def("__ne__", &DelayImport::operator!=) - .def("__hash__", - [] (const DelayImport& import) { - return Hash::hash(import); - }) - - - .def("__str__", [] (const DelayImport& import) - { - std::ostringstream stream; - stream << import; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyDelayImportEntry.cpp b/vendor/lief/api/python/PE/objects/pyDelayImportEntry.cpp deleted file mode 100644 index 61e2175..0000000 --- a/vendor/lief/api/python/PE/objects/pyDelayImportEntry.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/DelayImportEntry.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (DelayImportEntry::*)() const; - -template -using setter_t = void (DelayImportEntry::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "DelayImportEntry", - R"delim( - Class that represents an entry (i.e. a delay import) in the delay import table (:class:`~lief.PE.DelayImport`). - - It extends the :class:`lief.Symbol` generic class that provides the :attr:`lief.Symbol.name` - and :attr:`lief.Symbol.value` - - The meaning of :attr:`lief.Symbol.value` for this PE object is the address (as an RVA) in the IAT - where the resolution should take place - )delim") - .def(py::init<>()) - - .def_property("name", - [] (const DelayImportEntry& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&DelayImportEntry::name), - "Delay import name if not ordinal") - - .def_property("data", - static_cast>(&DelayImportEntry::data), - static_cast>(&DelayImportEntry::data), - "Raw value") - - .def_property_readonly("is_ordinal", - &DelayImportEntry::is_ordinal, - "``True`` if it is an import by ordinal") - - .def_property_readonly("ordinal", - &DelayImportEntry::ordinal, - "Ordinal value (if any). See: :attr:`~lief.PE.DelayImportEntry.is_ordinal`") - - .def_property_readonly("hint", - &DelayImportEntry::hint, - "Index into the :attr:`lief.PE.Export.entries` that is used to speed-up the symbol resolution") - - .def_property_readonly("iat_value", - &DelayImportEntry::iat_value, - R"delim( - Value of the current entry in the delay-loaded import address table. - See: :attr:`~DelayImportEntry.iat` - )delim") - - .def("__eq__", &DelayImportEntry::operator==) - .def("__ne__", &DelayImportEntry::operator!=) - .def("__hash__", - [] (const DelayImportEntry& import_entry) { - return Hash::hash(import_entry); - }) - - .def("__str__", [] (const DelayImportEntry& importEntry) { - std::ostringstream stream; - stream << importEntry; - return stream.str(); - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyDosHeader.cpp b/vendor/lief/api/python/PE/objects/pyDosHeader.cpp deleted file mode 100644 index eddf1c5..0000000 --- a/vendor/lief/api/python/PE/objects/pyDosHeader.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/DosHeader.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_abs_t = T (DosHeader::*)(void) const; - -template -using setter_abs_t = void (DosHeader::*)(T); - -using getter_t = getter_abs_t; -using setter_t = setter_abs_t; - - -template<> -void create(py::module& m) { - py::class_(m, "DosHeader", - R"delim( - Class which represents the DosHeader, the **first** structure presents at the beginning of a PE file. - - Most of the attributes of this structures are not relevant, except :attr:`~lief.PE.DosHeader.addressof_new_exeheader` - )delim") - .def(py::init<>()) - .def_property("magic", - static_cast(&DosHeader::magic), - static_cast(&DosHeader::magic)) - - .def_property("used_bytes_in_the_last_page", - static_cast(&DosHeader::used_bytes_in_the_last_page), - static_cast(&DosHeader::used_bytes_in_the_last_page)) - - .def_property("file_size_in_pages", - static_cast(&DosHeader::file_size_in_pages), - static_cast(&DosHeader::file_size_in_pages)) - - .def_property("numberof_relocation", - static_cast(&DosHeader::numberof_relocation), - static_cast(&DosHeader::numberof_relocation)) - - .def_property("header_size_in_paragraphs", - static_cast(&DosHeader::header_size_in_paragraphs), - static_cast(&DosHeader::header_size_in_paragraphs)) - - .def_property("minimum_extra_paragraphs", - static_cast(&DosHeader::minimum_extra_paragraphs), - static_cast(&DosHeader::minimum_extra_paragraphs)) - - .def_property("maximum_extra_paragraphs", - static_cast(&DosHeader::maximum_extra_paragraphs), - static_cast(&DosHeader::maximum_extra_paragraphs)) - - .def_property("initial_relative_ss", - static_cast(&DosHeader::initial_relative_ss), - static_cast(&DosHeader::initial_relative_ss)) - - .def_property("initial_sp", - static_cast(&DosHeader::initial_sp), - static_cast(&DosHeader::initial_sp)) - - .def_property("checksum", - static_cast(&DosHeader::checksum), - static_cast(&DosHeader::checksum)) - - .def_property("initial_ip", - static_cast(&DosHeader::initial_ip), - static_cast(&DosHeader::initial_ip)) - - .def_property("initial_relative_cs", - static_cast(&DosHeader::initial_relative_cs), - static_cast(&DosHeader::initial_relative_cs)) - - .def_property("addressof_relocation_table", - static_cast(&DosHeader::addressof_relocation_table), - static_cast(&DosHeader::addressof_relocation_table)) - - .def_property("overlay_number", - static_cast(&DosHeader::overlay_number), - static_cast(&DosHeader::overlay_number)) - - .def_property("oem_id", - static_cast(&DosHeader::oem_id), - static_cast(&DosHeader::oem_id)) - - .def_property("oem_info", - static_cast(&DosHeader::oem_info), - static_cast(&DosHeader::oem_info)) - - .def_property("addressof_new_exeheader", - static_cast>(&DosHeader::addressof_new_exeheader), - static_cast>(&DosHeader::addressof_new_exeheader)) - - - .def("__eq__", &DosHeader::operator==) - .def("__ne__", &DosHeader::operator!=) - .def("__hash__", - [] (const DosHeader& dos_header) { - return Hash::hash(dos_header); - }) - - .def("__str__", [] (const DosHeader& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); - -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyExport.cpp b/vendor/lief/api/python/PE/objects/pyExport.cpp deleted file mode 100644 index 22397bd..0000000 --- a/vendor/lief/api/python/PE/objects/pyExport.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/Export.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Export::*)(void) const; - -template -using setter_t = void (Export::*)(T); - -template -using no_const_getter = T (Export::*)(void); - - -template<> -void create(py::module& m) { - py::class_ exp(m, "Export", - R"delim( - Class which represents a PE Export - )delim"); - - init_ref_iterator(exp, "it_entries"); - - exp - .def(py::init<>()) - - .def_property("name", - [] (const Export& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&Export::name), - "The name of the library exported (e.g. ``KERNEL32.dll``)") - - .def_property("export_flags", - static_cast>(&Export::export_flags), - static_cast>(&Export::export_flags), - "According to the PE specifications this value is reserved and should be set to 0") - - .def_property("timestamp", - static_cast>(&Export::timestamp), - static_cast>(&Export::timestamp), - "The time and date that the export data was created") - - .def_property("major_version", - static_cast>(&Export::major_version), - static_cast>(&Export::major_version), - "The major version number (can be user-defined)") - - .def_property("minor_version", - static_cast>(&Export::minor_version), - static_cast>(&Export::minor_version), - "The minor version number (can be user-defined)") - - .def_property("ordinal_base", - static_cast>(&Export::ordinal_base), - static_cast>(&Export::ordinal_base), - "The starting number for the exports. Usually this value is set to 1") - - .def_property_readonly("entries", - static_cast>(&Export::entries), - "Iterator over the " RST_CLASS_REF(lief.PE.ExportEntry) "", - py::return_value_policy::reference_internal) - - - .def("__eq__", &Export::operator==) - .def("__ne__", &Export::operator!=) - .def("__hash__", - [] (const Export& export_) { - return Hash::hash(export_); - }) - - .def("__str__", [] (const Export& export_) - { - std::ostringstream stream; - stream << export_; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyExportEntry.cpp b/vendor/lief/api/python/PE/objects/pyExportEntry.cpp deleted file mode 100644 index 6713ffe..0000000 --- a/vendor/lief/api/python/PE/objects/pyExportEntry.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/ExportEntry.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ExportEntry::*)(void) const; - -template -using setter_t = void (ExportEntry::*)(T); - - -template<> -void create(py::module& m) { - py::class_ export_entry(m, "ExportEntry", - R"delim( - Class which represents a PE Export entry (cf. :class:`lief.PE.Export`) - )delim"); - - py::class_(export_entry, "forward_information_t") - .def_readwrite("library", &ExportEntry::forward_information_t::library) - .def_readwrite("function", &ExportEntry::forward_information_t::function) - - .def("__str__", [] (const ExportEntry::forward_information_t& info) - { - std::ostringstream stream; - stream << info; - return stream.str(); - }); - - export_entry - .def(py::init<>()) - - .def_property("name", - [] (const ExportEntry& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&ExportEntry::name)) - - .def_property("ordinal", - static_cast>(&ExportEntry::ordinal), - static_cast>(&ExportEntry::ordinal)) - - .def_property("address", - static_cast>(&ExportEntry::address), - static_cast>(&ExportEntry::address)) - - .def_property("is_extern", - static_cast>(&ExportEntry::is_extern), - static_cast>(&ExportEntry::is_extern)) - - .def_property_readonly("is_forwarded", - &ExportEntry::is_forwarded) - - .def_property_readonly("forward_information", - &ExportEntry::forward_information) - - .def_property_readonly("function_rva", - &ExportEntry::function_rva) - - .def("__eq__", &ExportEntry::operator==) - .def("__ne__", &ExportEntry::operator!=) - .def("__hash__", - [] (const ExportEntry& export_entry) { - return Hash::hash(export_entry); - }) - - .def("__str__", [] (const ExportEntry& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyHeader.cpp b/vendor/lief/api/python/PE/objects/pyHeader.cpp deleted file mode 100644 index bef9b4e..0000000 --- a/vendor/lief/api/python/PE/objects/pyHeader.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/Header.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - - -template<> -void create
(py::module& m) { - py::class_(m, "Header", - R"delim( - Class that represents the PE header (which follows the :class:`lief.PE.DosHeader`) - )delim") - .def(py::init<>()) - - .def_property("signature", - static_cast>(&Header::signature), - static_cast>(&Header::signature), - "Signature (or magic byte) of the header. It must be: ``PE\\0\\0``") - - .def_property("machine", - static_cast>(&Header::machine), - static_cast>(&Header::machine), - "The target machine architecture: " RST_CLASS_REF(lief.PE.MACHINE_TYPES) "") - - .def_property("numberof_sections", - static_cast>(&Header::numberof_sections), - static_cast>(&Header::numberof_sections), - "Number of sections in the binary") - - .def_property("time_date_stamps", - static_cast>(&Header::time_date_stamp), - static_cast>(&Header::time_date_stamp), - "The low 32 bits of the number of seconds since 00:00 January 1, 1970 that indicates when the file was created.") - - .def_property("pointerto_symbol_table", - static_cast>(&Header::pointerto_symbol_table), - static_cast>(&Header::pointerto_symbol_table), - R"delim( - The file offset of the COFF symbol table, or zero if no COFF symbol table is present. - - This value should be zero for an image because COFF debugging information is deprecated. - )delim") - - .def_property("numberof_symbols", - static_cast>(&Header::numberof_symbols), - static_cast>(&Header::numberof_symbols), - R"delim( - The number of entries in the symbol table. This data can be used to locate the string table - which immediately follows the symbol table. - - This value should be zero for an image because COFF debugging information is deprecated. - )delim") - - .def_property("sizeof_optional_header", - static_cast>(&Header::sizeof_optional_header), - static_cast>(&Header::sizeof_optional_header), - R"delim( - Size of the :class:`~lief.PE.OptionalHeader` **AND** the data directories which follows this header. - - This value is equivalent to: ``sizeof(pe_optional_header) + NB_DATA_DIR * sizeof(data_directory)`` - - This size **should** be either: - - * 0xE0 (224) for a PE32 (32 bits) - * 0xF0 (240) for a PE32+ (64 bits) - )delim") - - .def_property("characteristics", - static_cast>(&Header::characteristics), - static_cast>(&Header::characteristics), - "The " RST_CLASS_REF(lief.PE.HEADER_CHARACTERISTICS) " that indicate the attributes of the file.") - - .def("has_characteristic", - &Header::has_characteristic, - "``True`` if the header has the given " RST_CLASS_REF(lief.PE.HEADER_CHARACTERISTICS) "", - "characteristic"_a) - - .def("add_characteristic", - &Header::add_characteristic, - "Add the given " RST_CLASS_REF(lief.PE.HEADER_CHARACTERISTICS) " to the header", - "characteristic"_a) - - .def("remove_characteristic", - &Header::remove_characteristic, - "Remove the given " RST_CLASS_REF(lief.PE.HEADER_CHARACTERISTICS) " from the header", - "characteristic"_a) - - .def_property_readonly("characteristics_list", - &Header::characteristics_list, - "Return the " RST_CLASS_REF(lief.PE.HEADER_CHARACTERISTICS) " as a ``list``") - - - .def("__eq__", &Header::operator==) - .def("__ne__", &Header::operator!=) - .def("__hash__", - [] (const Header& header) { - return Hash::hash(header); - }) - - - .def("__str__", [] (const Header& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyImport.cpp b/vendor/lief/api/python/PE/objects/pyImport.cpp deleted file mode 100644 index b0cceab..0000000 --- a/vendor/lief/api/python/PE/objects/pyImport.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" -#include "pyErr.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/Import.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Import::*)(void) const; - -template -using setter_t = void (Import::*)(T); - -template -using no_const_getter = T (Import::*)(void); - -template -using no_const_func = T (Import::*)(P); - - -template<> -void create(py::module& m) { - py::class_ imp(m, "Import", - R"delim( - Class that represents a PE import - )delim"); - - init_ref_iterator(imp, "it_entries"); - - imp - .def(py::init<>(), - "Default constructor") - - .def(py::init(), - "Constructor from a library name", - "library_name"_a) - - .def_property_readonly("forwarder_chain", - &Import::forwarder_chain, - "The index of the first forwarder reference") - - .def_property_readonly("timedatestamp", - &Import::timedatestamp, - R"delim( - The stamp that is set to zero until the image is bound. - - After the image is bound, this field is set to the time/data stamp of the DLL - )delim") - - .def_property_readonly("entries", - static_cast>(&Import::entries), - "Iterator over the " RST_CLASS_REF(lief.PE.ImportEntry) " (functions)", - py::return_value_policy::reference) - - .def_property("name", - [] (const Import& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&Import::name), - "Library name (e.g. ``kernel32.dll``)", - py::return_value_policy::reference) - - .def_property_readonly("directory", - static_cast>(&Import::directory), - R"delim( - Return the :class:`~lief.PE.DataDirectory` associated with this import. - - It should be the one at index :attr:`lief.PE.DATA_DIRECTORY.IMPORT_TABLE`. - It can return None if the Import directory can't be resolved. - )delim", - py::return_value_policy::reference) - - .def_property_readonly("iat_directory", - static_cast>(&Import::iat_directory), - R"delim( - Return the :class:`~lief.PE.DataDirectory` associated with the ``IAT`` table. - - It should be the one at index :attr:`lief.PE.DATA_DIRECTORY.IAT`. It can - return None if the IAT directory can't be resolved. - )delim", - py::return_value_policy::reference) - - .def_property("import_address_table_rva", - static_cast>(&Import::import_address_table_rva), - static_cast>(&Import::import_address_table_rva), - R"delim( - The RVA of the import address table (``IAT``). The content of this - table is **identical** to the content of the Import Lookup Table (``ILT``) - until the image is bound. - - .. warning:: - - This address could change when re-building the binary - )delim") - - .def_property("import_lookup_table_rva", - static_cast>(&Import::import_lookup_table_rva), - static_cast>(&Import::import_lookup_table_rva), - R"delim( - The RVA of the import lookup table. This table - contains the :attr:`~lief.PE.ImportEntry.name` or the :attr:`~lief.PE.ImportEntry.ordinal` - for all the imports. - )delim") - - .def("get_function_rva_from_iat", - [] (const Import& self, const std::string& name) { - return error_or(&Import::get_function_rva_from_iat, self, name); - }, - "Return the relative virtual address of the given function within the *Import Address Table*", - "function_name"_a) - - .def("add_entry", - static_cast(&Import::add_entry), - "Add an " RST_CLASS_REF(lief.PE.ImportEntry) " (function) to the current import", - "entry"_a, - py::return_value_policy::reference) - - .def("add_entry", - static_cast(&Import::add_entry), - "Add an " RST_CLASS_REF(lief.PE.ImportEntry) " (function) to the current import", - "function_name"_a, - py::return_value_policy::reference) - - .def("get_entry", - static_cast>(&Import::get_entry), - "Return the " RST_CLASS_REF(lief.PE.ImportEntry) " with the given name or None if not found", - "function_name"_a, - py::return_value_policy::reference) - - - .def("__eq__", &Import::operator==) - .def("__ne__", &Import::operator!=) - .def("__hash__", - [] (const Import& import) { - return Hash::hash(import); - }) - - - .def("__str__", [] (const Import& import) - { - std::ostringstream stream; - stream << import; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyImportEntry.cpp b/vendor/lief/api/python/PE/objects/pyImportEntry.cpp deleted file mode 100644 index 595c919..0000000 --- a/vendor/lief/api/python/PE/objects/pyImportEntry.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/ImportEntry.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ImportEntry::*)(void) const; - -template -using setter_t = void (ImportEntry::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ImportEntry", - R"delim( - Class that represents an entry (i.e. an import) in the import table (:class:`~lief.PE.Import`). - - It extends the :class:`lief.Symbol` generic class that provides the :attr:`lief.Symbol.name` - and :attr:`lief.Symbol.value` - )delim") - .def(py::init<>()) - - .def(py::init(), - "Constructor from a :attr:`~lief.PE.ImportEntry.name`", - "import_name"_a) - - .def(py::init(), - "Constructor from a :attr:`~lief.PE.ImportEntry.data` and an optionally :attr:`~lief.PE.ImportEntry.name`", - "data"_a, "name"_a = "") - - .def_property("name", - [] (const ImportEntry& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&ImportEntry::name), - "Import name if not ordinal") - - .def_property("data", - static_cast>(&ImportEntry::data), - static_cast>(&ImportEntry::data), - "Raw value") - - .def_property_readonly("is_ordinal", - &ImportEntry::is_ordinal, - "``True`` if it is an import by ordinal") - - .def_property_readonly("ordinal", - &ImportEntry::ordinal, - "Ordinal value (if any). See: :attr:`~lief.PE.ImportEntry.is_ordinal`") - - .def_property_readonly("hint", - &ImportEntry::hint, - "Index into the :attr:`lief.PE.Export.entries` that is used to speed-up the symbol resolution") - - .def_property_readonly("iat_value", - &ImportEntry::iat_value, - "Value of the current entry in the Import Address Table. It should match the lookup table value.") - - .def_property_readonly("iat_address", - &ImportEntry::iat_address, - "**Original** address of the entry in the Import Address Table") - - - .def("__eq__", &ImportEntry::operator==) - .def("__ne__", &ImportEntry::operator!=) - .def("__hash__", - [] (const ImportEntry& import_entry) { - return Hash::hash(import_entry); - }) - - .def("__str__", [] (const ImportEntry& importEntry) - { - std::ostringstream stream; - stream << importEntry; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyOptionalHeader.cpp b/vendor/lief/api/python/PE/objects/pyOptionalHeader.cpp deleted file mode 100644 index 42fff1c..0000000 --- a/vendor/lief/api/python/PE/objects/pyOptionalHeader.cpp +++ /dev/null @@ -1,312 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/OptionalHeader.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (OptionalHeader::*)(void) const; - -template -using setter_t = void (OptionalHeader::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "OptionalHeader", - R"delim( - Class which represents the PE OptionalHeader structure.. - )delim") - .def(py::init<>()) - .def_property("magic", - static_cast>(&OptionalHeader::magic), - static_cast>(&OptionalHeader::magic), - "Magic value (" RST_CLASS_REF(lief.PE.PE_TYPE) ") that identifies a ``PE32`` from a ``PE64``") - - .def_property("major_linker_version", - static_cast>(&OptionalHeader::major_linker_version), - static_cast>(&OptionalHeader::major_linker_version), - "The linker major version number") - - .def_property("minor_linker_version", - static_cast>(&OptionalHeader::minor_linker_version), - static_cast>(&OptionalHeader::minor_linker_version), - "The linker minor version number") - - .def_property("sizeof_code", - static_cast>(&OptionalHeader::sizeof_code), - static_cast>(&OptionalHeader::sizeof_code), - R"delim( - The size of the code ``.text`` section or the sum of - all the sections that contain code (ie. :class:`~lief.PE.Section` with the flag :attr:`~lief.PE.SECTION_CHARACTERISTICS.CNT_CODE`) - )delim") - - .def_property("sizeof_initialized_data", - static_cast>(&OptionalHeader::sizeof_initialized_data), - static_cast>(&OptionalHeader::sizeof_initialized_data), - R"delim( - The size of the initialized data which are usually located in the ``.data`` section. - If the initialized data are split across multiple sections, it is the sum of the sections. - - The sections associated with the initialized data are usually identified with the - flag :attr:`~lief.PE.SECTION_CHARACTERISTICS.CNT_INITIALIZED_DATA` - )delim") - - .def_property("sizeof_uninitialized_data", - static_cast>(&OptionalHeader::sizeof_uninitialized_data), - static_cast>(&OptionalHeader::sizeof_uninitialized_data), - R"delim( - The size of the uninitialized data which are usually located in the ``.bss`` section. - If the uninitialized data are split across multiple sections, it is the sum of the sections. - - The sections associated with the uninitialized data are usually identified with the - flag :attr:`~lief.PE.SECTION_CHARACTERISTICS.CNT_UNINITIALIZED_DATA` - )delim") - - .def_property("addressof_entrypoint", - static_cast>(&OptionalHeader::addressof_entrypoint), - static_cast>(&OptionalHeader::addressof_entrypoint), - R"delim( - The address of the entry point relative to the image base when the executable file is - loaded into memory. For program images, this is the starting address. For device - drivers, this is the address of the initialization function. - - An entry point is optional for DLLs. When no entry point is present, this field must be zero. - )delim") - - .def_property("baseof_code", - static_cast>(&OptionalHeader::baseof_code), - static_cast>(&OptionalHeader::baseof_code), - "Address relative to the imagebase where the binary's code starts") - - .def_property("baseof_data", - static_cast>(&OptionalHeader::baseof_data), - static_cast>(&OptionalHeader::baseof_data), - R"delim( - Address relative to the imagebase where the binary's data starts. - - .. warning:: - - This value is not present for ``PE64`` files - - )delim") - - .def_property("imagebase", - static_cast>(&OptionalHeader::imagebase), - static_cast>(&OptionalHeader::imagebase), - "The preferred base address when mapping the binary in memory") - - .def_property("section_alignment", - static_cast>(&OptionalHeader::section_alignment), - static_cast>(&OptionalHeader::section_alignment), - R"delim( - The alignment (in bytes) of sections when they are loaded into memory. - It must be greater than or equal to :attr:`~lief.PE.OptionalHeader.file_alignment` and - the default is the page size for the architecture. - )delim") - - .def_property("file_alignment", - static_cast>(&OptionalHeader::file_alignment), - static_cast>(&OptionalHeader::file_alignment), - R"delim( - The alignment factor (in bytes) that is used to align the raw data of - sections in the image file. - The value should be a **power of 2** between 512 and 64K, inclusive. - The default value is 512. - If the :attr:`~lief.PE.OptionalHeader.section_alignment` is less than the architecture's page size, - then :attr:`~lief.PE.OptionalHeader.file_alignment` must match :attr:`~lief.PE.OptionalHeader.section_alignment`. - )delim") - - - .def_property("major_operating_system_version", - static_cast>(&OptionalHeader::major_operating_system_version), - static_cast>(&OptionalHeader::major_operating_system_version), - "The major version number of the required operating system.") - - .def_property("minor_operating_system_version", - static_cast>(&OptionalHeader::minor_operating_system_version), - static_cast>(&OptionalHeader::minor_operating_system_version), - "The minor version number of the required operating system.") - - .def_property("major_image_version", - static_cast>(&OptionalHeader::major_image_version), - static_cast>(&OptionalHeader::major_image_version), - "The major version number of the image.") - - .def_property("minor_image_version", - static_cast>(&OptionalHeader::minor_image_version), - static_cast>(&OptionalHeader::minor_image_version), - "The minor version number of the image.") - - .def_property("major_subsystem_version", - static_cast>(&OptionalHeader::major_subsystem_version), - static_cast>(&OptionalHeader::major_subsystem_version), - "The major version number of the subsystem.") - - .def_property("minor_subsystem_version", - static_cast>(&OptionalHeader::minor_subsystem_version), - static_cast>(&OptionalHeader::minor_subsystem_version), - "The minor version number of the subsystem") - - .def_property("win32_version_value", - static_cast>(&OptionalHeader::win32_version_value), - static_cast>(&OptionalHeader::win32_version_value), - "Reserved, must be zero.") - - .def_property("sizeof_image", - static_cast>(&OptionalHeader::sizeof_image), - static_cast>(&OptionalHeader::sizeof_image), - R"delim( - The size (in bytes) of the image, including all headers, as the image is loaded in memory. - It must be a multiple of :attr:`~lief.PE.OptionalHeader.section_alignment` and should match :attr:`~lief.PE.Binary.virtual_size`. - )delim") - - .def_property("sizeof_headers", - static_cast>(&OptionalHeader::sizeof_headers), - static_cast>(&OptionalHeader::sizeof_headers), - R"delim( - The combined size of an MS-DOS stub, PE header, and section headers rounded up - to a multiple of :attr:`~lief.PE.OptionalHeader.file_alignment`. - )delim") - - .def_property("checksum", - static_cast>(&OptionalHeader::checksum), - static_cast>(&OptionalHeader::checksum), - R"delim( - The image file checksum. The algorithm for computing the checksum is incorporated into ``IMAGHELP.DLL``. - The following are checked for validation at load time all **drivers**, any **DLL loaded at boot** - time, and any **DLL** that is loaded into a **critical** Windows process. - )delim") - - - .def_property_readonly("computed_checksum", - &OptionalHeader::computed_checksum, - R"delim( - The re-computed value of the :attr:`~lief.PE.OptionalHeader.checksum`. - If both values do not match, it could mean that the binary has been modified - after the compilation. - - This value is computed by LIEF when parsing the PE binary. - )delim") - - .def_property("subsystem", - static_cast>(&OptionalHeader::subsystem), - static_cast>(&OptionalHeader::subsystem), - R"delim( - Target subsystem (:class:`~lief.PE.SUBSYSTEM`) like Driver, XBox, Windows GUI, .. - )delim") - - .def_property("dll_characteristics", - static_cast>(&OptionalHeader::dll_characteristics), - static_cast>(&OptionalHeader::dll_characteristics), - R"delim( - Some characteristics (:class:`~lief.PE.DLL_CHARACTERISTICS`) of the underlying binary like the support of the PIE. - - The prefix ``dll`` comes from the official PE specifications but these characteristics - are also used for **executables** - )delim") - - .def("add", - static_cast(&OptionalHeader::add), - "Add the given " RST_CLASS_REF(lief.PE.DLL_CHARACTERISTICS) "", - "characteristic"_a) - - .def("remove", - static_cast(&OptionalHeader::remove), - "Remove the given " RST_CLASS_REF(lief.PE.DLL_CHARACTERISTICS) "", - "characteristic"_a) - - .def_property_readonly("dll_characteristics_lists", - &OptionalHeader::dll_characteristics_list, - ":attr:`~lief.PE.OptionalHeader.dll_characteristics` as a list of " RST_CLASS_REF(lief.PE.DLL_CHARACTERISTICS) "") - - .def("has", - static_cast(&OptionalHeader::has), - "``True`` if the given " RST_CLASS_REF(lief.PE.DLL_CHARACTERISTICS) " is in the " - ":attr:`~lief.PE.OptionalHeader.dll_characteristics`", - "characteristics"_a) - - .def_property("sizeof_stack_reserve", - static_cast>(&OptionalHeader::sizeof_stack_reserve), - static_cast>(&OptionalHeader::sizeof_stack_reserve), - R"delim( - The size of the stack to reserve. - - Only :attr:`~lief.PE.OptionalHeader.sizeof_stack_commit` is committed, the rest is made - available one page at a time until the reserve size is reached. - )delim") - - .def_property("sizeof_stack_commit", - static_cast>(&OptionalHeader::sizeof_stack_commit), - static_cast>(&OptionalHeader::sizeof_stack_commit), - "The size of the stack to commit.") - - .def_property("sizeof_heap_reserve", - static_cast>(&OptionalHeader::sizeof_heap_reserve), - static_cast>(&OptionalHeader::sizeof_heap_reserve), - R"delim( - The size of the local heap space to reserve. - - Only :attr:`~lief.PE.OptionalHeader.sizeof_heap_commit` is available one page at a time until - the reserve size is reached. - )delim") - - .def_property("sizeof_heap_commit", - static_cast>(&OptionalHeader::sizeof_heap_commit), - static_cast>(&OptionalHeader::sizeof_heap_commit), - "The size of the local heap space to commit.") - - .def_property("loader_flags", - static_cast>(&OptionalHeader::loader_flags), - static_cast>(&OptionalHeader::loader_flags), - "According to the PE specifications, this value is *reserved* and **should** be 0.") - - .def_property("numberof_rva_and_size", - static_cast>(&OptionalHeader::numberof_rva_and_size), - static_cast>(&OptionalHeader::numberof_rva_and_size), - "The number of " RST_CLASS_REF(lief.PE.DataDirectory) " that follow this header") - - .def("__eq__", &OptionalHeader::operator==) - .def("__ne__", &OptionalHeader::operator!=) - .def("__hash__", - [] (const OptionalHeader& optional_header) { - return Hash::hash(optional_header); - }) - - .def(py::self += DLL_CHARACTERISTICS()) - .def(py::self -= DLL_CHARACTERISTICS()) - - .def("__contains__", - static_cast(&OptionalHeader::has), - "Check if the given " RST_CLASS_REF(lief.PE.DLL_CHARACTERISTICS) " is present") - - .def("__str__", [] (const OptionalHeader& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyParser.cpp b/vendor/lief/api/python/PE/objects/pyParser.cpp deleted file mode 100644 index 424feec..0000000 --- a/vendor/lief/api/python/PE/objects/pyParser.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/Parser.hpp" - -#include - -namespace LIEF { -namespace PE { - -template<> -void create(py::module& m) { - - m.def("parse", - static_cast (*) (const std::string&)>(&Parser::parse), - "Parse the PE binary from the given **file path** and return a " RST_CLASS_REF(lief.PE.Binary) " object", - "filename"_a, - py::return_value_policy::take_ownership); - - m.def("parse", - static_cast (*) (std::vector, const std::string&)>(&Parser::parse), - "Parse the PE binary from the given **list of bytes** and return a :class:`lief.PE.Binary` object", - "raw"_a, "name"_a = "", - py::return_value_policy::take_ownership); - - - m.def("parse", - [] (py::object byteio, const std::string& name) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str)) - }; - - return LIEF::PE::Parser::parse(std::move(raw), name); - }, - "Parse the PE binary from the given Python IO interface and return a :class:`lief.PE.Binary` object", - "io"_a, "name"_a = "", - py::return_value_policy::take_ownership); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyPogo.cpp b/vendor/lief/api/python/PE/objects/pyPogo.cpp deleted file mode 100644 index 793575d..0000000 --- a/vendor/lief/api/python/PE/objects/pyPogo.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/Pogo.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Pogo::*)(void) const; - -template -using setter_t = void (Pogo::*)(T); - -template -using no_const_getter = T (Pogo::*)(void); - -template<> -void create(py::module& m) { - py::class_ pogo(m, "Pogo"); - - init_ref_iterator(pogo, "it_entries"); - - pogo - .def(py::init<>()) - - .def_property_readonly("entries", - static_cast>(&Pogo::entries), - py::return_value_policy::reference_internal) - - .def_property_readonly("signature", - static_cast>(&Pogo::signature), - "Type of the pogo (" RST_CLASS_REF(lief.PE.POGO_SIGNATURES) ")") - - - .def("__eq__", &Pogo::operator==) - .def("__ne__", &Pogo::operator!=) - .def("__hash__", - [] (const Pogo& pogo_entry) { - return Hash::hash(pogo_entry); - }) - - .def("__str__", [] (const Pogo& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyPogoEntry.cpp b/vendor/lief/api/python/PE/objects/pyPogoEntry.cpp deleted file mode 100644 index c782e5f..0000000 --- a/vendor/lief/api/python/PE/objects/pyPogoEntry.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/PogoEntry.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (PogoEntry::*)(void) const; - -template -using setter_t = void (PogoEntry::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "PogoEntry") - .def(py::init<>()) - - .def_property("name", - [] (const PogoEntry& obj) { - return safe_string_converter(obj.name()); - }, - static_cast>(&PogoEntry::name)) - - .def_property("start_rva", - static_cast>(&PogoEntry::start_rva), - static_cast>(&PogoEntry::start_rva)) - - .def_property("size", - static_cast>(&PogoEntry::size), - static_cast>(&PogoEntry::size)) - - - .def("__eq__", &PogoEntry::operator==) - .def("__ne__", &PogoEntry::operator!=) - .def("__hash__", - [] (const PogoEntry& pogo_entry) { - return Hash::hash(pogo_entry); - }) - - .def("__str__", [] (const PogoEntry& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyRelocation.cpp b/vendor/lief/api/python/PE/objects/pyRelocation.cpp deleted file mode 100644 index 7bb4f1f..0000000 --- a/vendor/lief/api/python/PE/objects/pyRelocation.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/Relocation.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Relocation::*)(void) const; - -template -using setter_t = void (Relocation::*)(T); - -template -using it_t = T (Relocation::*)(void); - -template<> -void create(py::module& m) { - py::class_ reloc(m, "Relocation", - R"delim( - Class which represents the *Base Relocation Block* - Usually, we find this structure in the ``.reloc`` section - )delim"); - - init_ref_iterator(reloc, "it_entries"); - - reloc - .def(py::init<>()) - - .def_property("virtual_address", - static_cast>(&Relocation::virtual_address), - static_cast>(&Relocation::virtual_address), - "The RVA for which the offset of the relocation entries (RelocationEntry) is added") - - .def_property("block_size", - static_cast>(&Relocation::block_size), - static_cast>(&Relocation::block_size), - R"delim( - The total number of bytes in the base relocation block. - ``block_size = sizeof(BaseRelocationBlock) + nb_of_relocs * sizeof(uint16_t = RelocationEntry)`` - )delim") - - .def_property_readonly("entries", - static_cast>(&Relocation::entries), - "Iterator over the " RST_CLASS_REF(lief.PE.RelocationEntry) "") - - .def("add_entry", - &Relocation::add_entry, - "Add a new " RST_CLASS_REF(lief.PE.RelocationEntry) "", - "new_entry"_a) - - - .def("__eq__", &Relocation::operator==) - .def("__ne__", &Relocation::operator!=) - .def("__hash__", - [] (const Relocation& relocation) { - return Hash::hash(relocation); - }) - - .def("__str__", [] (const Relocation& relocation) - { - std::ostringstream stream; - stream << relocation; - std::string str = stream.str(); - return str; - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/pyRelocationEntry.cpp b/vendor/lief/api/python/PE/objects/pyRelocationEntry.cpp deleted file mode 100644 index 671b04b..0000000 --- a/vendor/lief/api/python/PE/objects/pyRelocationEntry.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/RelocationEntry.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (RelocationEntry::*)(void) const; - -template -using setter_t = void (RelocationEntry::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "RelocationEntry", - R"delim( - Class which represents an entry of the PE relocation table. - - It extends the :class:`lief.Relocation` object to provide an uniform API across the file formats - )delim") - .def(py::init<>()) - - .def_property("data", - static_cast>(&RelocationEntry::data), - static_cast>(&RelocationEntry::data), - R"delim( - Raw data of the relocation: - - * The **high** 4 bits store the relocation :attr:`~lief.PE.RelocationEntry.type` - * The **low** 12 bits store the relocation offset (:attr:`~lief.PE.RelocationEntry.position`) - )delim") - - .def_property("position", - static_cast>(&RelocationEntry::position), - static_cast>(&RelocationEntry::position), - "Offset - relative to :attr:`~lief.PE.Relocation.virtual_address` - where the relocation occurs") - - .def_property("type", - static_cast>(&RelocationEntry::type), - static_cast>(&RelocationEntry::type), - "Type of the relocation (see: " RST_CLASS_REF(lief.PE.RELOCATIONS_BASE_TYPES) ")") - - - .def("__eq__", &RelocationEntry::operator==) - .def("__ne__", &RelocationEntry::operator!=) - .def("__hash__", - [] (const RelocationEntry& relocation_entry) { - return Hash::hash(relocation_entry); - }) - - .def("__str__", [] (const RelocationEntry& relocation) - { - std::ostringstream stream; - stream << relocation; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyResourceData.cpp b/vendor/lief/api/python/PE/objects/pyResourceData.cpp deleted file mode 100644 index cf6031c..0000000 --- a/vendor/lief/api/python/PE/objects/pyResourceData.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/ResourceData.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceData::*)(void) const; - -template -using setter_t = void (ResourceData::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceData", - R"delim( - Class which represents a Data Node in the PE resources tree - )delim") - .def(py::init<>(), - "Default constructor") - - .def(py::init&, uint32_t>(), - "content"_a, "code_page"_a) - - .def_property("code_page", - static_cast>(&ResourceData::code_page), - static_cast>(&ResourceData::code_page), - R"delim( - Return the code page that is used to decode code point - values within the resource data. Typically, the code page is the Unicode code page. - )delim") - - .def_property("content", - static_cast&>>(&ResourceData::content), - static_cast&>>(&ResourceData::content), - "Resource content") - - .def_property("reserved", - static_cast>(&ResourceData::reserved), - static_cast>(&ResourceData::reserved), - "Reserved value. Should be ``0``") - - .def_property_readonly("offset", - &ResourceData::offset, - R"delim( - Offset of the content within the resource - - .. warning:: - - This value can change when re-building the resource table - )delim") - - .def("__eq__", &ResourceData::operator==) - .def("__ne__", &ResourceData::operator!=) - - .def("__hash__", - [] (const ResourceData& node) { - return Hash::hash(node); - }) - - .def("__str__", - [] (const ResourceData& data) { - std::ostringstream stream; - stream << data; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyResourceDirectory.cpp b/vendor/lief/api/python/PE/objects/pyResourceDirectory.cpp deleted file mode 100644 index 648fd73..0000000 --- a/vendor/lief/api/python/PE/objects/pyResourceDirectory.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/ResourceDirectory.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceDirectory::*)(void) const; - -template -using setter_t = void (ResourceDirectory::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceDirectory") - .def(py::init<>(), - "Default constructor") - - .def_property("characteristics", - static_cast>(&ResourceDirectory::characteristics), - static_cast>(&ResourceDirectory::characteristics), - "Resource characteristics. This field is reserved for future use. " - "It is currently set to zero.") - - .def_property("time_date_stamp", - static_cast>(&ResourceDirectory::time_date_stamp), - static_cast>(&ResourceDirectory::time_date_stamp), - "The time that the resource data was created by the " - "resource compiler.") - - .def_property("major_version", - static_cast>(&ResourceDirectory::major_version), - static_cast>(&ResourceDirectory::major_version), - "The major version number, set by the user.") - - .def_property("minor_version", - static_cast>(&ResourceDirectory::minor_version), - static_cast>(&ResourceDirectory::minor_version), - "The minor version number, set by the user.") - - .def_property("numberof_name_entries", - static_cast>(&ResourceDirectory::numberof_name_entries), - static_cast>(&ResourceDirectory::numberof_name_entries), - "The number of directory entries immediately " - "following the table that use strings to identify Type, " - "Name, or Language entries (depending on the level " - "of the table") - - .def_property("numberof_id_entries", - static_cast>(&ResourceDirectory::numberof_id_entries), - static_cast>(&ResourceDirectory::numberof_id_entries), - "The number of directory entries immediately " - "following the Name entries that use numeric IDs for " - "Type, Name, or Language entries.") - - - .def("__eq__", &ResourceDirectory::operator==) - .def("__ne__", &ResourceDirectory::operator!=) - - .def("__hash__", - [] (const ResourceDirectory& node) { - return Hash::hash(node); - }) - - .def("__str__", - [] (const ResourceDirectory& directory) { - std::ostringstream stream; - stream << directory; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyResourceNode.cpp b/vendor/lief/api/python/PE/objects/pyResourceNode.cpp deleted file mode 100644 index be94d6d..0000000 --- a/vendor/lief/api/python/PE/objects/pyResourceNode.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/utils.hpp" -#include "LIEF/PE/ResourceNode.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceNode::*)(void) const; - -template -using setter_t = void (ResourceNode::*)(T); - - -template<> -void create(py::module& m) { - py::class_ res_node(m, "ResourceNode", - R"delim( - Class which represents a Node in the resource tree. - It is extended by :class:`lief.PE.ResourceData` and :class:`lief.PE.ResourceNode` - )delim"); - - init_ref_iterator(res_node, "it_childs"); - - res_node - .def_property("id", - static_cast>(&ResourceNode::id), - static_cast>(&ResourceNode::id), - "Integer that identifies the Type, Name, or " - "Language ID entry.") - - .def_property_readonly("is_directory", - &ResourceNode::is_directory, - "``True`` if the current resource is a " RST_CLASS_REF(lief.PE.ResourceDirectory) "") - - .def_property_readonly("is_data", - &ResourceNode::is_data, - "``True`` if the current resource is a " RST_CLASS_REF(lief.PE.ResourceData) "") - - .def_property_readonly("has_name", - &ResourceNode::has_name, - "``True`` if the current resource uses a name") - - .def_property("name", - [] (const ResourceNode& node) { - return safe_string_converter(LIEF::u16tou8(node.name())); - }, - static_cast(&ResourceNode::name), - "Resource's name") - - .def_property_readonly("childs", - static_cast(&ResourceNode::childs), - "Node's childs") - - .def("add_directory_node", - static_cast(&ResourceNode::add_child), - "Add a " RST_CLASS_REF(lief.PE.ResourceDirectory) " to the current node", - "resource_directory"_a, - py::return_value_policy::reference) - - .def("add_data_node", - static_cast(&ResourceNode::add_child), - "Add a " RST_CLASS_REF(lief.PE.ResourceData) " to the current node", - "resource_data"_a, - py::return_value_policy::reference) - - .def("delete_child", - static_cast(&ResourceNode::delete_child), - "Delete the given " RST_CLASS_REF(lief.PE.ResourceNode) " from childs", - "node"_a) - - .def("delete_child", - static_cast(&ResourceNode::delete_child), - "Delete the " RST_CLASS_REF(lief.PE.ResourceNode) " with the given :attr:`~lief.PE.ResourceNode.id` from childs", - "id"_a) - - .def_property_readonly("depth", - &ResourceNode::depth, - "Current depth of the entry in the resource tree") - - .def("__eq__", &ResourceNode::operator==) - .def("__ne__", &ResourceNode::operator!=) - - .def("__hash__", - [] (const ResourceNode& node) { - return Hash::hash(node); - }) - - .def("__str__", - [] (const ResourceNode& node) { - std::ostringstream stream; - stream << node; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyResourcesManager.cpp b/vendor/lief/api/python/PE/objects/pyResourcesManager.cpp deleted file mode 100644 index 4acc10f..0000000 --- a/vendor/lief/api/python/PE/objects/pyResourcesManager.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * Copyright 2017 - 2021 K. Nakagawa - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" -#include "pyErr.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/ResourcesManager.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourcesManager::*)(void) const; - -template -using setter_t = void (ResourcesManager::*)(T); - -template -using no_const_func = T (ResourcesManager::*)(P); - - -template<> -void create(py::module& m) { - py::class_ manager(m, "ResourcesManager", - "The Resource Manager provides an enhanced API to manipulate the resource tree"); - - init_ref_iterator(manager, "it_const_dialogs"); - init_ref_iterator(manager, "it_const_icons"); - init_ref_iterator(manager, "it_const_strings_table"); - init_ref_iterator(manager, "it_const_accelerators"); - - manager - .def_property_readonly("has_manifest", - &ResourcesManager::has_manifest, - "``True`` if the resources contain a Manifest element") - - .def_property("manifest", - [] (const ResourcesManager& obj) { - return safe_string_converter(obj.manifest()); - }, - static_cast>(&ResourcesManager::manifest), - "Manifest as a ``string``") - - - .def_property_readonly("has_version", - &ResourcesManager::has_version, - "``true`` if the resources contain a " RST_CLASS_REF(lief.PE.ResourceVersion) "") - - .def_property_readonly("version", - [] (ResourcesManager& self) { - return error_or(&ResourcesManager::version, self); - }, - "Return the " RST_CLASS_REF(lief.PE.ResourceVersion) "") - - .def_property_readonly("has_icons", - &ResourcesManager::has_icons, - "``true`` if the resources contain " RST_CLASS_REF(lief.PE.ResourceIcon) "") - - .def_property_readonly("icons", - &ResourcesManager::icons, - "Return the list of the " RST_CLASS_REF(lief.PE.ResourceIcon) " present in the resource") - - .def("change_icon", - &ResourcesManager::change_icon, - "Switch the given icons", - "old_one"_a, "new_one"_a) - - .def_property_readonly("has_dialogs", - &ResourcesManager::has_dialogs, - "``true`` if the resources contain " RST_CLASS_REF(lief.PE.ResourceDialog) "") - - .def_property_readonly("dialogs", - &ResourcesManager::dialogs, - "Return the list of the " RST_CLASS_REF(lief.PE.ResourceDialog) " present in the resource") - - .def_property_readonly("types_available", - &ResourcesManager::get_types_available, - "Return list of " RST_CLASS_REF(lief.PE.RESOURCE_TYPES) " present in the resources") - - .def_property_readonly("langs_available", - &ResourcesManager::get_langs_available, - "Return list of " RST_CLASS_REF(lief.PE.RESOURCE_LANGS) " present in the resources") - - .def_property_readonly("sublangs_available", - &ResourcesManager::get_sublangs_available, - "Return list of " RST_CLASS_REF(lief.PE.RESOURCE_SUBLANGS) " present in the resources") - - .def("add_icon", - &ResourcesManager::add_icon, - "Add an icon to the resources", - "icon"_a) - - .def("has_type", - &ResourcesManager::has_type, - "``True`` if the resource has the given " RST_CLASS_REF(lief.PE.RESOURCE_TYPES) "", - "type"_a) - - .def_property_readonly("has_string_table", - &ResourcesManager::has_string_table, - "``True`` if resources contain " RST_CLASS_REF(lief.PE.ResourceStringTable) "") - - .def_property_readonly("string_table", - &ResourcesManager::string_table, - "Return list of " RST_CLASS_REF(lief.PE.ResourceStringTable) " present in the resource") - - .def_property_readonly("has_html", - &ResourcesManager::has_html, - "``True`` if resources contain HTML resource") - - .def_property_readonly("html", - &ResourcesManager::html, - "HTML resource as the list of ``string``") - - .def_property_readonly("has_accelerator", - &ResourcesManager::has_accelerator, - "``True`` if resources contain " RST_CLASS_REF(lief.PE.ResourceAccelerator) "") - - .def_property_readonly("accelerator", - &ResourcesManager::accelerator, - "Return list of " RST_CLASS_REF(lief.PE.ResourceAccelerator) " present in the resource") - - .def("get_node_type", - static_cast>(&ResourcesManager::get_node_type), - R"delim( - Return :class:`~lief.PE.ResourceNode` with the given :class:`~lief.PE.RESOURCE_TYPES` - or None if not found. - )delim", - "type"_a, - py::return_value_policy::reference) - - .def("__str__", - [] (const ResourcesManager& manager) { - std::ostringstream stream; - stream << manager; - std::string str = stream.str(); - return str; - }); -} -} -} - diff --git a/vendor/lief/api/python/PE/objects/pyRichEntry.cpp b/vendor/lief/api/python/PE/objects/pyRichEntry.cpp deleted file mode 100644 index cd0ad2c..0000000 --- a/vendor/lief/api/python/PE/objects/pyRichEntry.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/RichEntry.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (RichEntry::*)(void) const; - -template -using setter_t = void (RichEntry::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "RichEntry", - R"delim( - Class which represents an entry associated to the RichHeader - )delim") - .def(py::init<>()) - .def(py::init(), - "Contructor from " - ":attr:`~lief.PE.RichEntry.id`, " - ":attr:`~lief.PE.RichEntry.build_id` and " - ":attr:`~lief.PE.RichEntry.count`", - "id"_a, "build_id"_a, "count"_a) - - .def_property("id", - static_cast>(&RichEntry::id), - static_cast>(&RichEntry::id), - "Type of the entry") - - .def_property("build_id", - static_cast>(&RichEntry::build_id), - static_cast>(&RichEntry::build_id), - "Builder number of the tool (if any)") - - .def_property("count", - static_cast>(&RichEntry::count), - static_cast>(&RichEntry::count), - "*Occurrence* count") - - .def("__eq__", &RichEntry::operator==) - .def("__ne__", &RichEntry::operator!=) - .def("__hash__", - [] (const RichEntry& entry) { - return Hash::hash(entry); - }) - - .def("__str__", [] (const RichEntry& entry) - { - std::ostringstream stream; - stream << entry; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyRichHeader.cpp b/vendor/lief/api/python/PE/objects/pyRichHeader.cpp deleted file mode 100644 index c398a32..0000000 --- a/vendor/lief/api/python/PE/objects/pyRichHeader.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/RichHeader.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (RichHeader::*)(void) const; - -template -using setter_t = void (RichHeader::*)(T); - -template -using no_const_getter = T (RichHeader::*)(void); - - -template<> -void create(py::module& m) { - py::class_ rich(m, "RichHeader", - R"delim( - Class which represents the not-so-documented rich header - - This structure is usually located at the end of the :attr:`~lief.PE.Binary.dos_stub` - and contains information about the build environment. - - It is generated by the Microsoft linker `link.exe` and there are no options to disable - or remove this information. - )delim"); - - init_ref_iterator(rich, "it_entries"); - - rich - .def(py::init<>()) - .def_property("key", - static_cast>(&RichHeader::key), - static_cast>(&RichHeader::key), - "Key used to encode the header (xor operation)") - - .def_property_readonly("entries", - static_cast>(&RichHeader::entries), - "Return an iterator over the " RST_CLASS_REF(lief.PE.RichEntry) " within the header", - py::return_value_policy::reference) - - .def("add_entry", - static_cast(&RichHeader::add_entry), - "Add a new " RST_CLASS_REF(lief.PE.RichEntry) "", - "entry"_a) - - .def("add_entry", - static_cast(&RichHeader::add_entry), - "Add a new " RST_CLASS_REF(lief.PE.RichEntry) " given its " - ":attr:`~lief.PE.RichEntry.id`, " - ":attr:`~lief.PE.RichEntry.build_id`, " - ":attr:`~lief.PE.RichEntry.count`", - "id"_a, "build_id"_a, "count"_a) - - .def("raw", - py::overload_cast<>(&RichHeader::raw, py::const_), - R"delim( - The raw structure of the Rich header without xor-encoding. - - This function is equivalent as calling the other raw function with a `xor_key` set to 0 - )delim") - - .def("raw", - py::overload_cast(&RichHeader::raw, py::const_), - R"delim( - Given this rich header, this function re-computes - the raw bytes of the structure with the provided xor-key. - - You can access the decoded data's structure with the `xor_key` set to 0 - )delim", - "xor_key"_a) - - .def("hash", - py::overload_cast(&RichHeader::hash, py::const_), - R"delim( - Compute the hash of the decoded rich header structure with the given hash :class:`~lief.PE.ALGORITHMS` - )delim", - "algo"_a) - - .def("hash", - py::overload_cast(&RichHeader::hash, py::const_), - R"delim( - Compute the hash of the rich header structure encoded with the provided key and the given hash - :class:`~lief.PE.ALGORITHMS` - )delim", - "algo"_a, "xor_key"_a) - - .def("__eq__", &RichHeader::operator==) - .def("__ne__", &RichHeader::operator!=) - .def("__hash__", - [] (const RichHeader& rich_header) { - return Hash::hash(rich_header); - }) - - .def("__str__", [] (const RichHeader& rich_header) - { - std::ostringstream stream; - stream << rich_header; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pySection.cpp b/vendor/lief/api/python/PE/objects/pySection.cpp deleted file mode 100644 index 446d354..0000000 --- a/vendor/lief/api/python/PE/objects/pySection.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/Abstract/Section.hpp" -#include "LIEF/PE/Section.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Section::*)(void) const; - -template -using setter_t = void (Section::*)(T); - - -template<> -void create
(py::module& m) { - py::class_(m, "Section", - R"delim( - Class which represents a PE section. - - It extends the base class :class:`lief.Section` - )delim") - .def(py::init<>()) - .def(py::init&, const std::string&, uint32_t>(), - "Constructor from " - ":attr:`~lief.PE.Section.content`, " - ":attr:`~lief.PE.Section.name` and " - ":attr:`~lief.PE.Section.characteristics`", - "content"_a, py::arg("name") = "", py::arg("characteristics") = 0) - - .def(py::init(), - "Constructor from a " - ":attr:`~lief.PE.Section.name`", - "name"_a) - - .def_property("virtual_size", - static_cast>(&Section::virtual_size), - static_cast>(&Section::virtual_size), - R"delim( - The total size of the section when loaded into memory. - - If this value is greater than :attr:`~lief.PE.Section.sizeof_raw_data`, the section is zero-padded. - )delim") - - .def_property("sizeof_raw_data", - static_cast>(&Section::sizeof_raw_data), - static_cast>(&Section::sizeof_raw_data), - "Alias of :attr:`~lief.PE.Section.size` (size of the data in the section)") - - .def_property("pointerto_raw_data", - static_cast>(&Section::pointerto_raw_data), - static_cast>(&Section::pointerto_raw_data), - "The offset of the section data in the PE file. Alias of :attr:`~lief.PE.Section.offset`") - - .def_property("pointerto_relocation", - static_cast>(&Section::pointerto_relocation), - static_cast>(&Section::pointerto_relocation), - R"delim( - The file pointer to the beginning of the COFF relocation entries for the section. This is set to zero for - executable images or if there are no relocations. - - For modern PE binaries, this value is usually set to 0 as the relocations are managed by - :class:`~lief.PE.Relocation`. - )delim") - - .def_property("pointerto_line_numbers", - static_cast>(&Section::pointerto_line_numbers), - static_cast>(&Section::pointerto_line_numbers), - R"delim( - The file pointer to the beginning of line-number entries for the section. - This is set to zero if there are no COFF line numbers. This value should be zero for an image because COFF - debugging information is deprecated and modern debug information relies on the PDB files. - )delim") - - .def_property("numberof_relocations", - static_cast>(&Section::numberof_relocations), - static_cast>(&Section::numberof_relocations), - R"delim( - The number of relocation entries for the section. - - See: :attr:`~lief.PE.Section.pointerto_relocation` - )delim") - - .def_property("numberof_line_numbers", - static_cast>(&Section::numberof_line_numbers), - static_cast>(&Section::numberof_line_numbers), - R"delim( - The number of line-number entries for the section. - This value should be zero for an image because COFF debugging information is - deprecated. - - See: :attr:`~lief.PE.Section.pointerto_line_numbers` - )delim") - - - .def_property("characteristics", - static_cast>(&Section::characteristics), - static_cast>(&Section::characteristics), - "The " RST_CLASS_REF(lief.PE.SECTION_CHARACTERISTICS) " that describe the characteristics of the section") - - .def_property_readonly("characteristics_lists", - &Section::characteristics_list, - ":attr:`~lief.PE.Section.characteristics` as a ``list``") - - .def("has_characteristic", - &Section::has_characteristic, - "``True`` if the section has the given " RST_CLASS_REF(lief.PE.SECTION_CHARACTERISTICS) "", - "characteristic"_a) - - .def_property_readonly("padding", - [] (const Section& sec) { - const std::vector& data = sec.padding(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Section padding content as bytes") - - .def("__eq__", &Section::operator==) - .def("__ne__", &Section::operator!=) - .def("__hash__", - [] (const Section& section) { - return Hash::hash(section); - }) - - .def("__str__", - [] (const Section& section) { - std::ostringstream stream; - stream << section; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pySymbol.cpp b/vendor/lief/api/python/PE/objects/pySymbol.cpp deleted file mode 100644 index 2f4ef12..0000000 --- a/vendor/lief/api/python/PE/objects/pySymbol.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/Symbol.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Symbol::*)(void) const; - -template -using setter_t = void (Symbol::*)(T); - -template -using no_const_getter = T (Symbol::*)(void); - - -template<> -void create(py::module& m) { - py::class_(m, "Symbol") - .def(py::init<>()) - - .def_property("name", - static_cast> (&Symbol::wname), - static_cast>(&Symbol::name)) - - .def_property_readonly("section_number", - &Symbol::section_number) - - .def_property_readonly("type", - &Symbol::type) - - .def_property_readonly("base_type", - &Symbol::base_type) - - .def_property_readonly("complex_type", - &Symbol::complex_type) - - .def_property_readonly("storage_class", - &Symbol::storage_class) - - .def_property_readonly("numberof_aux_symbols", - &Symbol::numberof_aux_symbols) - - .def_property_readonly("section", - static_cast>(&Symbol::section), - py::return_value_policy::reference) - - .def_property_readonly("has_section", - &Symbol::has_section, - "``True`` if symbols are located in a section") - - .def("__eq__", &Symbol::operator==) - .def("__ne__", &Symbol::operator!=) - .def("__hash__", - [] (const Symbol& symbol) { - return Hash::hash(symbol); - }) - - - .def("__str__", [] (const Symbol& symbol) - { - std::ostringstream stream; - stream << symbol; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/pyTLS.cpp b/vendor/lief/api/python/PE/objects/pyTLS.cpp deleted file mode 100644 index 1cabb43..0000000 --- a/vendor/lief/api/python/PE/objects/pyTLS.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/TLS.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (TLS::*)(void) const; - -template -using setter_t = void (TLS::*)(T); - -template -using no_const_getter = T (TLS::*)(void); - - -template<> -void create(py::module& m) { - py::class_(m, "TLS", - R"delim( - Class which represents the PE Thread Local Storage. - This PE structure is also used to implement binary/library constructors. - )delim") - .def(py::init<>(), - "Default constructor") - - .def_property("callbacks", - static_cast&>>(&TLS::callbacks), - static_cast&>>(&TLS::callbacks), - R"delim( - List of the callback associated with the current TLS. - - These functions are called before any other functions of the PE binary. - )delim") - - .def_property("addressof_index", - static_cast>(&TLS::addressof_index), - static_cast>(&TLS::addressof_index), - R"delim( - The location to receive the TLS index, which the loader assigns. - This location is in an ordinary data section, so it can be given a symbolic name that is accessible - to the program. - )delim") - - .def_property("addressof_callbacks", - static_cast>(&TLS::addressof_callbacks), - static_cast>(&TLS::addressof_callbacks), - R"delim( - The pointer to an array of TLS callback functions. - - The array is null-terminated, so if no callback function - is supported, this field points to 4 bytes set to zero. - - See: :attr:`~lief.PE.TLS.callbacks` - )delim") - - .def_property("sizeof_zero_fill", - static_cast>(&TLS::sizeof_zero_fill), - static_cast>(&TLS::sizeof_zero_fill), - R"delim( - The size in bytes of the template, beyond the initialized data delimited by - the :attr:`~lief.PE.TLS.addressof_raw_data` fields. - The total template size should be the same as the total size of TLS data in the image file. - The zero fill is the amount of data that comes after the initialized nonzero data. - )delim") - - - .def_property("characteristics", - static_cast>(&TLS::characteristics), - static_cast>(&TLS::characteristics), - R"delim( - The four bits [23:20] describe alignment info. - Possible values are those defined as IMAGE_SCN_ALIGN_*, which are also used to - describe alignment of section in object files. The other 28 bits are reserved for future use. - )delim") - - .def_property("addressof_raw_data", - static_cast>>(&TLS::addressof_raw_data), - static_cast>>(&TLS::addressof_raw_data), - R"delim( - Tuple ``(start address, end address)`` of the TLS template. - The template is a block of data that is used to initialize TLS data. - The system copies all of this data each time a thread is created, so it must not be - corrupted. - - .. note:: - - These addresses are not RVA. It is addresses for which there should be a base - relocation in the ``.reloc`` section. - )delim") - - .def_property("data_template", - static_cast&>>(&TLS::data_template), - static_cast&>>(&TLS::data_template), - "The data template content") - - .def_property_readonly("has_section", - &TLS::has_section, - "``True`` if there is a " RST_CLASS_REF(lief.PE.Section) " associated with the TLS object") - - .def_property_readonly("has_data_directory", - &TLS::has_data_directory, - "``True`` if there is a " RST_CLASS_REF(lief.PE.DataDirectory) " associated with the TLS object") - - .def_property_readonly("directory", - static_cast>(&TLS::directory), - "" RST_CLASS_REF(lief.PE.DataDirectory) " associated with the TLS object (or None if not linked)", - py::return_value_policy::reference) - - .def_property_readonly("section", - static_cast>(&TLS::section), - "" RST_CLASS_REF(lief.PE.Section) " associated with the TLS object (or None if not linked)", - py::return_value_policy::reference) - - - .def("__eq__", &TLS::operator==) - .def("__ne__", &TLS::operator!=) - .def("__hash__", - [] (const TLS& tls) { - return Hash::hash(tls); - }) - - .def("__str__", [] (const TLS& tls) - { - std::ostringstream stream; - stream << tls; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/resources/pyLangCodeItem.cpp b/vendor/lief/api/python/PE/objects/resources/pyLangCodeItem.cpp deleted file mode 100644 index 6e013f7..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyLangCodeItem.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/LangCodeItem.hpp" - -#include -#include - - -namespace LIEF { -namespace PE { - -template -using getter_t = T (LangCodeItem::*)(void) const; - -template -using setter_t = void (LangCodeItem::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "LangCodeItem", - R"delim( - Class which represents the childs of the :class:`~lief.PE.ResourceStringFileInfo` - - See: https://docs.microsoft.com/en-us/windows/win32/menurc/stringtable - )delim") - - .def_property("type", - static_cast>(&LangCodeItem::type), - static_cast>(&LangCodeItem::type), - R"delim( - The type of data in the version resource - - * ``1`` if it contains text data - * ``0`` if it contains binary data - )delim") - - .def_property("key", - static_cast>(&LangCodeItem::key), - static_cast>(&LangCodeItem::key), - R"delim( - A 8-digit hexadecimal number stored as an Unicode string - - * The four most significant digits represent the language identifier. - * The four least significant digits represent the code page for which the data is formatted. - - See: - - * :attr:`~lief.PE.LangCodeItem.code_page` - * :attr:`~lief.PE.LangCodeItem.lang` - * :attr:`~lief.PE.LangCodeItem.sublang` - - )delim") - - .def_property("lang", - static_cast>(&LangCodeItem::lang), - static_cast>(&LangCodeItem::lang), - "Lang (" RST_CLASS_REF(lief.PE.RESOURCE_LANGS) ") for which " - ":attr:`~lief.PE.LangCodeItem.items` are defined") - - .def_property("sublang", - static_cast>(&LangCodeItem::sublang), - static_cast>(&LangCodeItem::sublang), - "Sub-lang (" RST_CLASS_REF(lief.PE.RESOURCE_SUBLANGS) ") for which " - ":attr:`~lief.PE.LangCodeItem.items` are defined") - - .def_property("code_page", - static_cast>(&LangCodeItem::code_page), - static_cast>(&LangCodeItem::code_page), - R"delim( - :class:`~lief.PE.CODE_PAGES` for which :attr:`~lief.PE.LangCodeItem.items` are defined. - - See: https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers - )delim") - - .def_property("items", - [] (const LangCodeItem& item) -> py::dict { - py::dict output; - for (const auto& p : item.items()) { - output[u16tou8(p.first).c_str()] = py::bytes(u16tou8(p.second)); - } - return output; - }, - static_cast>(&LangCodeItem::items)) - - - .def("__eq__", &LangCodeItem::operator==) - .def("__ne__", &LangCodeItem::operator!=) - .def("__hash__", - [] (const LangCodeItem& item) { - return Hash::hash(item); - }) - - .def("__str__", - [] (const LangCodeItem& item) { - std::ostringstream stream; - stream << item; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceAccelerator.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceAccelerator.cpp deleted file mode 100644 index e396ecf..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceAccelerator.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * Copyright 2017 - 2021 K. Nakagawa - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceAccelerator.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceAccelerator::*)(void) const; - -template -using setter_t = void (ResourceAccelerator::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceAccelerator") - - .def_property_readonly("flags", - static_cast>(&ResourceAccelerator::flags), - "Describe the keyboard accelerator characteristics.") - - .def_property_readonly("ansi", - static_cast>(&ResourceAccelerator::ansi), - "An ANSI character value or a virtual-key code that identifies the accelerator key.") - - .def_property_readonly("id", - static_cast>(&ResourceAccelerator::id), - "An identifier for the keyboard accelerator.") - - .def_property_readonly("padding", - static_cast>(&ResourceAccelerator::padding), - "The number of bytes inserted to ensure that the structure is aligned on a DWORD boundary.") - - .def("__eq__", &ResourceAccelerator::operator==) - .def("__ne__", &ResourceAccelerator::operator!=) - .def("__hash__", - [] (const ResourceAccelerator& acc) { - return Hash::hash(acc); - }) - - .def("__str__", - [] (const ResourceAccelerator& acc) { - std::ostringstream stream; - stream << acc; - return stream.str(); - }); -} -} -} diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceDialog.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceDialog.cpp deleted file mode 100644 index 45922e7..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceDialog.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyIterators.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceDialog.hpp" - -#include -#include - - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceDialog::*)(void) const; - -template -using setter_t = void (ResourceDialog::*)(T); - - -template<> -void create(py::module& m) { - py::class_ dialog(m, "ResourceDialog", - R"delim( - Representation of a dialog box. - - Windows allows two kinds of dialog box: - - * Simple one - * Extended one - - :attr:`~lief.PE.ResourceDialog.is_extended` can be used to determine which one is implemented - )delim"); - - init_ref_iterator(dialog, "it_const_items"); - - dialog - .def_property_readonly("is_extended", - &ResourceDialog::is_extended, - "``True`` if the dialog is an extended one") - - .def_property_readonly("version", - &ResourceDialog::version, - "The version number of the extended dialog box template. This member must be set to 1.") - - .def_property_readonly("signature", - &ResourceDialog::signature, - R"delim( - Indicate whether a template is an extended dialog box template: - - * ``0xFFFF``: Extended dialog box template - * Other value: Standard dialog box template - )delim") - - .def_property_readonly("help_id", - &ResourceDialog::version, - "The help context identifier for the dialog box window") - - .def_property_readonly("x", - static_cast>(&ResourceDialog::x), - "The x-coordinate, in dialog box units, of the upper-left corner of the dialog box.") - - .def_property_readonly("y", - static_cast>(&ResourceDialog::y), - "The y-coordinate, in dialog box units, of the upper-left corner of the dialog box.") - - .def_property_readonly("cx", - static_cast>(&ResourceDialog::cx), - "The width, in dialog box units, of the dialog box.") - - .def_property_readonly("cy", - static_cast>(&ResourceDialog::cy), - "The height, in dialog box units, of the dialog box.") - - .def_property_readonly("title", - static_cast>(&ResourceDialog::title), - "The title of the dialog box") - - .def_property_readonly("typeface", - static_cast>(&ResourceDialog::typeface), - "The name of the typeface for the font") - - .def_property_readonly("weight", - static_cast>(&ResourceDialog::weight), - "The weight of the font") - - .def_property_readonly("point_size", - static_cast>(&ResourceDialog::point_size), - "The point size of the font to use for the text in the dialog box and its controls.") - - .def_property_readonly("charset", - static_cast>(&ResourceDialog::charset), - "The character set to be used") - - .def_property_readonly("style_list", - &ResourceDialog::style_list, - "Return list of " RST_CLASS_REF(lief.PE.WINDOW_STYLES) " associated with the " - ":attr:`~lief.PE.ResourceDialog.style` member") - - .def_property_readonly("dialogbox_style_list", - &ResourceDialog::dialogbox_style_list, - "Return list of " RST_CLASS_REF(lief.PE.DIALOG_BOX_STYLES) " associated with the " - ":attr:`~lief.PE.ResourceDialog.style` member") - - .def_property_readonly("extended_style_list", - &ResourceDialog::dialogbox_style_list, - "Return list of " RST_CLASS_REF(lief.PE.EXTENDED_WINDOW_STYLES) " associated with the " - ":attr:`~lief.PE.ResourceDialog.extended_style` member") - - .def_property_readonly("style", - &ResourceDialog::extended_style, - "The style of the dialog box. This member can be a combination of " - RST_CLASS_REF(lief.PE.WINDOW_STYLES) " and " RST_CLASS_REF(lief.PE.DIALOG_BOX_STYLES) "") - - .def_property_readonly("extended_style", - &ResourceDialog::extended_style, - "The extended windows styles (" RST_CLASS_REF(lief.PE.EXTENDED_WINDOW_STYLES) ")") - - .def_property_readonly("items", - &ResourceDialog::items, - "Iterator over the controls (" RST_CLASS_REF(lief.PE.ResourceDialogItem) ") that defines the Dialog (Button, Label...)") - - .def("has_style", - &ResourceDialog::has_style, - "Check if the :attr:`~lief.PE.ResourceDialog.style` member has the given " - "" RST_CLASS_REF(lief.PE.WINDOW_STYLES) "", - "style"_a) - - .def("has_dialogbox_style", - &ResourceDialog::has_dialogbox_style, - "Check if the :attr:`~lief.PE.ResourceDialog.style` member has the given " - "" RST_CLASS_REF(lief.PE.DIALOG_BOX_STYLES) "", - "style"_a) - - .def("has_extended_style", - &ResourceDialog::has_extended_style, - "Check if the :attr:`~lief.PE.ResourceDialog.extended_style` member has the given " - "" RST_CLASS_REF(lief.PE.EXTENDED_WINDOW_STYLES) "", - "style"_a) - - .def_property("lang", - static_cast>(&ResourceDialog::lang), - static_cast>(&ResourceDialog::lang), - "Primary " RST_CLASS_REF(lief.PE.RESOURCE_LANGS) " associated with the dialog") - - .def_property("sub_lang", - static_cast>(&ResourceDialog::sub_lang), - static_cast>(&ResourceDialog::sub_lang), - "Secondary " RST_CLASS_REF(lief.PE.RESOURCE_SUBLANGS) " associated with the dialog") - - .def("__eq__", &ResourceDialog::operator==) - .def("__ne__", &ResourceDialog::operator!=) - .def("__hash__", - [] (const ResourceDialog& dialog) { - return Hash::hash(dialog); - }) - - .def("__str__", - [] (const ResourceDialog& dialog) { - std::ostringstream stream; - stream << dialog; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceDialogItem.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceDialogItem.cpp deleted file mode 100644 index 23f58ca..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceDialogItem.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceDialogItem.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceDialogItem::*)(void) const; - -template -using setter_t = void (ResourceDialogItem::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceDialogItem", - R"delim( - This class represents an item in the :class:`lief.PE.ResourceDialog` - )delim") - - .def_property_readonly("is_extended", - &ResourceDialogItem::is_extended, - "``True`` if the control is an extended one") - - .def_property_readonly("help_id", - static_cast>(&ResourceDialogItem::help_id), - "The help context identifier for the control") - - .def_property_readonly("extended_style", - static_cast>(&ResourceDialogItem::extended_style), - "The extended styles for the window") - - .def_property_readonly("style", - static_cast>(&ResourceDialogItem::style), - "The style of the control. This member can be a combination of " - "" RST_CLASS_REF(lief.PE.WINDOW_STYLES) " values " - "and one or more of the control style values.") - - .def_property_readonly("x", - static_cast>(&ResourceDialogItem::x), - "The x-coordinate, in dialog box units, of the upper-left corner of the control") - - .def_property_readonly("y", - static_cast>(&ResourceDialogItem::y), - "The y-coordinate, in dialog box units, of the upper-left corner of the control") - - .def_property_readonly("cx", - static_cast>(&ResourceDialogItem::cx), - "The width, in dialog box units, of the control") - - .def_property_readonly("cy", - static_cast>(&ResourceDialogItem::cy), - "The height, in dialog box units, of the control") - - .def_property_readonly("id", - static_cast>(&ResourceDialogItem::id), - "The control identifier") - - .def_property_readonly("title", - static_cast>(&ResourceDialogItem::title), - "Initial text of the control") - - .def("__eq__", &ResourceDialogItem::operator==) - .def("__ne__", &ResourceDialogItem::operator!=) - .def("__hash__", - [] (const ResourceDialogItem& dialog) { - return Hash::hash(dialog); - }) - - .def("__str__", - [] (const ResourceDialogItem& dialog_item) { - std::ostringstream stream; - stream << dialog_item; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceFixedFileInfo.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceFixedFileInfo.cpp deleted file mode 100644 index 9f43094..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceFixedFileInfo.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceFixedFileInfo.hpp" - -#include -#include - - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceFixedFileInfo::*)(void) const; - -template -using setter_t = void (ResourceFixedFileInfo::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceFixedFileInfo", - R"delim( - Representation of the `VS_FIXEDFILEINFO `_ - structure - )delim") - - .def_property("signature", - static_cast>(&ResourceFixedFileInfo::signature), - static_cast>(&ResourceFixedFileInfo::signature), - "Must be set to ``0xFEEF04BD``") - - .def_property("struct_version", - static_cast>(&ResourceFixedFileInfo::struct_version), - static_cast>(&ResourceFixedFileInfo::struct_version), - R"delim( - The binary version number of this structure. - - * The high-order word of this member contains the major version number. - * The low-order word contains the minor version number - )delim") - - .def_property("file_version_MS", - static_cast>(&ResourceFixedFileInfo::file_version_MS), - static_cast>(&ResourceFixedFileInfo::file_version_MS), - R"delim( - The **most** significant 32 bits of the file's binary version number - - This member is used with :attr:`~lief.PE.ResourceFixedFileInfo.file_version_LS` - to form a 64-bits value used for numeric comparisons. - )delim") - - .def_property("file_version_LS", - static_cast>(&ResourceFixedFileInfo::file_version_LS), - static_cast>(&ResourceFixedFileInfo::file_version_LS), - R"delim( - The **least** significant 32 bits of the file's binary version number - - This member is used with :attr:`~lief.PE.ResourceFixedFileInfo.file_version_MS` - to form a 64-bits value used for numeric comparisons. - )delim") - - .def_property("product_version_MS", - static_cast>(&ResourceFixedFileInfo::product_version_MS), - static_cast>(&ResourceFixedFileInfo::product_version_MS), - R"delim( - The **most** significant 32 bits of the product with which this file was distributed - - This member is used with :attr:`~lief.PE.ResourceFixedFileInfo.product_version_LS` - to form a 64-bits value used for numeric comparisons. - )delim") - - .def_property("product_version_LS", - static_cast>(&ResourceFixedFileInfo::product_version_LS), - static_cast>(&ResourceFixedFileInfo::product_version_LS), - R"delim( - The **least** significant 32 bits of the product with which this file was distributed - - This member is used with :attr:`~lief.PE.ResourceFixedFileInfo.product_version_MS` - to form a 64-bits value used for numeric comparisons. - )delim") - - .def_property("file_flags_mask", - static_cast>(&ResourceFixedFileInfo::file_flags_mask), - static_cast>(&ResourceFixedFileInfo::file_flags_mask), - R"delim( - Contains a bitmask that specifies the valid bits in :attr:`~lief.PE.ResourceFixedFileInfo.file_flags`. - A bit is valid only if it was defined when the file was created. - )delim") - - .def_property("file_flags", - static_cast>(&ResourceFixedFileInfo::file_flags), - static_cast>(&ResourceFixedFileInfo::file_flags), - "Contains a bitmask that specifies the Boolean attributes of the file (" RST_CLASS_REF(lief.PE.FIXED_VERSION_FILE_FLAGS) ")") - - .def_property("file_os", - static_cast>(&ResourceFixedFileInfo::file_os), - static_cast>(&ResourceFixedFileInfo::file_os), - "The operating system for which this file was designed (" RST_CLASS_REF(lief.PE.FIXED_VERSION_OS) ")") - - .def_property("file_type", - static_cast>(&ResourceFixedFileInfo::file_type), - static_cast>(&ResourceFixedFileInfo::file_type), - "The general type of file (" RST_CLASS_REF(lief.PE.FIXED_VERSION_FILE_TYPES) ")") - - .def_property("file_subtype", - static_cast>(&ResourceFixedFileInfo::file_subtype), - static_cast>(&ResourceFixedFileInfo::file_subtype), - "The function of the file (" RST_CLASS_REF(lief.PE.FIXED_VERSION_FILE_SUB_TYPES) ")") - - .def_property("file_date_MS", - static_cast>(&ResourceFixedFileInfo::file_date_MS), - static_cast>(&ResourceFixedFileInfo::file_date_MS), - "The **most** significant 32 bits of the file's 64-bit binary creation date and time stamp") - - .def_property("file_date_LS", - static_cast>(&ResourceFixedFileInfo::file_date_LS), - static_cast>(&ResourceFixedFileInfo::file_date_LS), - "The **least** significant 32 bits of the file's 64-bit binary creation date and time stamp") - - - .def("__eq__", &ResourceFixedFileInfo::operator==) - .def("__ne__", &ResourceFixedFileInfo::operator!=) - .def("__hash__", - [] (const ResourceFixedFileInfo& fixed_file_info) { - return Hash::hash(fixed_file_info); - }) - - .def("__str__", - [] (const ResourceFixedFileInfo& fixed_file_info) { - std::ostringstream stream; - stream << fixed_file_info; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceIcon.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceIcon.cpp deleted file mode 100644 index 3acec8c..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceIcon.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceIcon.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceIcon::*)(void) const; - -template -using setter_t = void (ResourceIcon::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceIcon") - .def_property("id", - static_cast>(&ResourceIcon::id), - static_cast>(&ResourceIcon::id), - "Id associated with the icon") - - .def_property("lang", - static_cast>(&ResourceIcon::lang), - static_cast>(&ResourceIcon::lang), - "Language (" RST_CLASS_REF(lief.PE.RESOURCE_LANGS) ") associated with the icon") - - .def_property("sublang", - static_cast>(&ResourceIcon::sublang), - static_cast>(&ResourceIcon::sublang), - "Sub language (" RST_CLASS_REF(lief.PE.RESOURCE_SUBLANGS) ") associated with the icon") - - .def_property("width", - static_cast>(&ResourceIcon::width), - static_cast>(&ResourceIcon::width), - "Width in pixels of the image") - - .def_property("height", - static_cast>(&ResourceIcon::height), - static_cast>(&ResourceIcon::height), - "Height in pixels of the image") - - .def_property("color_count", - static_cast>(&ResourceIcon::color_count), - static_cast>(&ResourceIcon::color_count), - "Number of colors in image (0 if >=8bpp)") - - .def_property("reserved", - static_cast>(&ResourceIcon::reserved), - static_cast>(&ResourceIcon::reserved), - "Reserved (must be 0)") - - .def_property("planes", - static_cast>(&ResourceIcon::planes), - static_cast>(&ResourceIcon::planes), - "Color Planes") - - .def_property("bit_count", - static_cast>(&ResourceIcon::bit_count), - static_cast>(&ResourceIcon::bit_count), - "Bits per pixel") - - .def_property("pixels", - static_cast&>>(&ResourceIcon::pixels), - static_cast&>>(&ResourceIcon::pixels)) - - .def("save", - &ResourceIcon::save, - "Save the icon to the given filepath", - "filepath"_a) - - .def("__eq__", &ResourceIcon::operator==) - .def("__ne__", &ResourceIcon::operator!=) - .def("__hash__", - [] (const ResourceIcon& icon) { - return Hash::hash(icon); - }) - - .def("__str__", - [] (const ResourceIcon& icon) { - std::ostringstream stream; - stream << icon; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceStringFileInfo.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceStringFileInfo.cpp deleted file mode 100644 index e8587cf..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceStringFileInfo.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceStringFileInfo.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceStringFileInfo::*)(void) const; - -template -using setter_t = void (ResourceStringFileInfo::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceStringFileInfo", - R"delim( - Representation of the ``StringFileInfo`` structure - - See: https://docs.microsoft.com/en-us/windows/win32/menurc/stringfileinfo - )delim") - - - .def_property("type", - static_cast>(&ResourceStringFileInfo::type), - static_cast>(&ResourceStringFileInfo::type), - R"delim( - The type of data in the version resource: - - * ``1`` if it contains text data - * ``0`` if it contains binary data - )delim") - - .def_property("key", - static_cast>(&ResourceStringFileInfo::key), - static_cast>(&ResourceStringFileInfo::key), - "Signature of the structure. Must be ``StringFileInfo``") - - .def_property("langcode_items", - static_cast& (ResourceStringFileInfo::*)(void)>(&ResourceStringFileInfo::langcode_items), - static_cast&>>(&ResourceStringFileInfo::langcode_items), - R"delim( - List of the LangCodeItem items - - Each :attr:`~lief.PE.LangCodeItem.key` indicates the appropriate language and code page - for displaying the ``key: value`` of :attr:`~lief.PE.LangCodeItem.items` - )delim") - - .def("__eq__", &ResourceStringFileInfo::operator==) - .def("__ne__", &ResourceStringFileInfo::operator!=) - .def("__hash__", - [] (const ResourceStringFileInfo& string_file_info) { - return Hash::hash(string_file_info); - }) - - .def("__str__", - [] (const ResourceStringFileInfo& string_file_info) { - std::ostringstream stream; - stream << string_file_info; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceStringTable.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceStringTable.cpp deleted file mode 100644 index 197bd8f..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceStringTable.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * Copyright 2017 - 2021 K. Nakagawa - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceStringTable.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceStringTable::*)(void) const; - -template -using setter_t = void (ResourceStringTable::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceStringTable") - - .def_property_readonly("length", - static_cast>(&ResourceStringTable::length), - "The size of the string, not including length field itself.") - - .def_property_readonly("name", - static_cast>(&ResourceStringTable::name), - "The variable-length Unicode string data, word-aligned." - ) - - .def("__eq__", &ResourceStringTable::operator==) - .def("__ne__", &ResourceStringTable::operator!=) - .def("__hash__", - [] (const ResourceStringTable& string_table) { - return Hash::hash(string_table); - }) - - .def("__str__", - [] (const ResourceStringTable& string_table) { - std::ostringstream stream; - stream << string_table; - std::string str = stream.str(); - return str; - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceVarFileInfo.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceVarFileInfo.cpp deleted file mode 100644 index 01b14be..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceVarFileInfo.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceVarFileInfo.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceVarFileInfo::*)(void) const; - -template -using setter_t = void (ResourceVarFileInfo::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceVarFileInfo", - "This object describes information about languages supported by the application") - - .def_property("type", - static_cast>(&ResourceVarFileInfo::type), - static_cast>(&ResourceVarFileInfo::type), - R"delim( - The type of data in the version resource - - * ``1`` if it contains text data - * ``0`` if it contains binary data - )delim") - - - .def_property("key", - static_cast>(&ResourceVarFileInfo::key), - static_cast>(&ResourceVarFileInfo::key), - "Signature of the structure. Must be ``VarFileInfo``") - - .def_property("translations", - static_cast& (ResourceVarFileInfo::*)(void)>(&ResourceVarFileInfo::translations), - static_cast&>>(&ResourceVarFileInfo::translations), - R"delim( - List of languages that the application supports - - The **least** significant 16-bits must contain a Microsoft language identifier, - and the **most** significant 16-bits must contain the :class:`~lief.PE.CODE_PAGES` - Either **most** or **least** 16-bits can be zero, indicating that the file is language or code page independent. - )delim") - - .def("__eq__", &ResourceVarFileInfo::operator==) - .def("__ne__", &ResourceVarFileInfo::operator!=) - .def("__hash__", - [] (const ResourceVarFileInfo& var_file_info) { - return Hash::hash(var_file_info); - }) - - .def("__str__", - [] (const ResourceVarFileInfo& var_file_info) { - std::ostringstream stream; - stream << var_file_info; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/resources/pyResourceVersion.cpp b/vendor/lief/api/python/PE/objects/resources/pyResourceVersion.cpp deleted file mode 100644 index 6596260..0000000 --- a/vendor/lief/api/python/PE/objects/resources/pyResourceVersion.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/resources/ResourceVersion.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ResourceVersion::*)(void) const; - -template -using setter_t = void (ResourceVersion::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ResourceVersion", - R"delim( - Class that represents the data associated with the ``RT_VERSION`` entry - - See: `VS_VERSIONINFO `_ - )delim") - - .def_property("type", - static_cast>(&ResourceVersion::type), - static_cast>(&ResourceVersion::type), - R"delim( - The type of data in the version resource - * ``1`` if it contains text data - * ``0`` if it contains binary data - )delim") - - - .def_property("key", - static_cast>(&ResourceVersion::key), - static_cast>(&ResourceVersion::key), - "Signature of the structure. Must be ``VS_VERSION_INFO``") - - .def_property("fixed_file_info", - static_cast>(&ResourceVersion::fixed_file_info), - static_cast>(&ResourceVersion::fixed_file_info), - R"delim( - :class:`~lief.PE.ResourceFixedFileInfo` associated with the version (if any). - This object describes various information about the application's version. - - If not present, this property is set to None - )delim") - - .def_property("string_file_info", - static_cast>(&ResourceVersion::string_file_info), - static_cast>(&ResourceVersion::string_file_info), - R"delim( - :class:`~lief.PE.ResourceStringFileInfo` associated with the version (if any) - This object describes various information about the application's version. - The underlying structure is basically a dictionary (key/value) - - If the current :class:`~lief.PE.ResourceVersion` does not use :class:`~lief.PE.ResourceStringFileInfo`, - it returns None. - )delim") - - .def_property("var_file_info", - static_cast>(&ResourceVersion::var_file_info), - static_cast>(&ResourceVersion::var_file_info), - R"delim( - :class:`~lief.PE.ResourceVarFileInfo` associated with the version (if any) - This object describes information about languages supported by the application. - - If the current :class:`~lief.PE.ResourceVersion` does not use :class:`~lief.PE.ResourceVarFileInfo`, - it returns None. - )delim") - - .def_property_readonly("has_fixed_file_info", - &ResourceVersion::has_fixed_file_info, - "``True`` if the version contains a " RST_CLASS_REF(lief.PE.ResourceFixedFileInfo) "") - - .def_property_readonly("has_string_file_info", - &ResourceVersion::has_string_file_info, - "``True`` if the version contains a " RST_CLASS_REF(lief.PE.ResourceStringFileInfo) "") - - .def_property_readonly("has_var_file_info", - &ResourceVersion::has_var_file_info, - "``True`` if the version contains a " RST_CLASS_REF(lief.PE.ResourceVarFileInfo) "") - - .def("remove_fixed_file_info", - &ResourceVersion::remove_fixed_file_info, - "Remove the " RST_CLASS_REF(lief.PE.ResourceFixedFileInfo) " from the version") - - .def("remove_string_file_info", - &ResourceVersion::remove_string_file_info, - "Remove the " RST_CLASS_REF(lief.PE.ResourceStringFileInfo) " from the version") - - .def("remove_var_file_info", - &ResourceVersion::remove_var_file_info, - "Remove the " RST_CLASS_REF(lief.PE.ResourceVarFileInfo) " from the version") - - .def("__eq__", &ResourceVersion::operator==) - .def("__ne__", &ResourceVersion::operator!=) - .def("__hash__", - [] (const ResourceVersion& version) { - return Hash::hash(version); - }) - - .def("__str__", - [] (const ResourceVersion& version) { - std::ostringstream stream; - stream << version; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/signature/CMakeLists.txt b/vendor/lief/api/python/PE/objects/signature/CMakeLists.txt deleted file mode 100644 index 1ff2c0e..0000000 --- a/vendor/lief/api/python/PE/objects/signature/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -set(LIEF_PYTHON_PE_SIG_SRC - "${CMAKE_CURRENT_LIST_DIR}/pySignerInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyAttribute.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyRsaInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyx509.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyContentInfo.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pySignature.cpp" -) - -source_group("Header Files\\PE\\signature" FILES ${LIEF_PYTHON_PE_SIG_SRC}) - -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}") -target_sources(pyLIEF PRIVATE ${LIEF_PYTHON_PE_SIG_SRC}) - -include("${CMAKE_CURRENT_LIST_DIR}/attributes/CMakeLists.txt") diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/CMakeLists.txt b/vendor/lief/api/python/PE/objects/signature/attributes/CMakeLists.txt deleted file mode 100644 index e917910..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -set(LIEF_PYTHON_PE_SIG_ATTR_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyMsCounterSign.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyContentType.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyGenericType.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pySpcSpOpusInfo.cpp" - - "${CMAKE_CURRENT_LIST_DIR}/pyMsSpcStatementType.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyMsSpcNestedSignature.cpp" - - "${CMAKE_CURRENT_LIST_DIR}/pyPKCS9SigningTime.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyPKCS9MessageDigest.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyPKCS9AtSequenceNumber.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyPKCS9CounterSignature.cpp" -) - -source_group("Header Files\\PE\\signature\\attributes" FILES ${LIEF_PYTHON_PE_SIG_ATTR_SRC}) - -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}") -target_sources(pyLIEF PRIVATE ${LIEF_PYTHON_PE_SIG_ATTR_SRC}) diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyContentType.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyContentType.cpp deleted file mode 100644 index f45a595..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyContentType.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/ContentType.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ContentType::*)(void) const; - -template -using setter_t = void (ContentType::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "ContentType", - R"delim( - Interface over the structure described by the OID ``1.2.840.113549.1.9.3`` (PKCS #9) - The internal structure is described in the: - `RFC #2985: PKCS #9 - Selected Object Classes and Attribute Types Version 2.0 `_ - - .. code-block:: text - - ContentType ::= OBJECT IDENTIFIER - - )delim") - .def_property_readonly("oid", - &ContentType::oid, "OID as described in RFC #2985 (string object)") - - .def("__hash__", - [] (const ContentType& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &ContentType::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyGenericType.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyGenericType.cpp deleted file mode 100644 index 4ad0b50..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyGenericType.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/GenericType.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (GenericType::*)(void) const; - -template -using setter_t = void (GenericType::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "GenericType", - R"delim( - Interface over an attribute for which the internal structure is not supported by LIEF - )delim") - .def_property_readonly("oid", - &GenericType::oid, - "OID of the original attribute") - - .def_property_readonly("raw_content", - [] (const GenericType& type) -> py::bytes { - const std::vector& raw = type.raw_content(); - return py::bytes(reinterpret_cast(raw.data()), raw.size()); - }, - "Original DER blob of the attribute") - - .def("__hash__", - [] (const GenericType& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &GenericType::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyMsCounterSign.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyMsCounterSign.cpp deleted file mode 100644 index 56c6235..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyMsCounterSign.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/MsCounterSign.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -} -} - diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyMsSpcNestedSignature.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyMsSpcNestedSignature.cpp deleted file mode 100644 index 8f5e74e..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyMsSpcNestedSignature.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/MsSpcNestedSignature.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (MsSpcNestedSignature::*)(void) const; - -template -using setter_t = void (MsSpcNestedSignature::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "MsSpcNestedSignature", - R"delim( - Interface over the structure described by the OID ``1.3.6.1.4.1.311.2.4.1`` - - The internal structure is not documented but we can infer the following structure: - - .. code-block:: text - - MsSpcNestedSignature ::= SET OF SignedData - - With ``SignedData``, the structure described in PKCS #7 RFC (See: :class:`lief.PE.Signature`) - )delim") - .def_property_readonly("signature", - &MsSpcNestedSignature::sig, - "Underlying " RST_CLASS_REF(lief.PE.Signature) " object", - py::return_value_policy::reference) - - .def("__hash__", - [] (const MsSpcNestedSignature& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &MsSpcNestedSignature::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyMsSpcStatementType.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyMsSpcStatementType.cpp deleted file mode 100644 index c5eb5e7..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyMsSpcStatementType.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/MsSpcStatementType.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (MsSpcStatementType::*)(void) const; - -template -using setter_t = void (MsSpcStatementType::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "MsSpcStatementType", - R"delim( - Interface over the structure described by the OID ``1.3.6.1.4.1.311.2.1.11`` - - The internal structure is described in the official document: - `Windows Authenticode Portable Executable Signature Format `_ - - .. code-block:: text - - SpcStatementType ::= SEQUENCE of OBJECT IDENTIFIER - - )delim") - - .def_property_readonly("oid", - &MsSpcStatementType::oid, - R"delim( - According to the documentation: - - :: - - The SpcStatementType MUST contain one Object Identifier with either - the value ``1.3.6.1.4.1.311.2.1.21 (SPC_INDIVIDUAL_SP_KEY_PURPOSE_OBJID)`` or - ``1.3.6.1.4.1.311.2.1.22 (SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID)``. - )delim") - - .def("__hash__", - [] (const MsSpcStatementType& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &MsSpcStatementType::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9AtSequenceNumber.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9AtSequenceNumber.cpp deleted file mode 100644 index 7c9e97c..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9AtSequenceNumber.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/PKCS9AtSequenceNumber.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (PKCS9AtSequenceNumber::*)(void) const; - -template -using setter_t = void (PKCS9AtSequenceNumber::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "PKCS9AtSequenceNumber", - R"delim( - Interface over the structure described by the OID ``1.2.840.113549.1.9.25.4`` (PKCS #9) - - The internal structure is described in the - `RFC #2985: PKCS #9 - Selected Object Classes and Attribute Types Version 2.0 `_ - - .. code-block:: text - - sequenceNumber ATTRIBUTE ::= { - WITH SYNTAX SequenceNumber - EQUALITY MATCHING RULE integerMat - SINGLE VALUE TRUE - ID pkcs-9-at-sequenceNumber - } - - SequenceNumber ::= INTEGER (1..MAX) - - )delim") - - .def_property_readonly("number", - &PKCS9AtSequenceNumber::number, - "Number as described in the RFC") - - .def("__hash__", - [] (const PKCS9AtSequenceNumber& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &PKCS9AtSequenceNumber::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9CounterSignature.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9CounterSignature.cpp deleted file mode 100644 index 2c14515..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9CounterSignature.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/PKCS9CounterSignature.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (PKCS9CounterSignature::*)(void) const; - -template -using setter_t = void (PKCS9CounterSignature::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "PKCS9CounterSignature", - R"delim( - Interface over the structure described by the OID ``1.2.840.113549.1.9.6`` (PKCS #9) - - The internal structure is described in the - `RFC #2985: PKCS #9 - Selected Object Classes and Attribute Types Version 2.0 `_ - - .. code-block:: text - - counterSignature ATTRIBUTE ::= { - WITH SYNTAX SignerInfo - ID pkcs-9-at-counterSignature - } - - )delim") - .def_property_readonly("signer", - &PKCS9CounterSignature::signer, - "Return the " RST_CLASS_REF(lief.PE.SignerInfo) " as described in the RFC #2985", - py::return_value_policy::reference) - - .def("__hash__", - [] (const PKCS9CounterSignature& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &PKCS9CounterSignature::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9MessageDigest.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9MessageDigest.cpp deleted file mode 100644 index c240963..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9MessageDigest.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/PKCS9MessageDigest.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (PKCS9MessageDigest::*)(void) const; - -template -using setter_t = void (PKCS9MessageDigest::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "PKCS9MessageDigest", - R"delim( - Interface over the structure described by the OID ``1.2.840.113549.1.9.4`` (PKCS #9) - - The internal structure is described in the - `RFC #2985: PKCS #9 - Selected Object Classes and Attribute Types Version 2.0 `_ - - .. code-block:: text - - messageDigest ATTRIBUTE ::= { - WITH SYNTAX MessageDigest - EQUALITY MATCHING RULE octet - SINGLE VALUE TRUE - ID pkcs-9-at-messageDigest - } - - MessageDigest ::= OCTET STRING - - )delim") - - .def_property_readonly("digest", - [] (const PKCS9MessageDigest& digest) -> py::object { - const std::vector& data = digest.digest(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Message digeset as a blob of bytes as described in the RFC") - - .def("__hash__", - [] (const PKCS9MessageDigest& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &PKCS9MessageDigest::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9SigningTime.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9SigningTime.cpp deleted file mode 100644 index 682b73c..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pyPKCS9SigningTime.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/PKCS9SigningTime.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (PKCS9SigningTime::*)(void) const; - -template -using setter_t = void (PKCS9SigningTime::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "PKCS9SigningTime", - R"delim( - Interface over the structure described by the OID ``1.2.840.113549.1.9.5`` (PKCS #9) - - The internal structure is described in the - `RFC #2985: PKCS #9 - Selected Object Classes and Attribute Types Version 2.0 `_ - - .. code-block:: text - - signingTime ATTRIBUTE ::= { - WITH SYNTAX SigningTime - EQUALITY MATCHING RULE signingTimeMatch - SINGLE VALUE TRUE - ID pkcs-9-at-signingTime - } - - SigningTime ::= Time -- imported from ISO/IEC 9594-8 - - )delim") - - .def_property_readonly("time", - &PKCS9SigningTime::time, - "Time as a list [year, month, day, hour, min, sec]") - - .def("__hash__", - [] (const PKCS9SigningTime& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &PKCS9SigningTime::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/attributes/pySpcSpOpusInfo.cpp b/vendor/lief/api/python/PE/objects/signature/attributes/pySpcSpOpusInfo.cpp deleted file mode 100644 index 50b23f7..0000000 --- a/vendor/lief/api/python/PE/objects/signature/attributes/pySpcSpOpusInfo.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" -#include "LIEF/PE/signature/attributes/SpcSpOpusInfo.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (SpcSpOpusInfo::*)(void) const; - -template -using setter_t = void (SpcSpOpusInfo::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "SpcSpOpusInfo", - R"delim( - Interface over the structure described by the OID ``1.3.6.1.4.1.311.2.1.12`` - The internal structure is described in the official document: `Windows Authenticode Portable Executable Signature Format `_ - - .. code-block:: text - - SpcSpOpusInfo ::= SEQUENCE { - programName [0] EXPLICIT SpcString OPTIONAL, - moreInfo [1] EXPLICIT SpcLink OPTIONAL - } - )delim" - ) - .def_property_readonly("program_name", - [] (const SpcSpOpusInfo& info) { - return safe_string_converter(info.program_name()); - }, "Program description provided by the publisher") - - .def_property_readonly("more_info", - [] (const SpcSpOpusInfo& info) { - return safe_string_converter(info.more_info()); - }, "Other information such as an URL") - - .def("__hash__", - [] (const SpcSpOpusInfo& obj) { - return Hash::hash(obj); - }) - - .def("__str__", &SpcSpOpusInfo::print); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/pyAttribute.cpp b/vendor/lief/api/python/PE/objects/signature/pyAttribute.cpp deleted file mode 100644 index 3416952..0000000 --- a/vendor/lief/api/python/PE/objects/signature/pyAttribute.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Attribute.hpp" - -#include -#include - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Attribute::*)(void) const; - -template -using setter_t = void (Attribute::*)(T); - - -template<> -void create(py::module& m) { - py::class_(m, "Attribute", "Interface over PKCS #7 attribute") - .def_property_readonly("type", - &Attribute::type, - "Concrete type (" RST_CLASS_REF(lief.PE.SIG_ATTRIBUTE_TYPES) ") of the attribute") - - .def("__str__", [] (const Attribute& attr) - { - return attr.print(); - }); -} - -} -} diff --git a/vendor/lief/api/python/PE/objects/signature/pyContentInfo.cpp b/vendor/lief/api/python/PE/objects/signature/pyContentInfo.cpp deleted file mode 100644 index 11925d5..0000000 --- a/vendor/lief/api/python/PE/objects/signature/pyContentInfo.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/ContentInfo.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (ContentInfo::*)(void) const; - -template -using setter_t = void (ContentInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "ContentInfo", - R"delim( - ContentInfo as described in the `RFC 2315 `_ - - .. code-block:: text - - ContentInfo ::= SEQUENCE { - contentType ContentType, - content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL - } - - ContentType ::= OBJECT IDENTIFIER - - In the case of PE signature, ContentType **must** be set to SPC_INDIRECT_DATA_OBJID - OID: ``1.3.6.1.4.1.311.2.1.4`` and content is defined by the structure: ``SpcIndirectDataContent`` - - .. code-block:: text - - SpcIndirectDataContent ::= SEQUENCE { - data SpcAttributeTypeAndOptionalValue, - messageDigest DigestInfo - } - - SpcAttributeTypeAndOptionalValue ::= SEQUENCE { - type ObjectID, - value [0] EXPLICIT ANY OPTIONAL - } - - For PE signature, ``SpcAttributeTypeAndOptionalValue.type`` - is set to ``SPC_PE_IMAGE_DATAOBJ`` (OID: ``1.3.6.1.4.1.311.2.1.15``) and the value is defined by - ``SpcPeImageData`` - - .. code-block:: text - - DigestInfo ::= SEQUENCE { - digestAlgorithm AlgorithmIdentifier, - digest OCTETSTRING - } - - AlgorithmIdentifier ::= SEQUENCE { - algorithm ObjectID, - parameters [0] EXPLICIT ANY OPTIONAL - } - )delim") - - .def_property_readonly("content_type", - &ContentInfo::content_type, - "OID of the content type. This value should match ``SPC_INDIRECT_DATA_OBJID``") - - .def_property_readonly("digest_algorithm", - &ContentInfo::digest_algorithm, - "Algorithm (" RST_CLASS_REF(lief.PE.ALGORITHMS) ") used to hash the file. " - "This value should match " RST_ATTR_REF_FULL(SignerInfo.digest_algorithm) " and " - "" RST_ATTR_REF_FULL(Signature.digest_algorithm) "") - - .def_property_readonly("digest", - [] (const ContentInfo& info) -> py::bytes { - const std::vector& dg = info.digest(); - return py::bytes(reinterpret_cast(dg.data()), dg.size()); - }, - "The digest as ``bytes``. It should match the binary :meth:`~lief.PE.Binary.authentihash`") - - .def("__hash__", - [] (const ContentInfo& info) { - return Hash::hash(info); - }) - - .def("__str__", - [] (const ContentInfo& content_info) - { - std::ostringstream stream; - stream << content_info; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/signature/pyRsaInfo.cpp b/vendor/lief/api/python/PE/objects/signature/pyRsaInfo.cpp deleted file mode 100644 index ce3f538..0000000 --- a/vendor/lief/api/python/PE/objects/signature/pyRsaInfo.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/PE/signature/RsaInfo.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (RsaInfo::*)(void) const; - -template -using setter_t = void (RsaInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_(m, "RsaInfo", "Object representing a RSA key") - .def_property_readonly("has_public_key", - &RsaInfo::has_public_key, - "True if it embeds a public key") - - .def_property_readonly("has_private_key", - &RsaInfo::has_private_key, - "True if it embeds a private key") - - .def_property_readonly("N", - [] (const RsaInfo& info) { - const std::vector& data = info.N(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "RSA public modulus (in bytes)") - - .def_property_readonly("E", - [] (const RsaInfo& info) { - const std::vector& data = info.E(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, "RSA public exponent (in bytes)") - - .def_property_readonly("D", - [] (const RsaInfo& info) { - const std::vector& data = info.D(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, "RSA private exponent (in bytes)") - - .def_property_readonly("P", - [] (const RsaInfo& info) { - const std::vector& data = info.P(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, "First prime factor (in bytes)") - - .def_property_readonly("Q", - [] (const RsaInfo& info) { - const std::vector& data = info.Q(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, "Second prime factor (in bytes)") - - .def_property_readonly("key_size", - &RsaInfo::key_size, "Size of the public modulus in bits") - - .def_property_readonly("__len__", - &RsaInfo::key_size) - - .def("__str__", - [] (const RsaInfo& info) - { - std::ostringstream stream; - stream << info; - return safe_string_converter(stream.str()); - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/signature/pySignature.cpp b/vendor/lief/api/python/PE/objects/signature/pySignature.cpp deleted file mode 100644 index 54f4283..0000000 --- a/vendor/lief/api/python/PE/objects/signature/pySignature.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "enums_wrapper.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/Signature.hpp" -#include "LIEF/PE/signature/SignatureParser.hpp" - -#define LIEF_PE_FORCE_UNDEF -#include "LIEF/PE/undef.h" -#include "pyPE.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (Signature::*)(void) const; - -template -using setter_t = void (Signature::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ signature(m, "Signature"); - LIEF::enum_ verif_flags_enums(signature, "VERIFICATION_FLAGS", py::arithmetic()); - verif_flags_enums - .value("OK", Signature::VERIFICATION_FLAGS::OK) - .value("INVALID_SIGNER", Signature::VERIFICATION_FLAGS::INVALID_SIGNER) - .value("UNSUPPORTED_ALGORITHM", Signature::VERIFICATION_FLAGS::UNSUPPORTED_ALGORITHM) - .value("INCONSISTENT_DIGEST_ALGORITHM", Signature::VERIFICATION_FLAGS::INCONSISTENT_DIGEST_ALGORITHM) - .value("CERT_NOT_FOUND", Signature::VERIFICATION_FLAGS::CERT_NOT_FOUND) - .value("CORRUPTED_CONTENT_INFO", Signature::VERIFICATION_FLAGS::CORRUPTED_CONTENT_INFO) - .value("CORRUPTED_AUTH_DATA", Signature::VERIFICATION_FLAGS::CORRUPTED_AUTH_DATA) - .value("MISSING_PKCS9_MESSAGE_DIGEST", Signature::VERIFICATION_FLAGS::MISSING_PKCS9_MESSAGE_DIGEST) - .value("BAD_DIGEST", Signature::VERIFICATION_FLAGS::BAD_DIGEST) - .value("BAD_SIGNATURE", Signature::VERIFICATION_FLAGS::BAD_SIGNATURE) - .value("NO_SIGNATURE", Signature::VERIFICATION_FLAGS::NO_SIGNATURE) - .value("CERT_EXPIRED", Signature::VERIFICATION_FLAGS::CERT_EXPIRED) - .value("CERT_FUTURE", Signature::VERIFICATION_FLAGS::CERT_FUTURE); - - py::dict verif_flags_entries = verif_flags_enums.attr("__entries"); - verif_flags_enums - .def("__str__", [verif_flags_entries] (const Signature::VERIFICATION_FLAGS& flags) { - if (flags == Signature::VERIFICATION_FLAGS::OK) { - return Signature::flag_to_string(flags); - } - std::string flags_str; - for (const auto& item : verif_flags_entries) { - Signature::VERIFICATION_FLAGS flag = item.second[py::int_(0)].cast(); - if ((flags & flag) == flag && flag != Signature::VERIFICATION_FLAGS::OK) { - if (!flags_str.empty()) { - flags_str += " | "; - } - flags_str += "VERIFICATION_FLAGS." + Signature::flag_to_string(flag); - } - } - return flags_str; - }, py::prepend{}); - - LIEF::enum_(signature, "VERIFICATION_CHECKS", py::arithmetic(), - R"delim( - Flags to tweak the verification process of the signature - See :meth:`lief.PE.Signature.check` and :meth:`lief.PE.Binary.verify_signature` - )delim") - .value("DEFAULT", Signature::VERIFICATION_CHECKS::DEFAULT, - "Default behavior that tries to follow the Microsoft verification process as close as possible") - - .value("HASH_ONLY", Signature::VERIFICATION_CHECKS::HASH_ONLY, - R"delim( - Only check that :meth:`lief.PE.Binary.authentihash` matches :attr:`lief.PE.ContentInfo.digest` - regardless of the signature's validity - )delim") - - .value("LIFETIME_SIGNING", Signature::VERIFICATION_CHECKS::LIFETIME_SIGNING, - R"delim( - Same semantic as `WTD_LIFETIME_SIGNING_FLAG `_ - )delim") - - .value("SKIP_CERT_TIME", Signature::VERIFICATION_CHECKS::SKIP_CERT_TIME, - R"delim( - Skip the verification of the certificates time validities so that even though - a certificate expired, it returns :attr:`lief.PE.Signature.VERIFICATION_FLAGS.OK` - )delim"); - - init_ref_iterator(signature, "it_const_crt"); - init_ref_iterator(signature, "it_const_signers_t"); - - signature - .def_static("parse", - [] (const std::string& path) -> py::object { - auto sig = SignatureParser::parse(path); - if (!sig) { - return py::none(); - } - return py::cast(sig.value()); - }, - "Parse the DER PKCS #7 signature from the file path given in the first parameter", - "path"_a) - - .def_static("parse", - [] (const std::vector& raw, bool skip_header) -> py::object { - auto sig = SignatureParser::parse(raw, skip_header); - if (!sig) { - return py::none(); - } - return py::cast(sig.value()); - }, - "Parse the raw (DER) PKCS #7 signature given in the first parameter", - "raw"_a, "skip_header"_a = false) - - .def_property_readonly("version", - &Signature::version, - "Version of the signature. It should be 1") - - .def_property_readonly("digest_algorithm", - &Signature::digest_algorithm, - "Return the algorithm (" RST_CLASS_REF(lief.PE.ALGORITHMS) ") \ - used to sign the content of " RST_CLASS_REF(lief.PE.ContentInfo) "") - - .def_property_readonly("content_info", - &Signature::content_info, - "Return the " RST_CLASS_REF(lief.PE.ContentInfo) "", - py::return_value_policy::reference) - - .def_property_readonly("certificates", - &Signature::certificates, - "Return an iterator over " RST_CLASS_REF(lief.PE.x509) " certificates", - py::return_value_policy::reference) - - .def_property_readonly("signers", - &Signature::signers, - "Return an iterator over the signers: " RST_CLASS_REF(lief.PE.SignerInfo) "", - py::return_value_policy::reference) - - .def("find_crt", - static_cast&) const>(&Signature::find_crt), - "Find the " RST_CLASS_REF(lief.PE.x509) " certificate according to its serial number", - py::return_value_policy::reference, - "serialno"_a) - - .def("find_crt_subject", - static_cast(&Signature::find_crt_subject), - "Find the " RST_CLASS_REF(lief.PE.x509) " certificate according to its subject", - py::return_value_policy::reference, - "subject"_a) - - .def("find_crt_subject", - static_cast&) const>(&Signature::find_crt_subject), - "Find the " RST_CLASS_REF(lief.PE.x509) " certificate according to its subject **AND** its serial number", - py::return_value_policy::reference, - "subject"_a, "serialno"_a) - - .def("find_crt_issuer", - static_cast(&Signature::find_crt_issuer), - "Find the " RST_CLASS_REF(lief.PE.x509) " certificate according to its issuer", - py::return_value_policy::reference, - "issuer"_a) - - .def("find_crt_issuer", - static_cast&) const>(&Signature::find_crt_issuer), - "Find the " RST_CLASS_REF(lief.PE.x509) " certificate according to its issuer **AND** its serial number", - py::return_value_policy::reference, - "issuer"_a, "serialno"_a) - - .def("check", - &Signature::check, - // Note: This documentation needs to be sync with LIEF::PE::Signature::check - R"delim( - Check the integrity of the signature and return a :class:`lief.PE.Signature.VERIFICATION_FLAGS` - - By default, it performs the following verifications: - - 1. It must contain only **one** signer info (:attr:`~lief.PE.Signature.signers`) - 2. :attr:`lief.PE.Signature.digest_algorithm` must match: - - * :attr:`lief.PE.ContentInfo.digest_algorithm` - * :attr:`lief.PE.SignerInfo.digest_algorithm` - - 3. The x509 certificate specified by :attr:`lief.PE.SignerInfo.serial_number` **and** :attr:`lief.PE.SignerInfo.issuer` - must exist within :attr:`lief.PE.Signature.certificates` - 4. Given the x509 certificate, compare :attr:`lief.PE.SignerInfo.encrypted_digest` against either: - - * hash of authenticated attributes (:attr:`~lief.PE.SignerInfo.authenticated_attributes`) if present - * hash of ContentInfo - - 5. If they are Authenticated attributes, check that a PKCS9_MESSAGE_DIGEST (:class:`lief.PE.PKCS9MessageDigest`) attribute exists - and that its value matches hash of ContentInfo - 6. Check the validity of the PKCS #9 counter signature if present - 7. If the signature doesn't embed a signing-time in the counter signature, check the certificate - validity. (See :attr:`lief.PE.Signature.VERIFICATION_CHECKS.LIFETIME_SIGNING` and :attr:`lief.pe.Signature.VERIFICATION_CHECKS.SKIP_CERT_TIME`) - - See: :class:`lief.PE.Signature.VERIFICATION_CHECKS` to tweak the behavior - - )delim", - "checks"_a = Signature::VERIFICATION_CHECKS::DEFAULT - ) - - .def_property_readonly("raw_der", - [] (const Signature& sig) { - const std::vector& raw = sig.raw_der(); - return py::bytes(reinterpret_cast(raw.data()), raw.size()); - }, - "Return the raw original signature as a byte object", - py::return_value_policy::reference_internal) - - .def("__hash__", - [] (const Signature& obj) { - return Hash::hash(obj); - }) - - .def("__str__", - [] (const Signature& signature) - { - std::ostringstream stream; - stream << signature; - return stream.str(); - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/signature/pySignerInfo.cpp b/vendor/lief/api/python/PE/objects/signature/pySignerInfo.cpp deleted file mode 100644 index ae3a7a8..0000000 --- a/vendor/lief/api/python/PE/objects/signature/pySignerInfo.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/SignerInfo.hpp" -#include "LIEF/PE/signature/Attribute.hpp" - -#include "pyPE.hpp" -#include "pyIterators.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (SignerInfo::*)(void) const; - -template -using setter_t = void (SignerInfo::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ signer(m, "SignerInfo", - R"delim( - SignerInfo as described in the `RFC 2315 #Section 9.2 `_ - - .. code-block:: text - - SignerInfo ::= SEQUENCE { - version Version, - issuerAndSerialNumber IssuerAndSerialNumber, - digestAlgorithm DigestAlgorithmIdentifier, - authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, - digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier, - encryptedDigest EncryptedDigest, - unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL - } - - EncryptedDigest ::= OCTET STRING - )delim"); - - - init_ref_iterator(signer, "it_const_attributes_t"); - - signer - .def_property_readonly("version", - &SignerInfo::version, - "Should be 1") - - .def_property_readonly("serial_number", - [] (const SignerInfo& info) -> py::bytes { - const std::vector& data = info.serial_number(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "The X509 serial number used to sign the signed-data (see: :attr:`lief.PE.x509.serial_number`)") - - .def_property_readonly("issuer", - [] (const SignerInfo& object) { - return safe_string_converter(object.issuer()); - }, - "The X509 issuer used to sign the signed-data (see: :attr:`lief.PE.x509.issuer`)", - py::return_value_policy::copy) - - .def_property_readonly("digest_algorithm", - &SignerInfo::digest_algorithm, - "Algorithm (" RST_CLASS_REF(lief.PE.ALGORITHMS) ") used to hash the file. " - "This value should match " RST_ATTR_REF_FULL(ContentInfo.digest_algorithm) " " - "and " RST_ATTR_REF_FULL(Signature.digest_algorithm) "") - - .def_property_readonly("encryption_algorithm", - &SignerInfo::encryption_algorithm, - "Return algorithm (" RST_CLASS_REF(lief.PE.ALGORITHMS) ") used to encrypt the digest") - - .def_property_readonly("encrypted_digest", - [] (const SignerInfo& info) { - const std::vector& data = info.encrypted_digest(); - return py::bytes(reinterpret_cast(data.data()), data.size()); - }, - "Return the signature created by the signing certificate's private key") - - .def_property_readonly("authenticated_attributes", - &SignerInfo::authenticated_attributes, - "Return an iterator over the authenticated attributes (" - "" RST_CLASS_REF(lief.PE.Attribute) ")", - py::return_value_policy::reference) - - .def_property_readonly("unauthenticated_attributes", - &SignerInfo::unauthenticated_attributes, - "Return an iterator over the unauthenticated attributes (" - "" RST_CLASS_REF(lief.PE.Attribute) ")", - py::return_value_policy::reference) - - .def("get_attribute", - &SignerInfo::get_attribute, - R"delim( - Return the authenticated or un-authenticated attribute matching the - given :class:`lief.PE.SIG_ATTRIBUTE_TYPES` - It returns **the first** entry that matches the given type. If it can't be - found, it returns None - )delim", - "type"_a, - py::return_value_policy::reference) - - .def("get_auth_attribute", - &SignerInfo::get_auth_attribute, - R"delim( - Return the authenticated attribute matching the - given :class:`lief.PE.SIG_ATTRIBUTE_TYPES` - It returns **the first** entry that matches the given type. If it can't be - found, it returns None - )delim", - "type"_a, - py::return_value_policy::reference) - - .def("get_unauth_attribute", - &SignerInfo::get_unauth_attribute, - R"delim( - Return the un-authenticated attribute matching the - given :class:`lief.PE.SIG_ATTRIBUTE_TYPES` - It returns **the first** entry that matches the given type. If it can't be - found, it returns a nullptr - )delim", - "type"_a, - py::return_value_policy::reference) - - .def_property_readonly("cert", - static_cast(&SignerInfo::cert), - "" RST_CLASS_REF(lief.PE.x509) " certificate used by this signer. If it can't be found, it returns None", - py::return_value_policy::reference) - - .def("__hash__", - [] (const SignerInfo& obj) { - return Hash::hash(obj); - }) - - .def("__str__", - [] (const SignerInfo& signer_info) - { - std::ostringstream stream; - stream << signer_info; - std::string str = stream.str(); - return str; - }); - -} - -} -} - diff --git a/vendor/lief/api/python/PE/objects/signature/pyx509.cpp b/vendor/lief/api/python/PE/objects/signature/pyx509.cpp deleted file mode 100644 index dcfbc8d..0000000 --- a/vendor/lief/api/python/PE/objects/signature/pyx509.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include - -#include "enums_wrapper.hpp" - -#include "LIEF/PE/hash.hpp" -#include "LIEF/PE/signature/x509.hpp" -#include "LIEF/PE/signature/RsaInfo.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -template -using getter_t = T (x509::*)(void) const; - -template -using setter_t = void (x509::*)(T); - - -template<> -void create(py::module& m) { - - py::class_ cls_x509(m, "x509", "Interface over a x509 certificate"); - - LIEF::enum_(cls_x509, "VERIFICATION_FLAGS", py::arithmetic(), - "Verification flags associated with " RST_METH_REF(lief.PE.x509.verify) "") - .value("OK", x509::VERIFICATION_FLAGS::OK, "The verification succeed") - .value("BADCERT_EXPIRED", x509::VERIFICATION_FLAGS::BADCERT_EXPIRED, "The certificate validity has expired") - .value("BADCERT_REVOKED", x509::VERIFICATION_FLAGS::BADCERT_REVOKED, "The certificate has been revoked (is on a CRL)") - .value("BADCERT_CN_MISMATCH", x509::VERIFICATION_FLAGS::BADCERT_CN_MISMATCH, "The certificate Common Name (CN) does not match with the expected CN.") - .value("BADCERT_NOT_TRUSTED", x509::VERIFICATION_FLAGS::BADCERT_NOT_TRUSTED, "The certificate is not correctly signed by the trusted CA.") - .value("BADCRL_NOT_TRUSTED", x509::VERIFICATION_FLAGS::BADCRL_NOT_TRUSTED, "The CRL is not correctly signed by the trusted CA.") - .value("BADCRL_EXPIRED", x509::VERIFICATION_FLAGS::BADCRL_EXPIRED, "The CRL is expired.") - .value("BADCERT_MISSING", x509::VERIFICATION_FLAGS::BADCERT_MISSING, "Certificate was missing.") - .value("BADCERT_SKIP_VERIFY", x509::VERIFICATION_FLAGS::BADCERT_SKIP_VERIFY, "Certificate verification was skipped.") - .value("BADCERT_OTHERNATURE", x509::VERIFICATION_FLAGS::BADCERT_OTHER, "Other reason") - .value("BADCERT_FUTURE", x509::VERIFICATION_FLAGS::BADCERT_FUTURE, "The certificate validity starts in the future.") - .value("BADCRL_FUTURE", x509::VERIFICATION_FLAGS::BADCRL_FUTURE, "The CRL is from the future") - .value("BADCERT_KEY_USAGE", x509::VERIFICATION_FLAGS::BADCERT_KEY_USAGE, "Usage does not match the keyUsage extension.") - .value("BADCERT_EXT_KEY_USAGE", x509::VERIFICATION_FLAGS::BADCERT_EXT_KEY_USAGE, "Usage does not match the extendedKeyUsage extension.") - .value("BADCERT_NS_CERT_TYPE", x509::VERIFICATION_FLAGS::BADCERT_NS_CERT_TYPE, "Usage does not match the nsCertType extension.") - .value("BADCERT_BAD_MD", x509::VERIFICATION_FLAGS::BADCERT_BAD_MD, "The certificate is signed with an unacceptable hash.") - .value("BADCERT_BAD_PK", x509::VERIFICATION_FLAGS::BADCERT_BAD_PK, "The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA).") - .value("BADCERT_BAD_KEY", x509::VERIFICATION_FLAGS::BADCERT_BAD_KEY, "The certificate is signed with an unacceptable key (eg bad curve, RSA too short).") - .value("BADCRL_BAD_MD", x509::VERIFICATION_FLAGS::BADCRL_BAD_MD, "The CRL is signed with an unacceptable hash.") - .value("BADCRL_BAD_PK", x509::VERIFICATION_FLAGS::BADCRL_BAD_PK, "The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA).") - .value("BADCRL_BAD_KEY", x509::VERIFICATION_FLAGS::BADCRL_BAD_KEY, "The CRL is signed with an unacceptable key (eg bad curve, RSA too short)."); - - LIEF::enum_(cls_x509, "KEY_TYPES", "Public key scheme used by the x509 certificate") - .value("NONE", x509::KEY_TYPES::NONE, "Unknown scheme") - .value("RSA", x509::KEY_TYPES::RSA, "RSA scheme") - .value("ECKEY", x509::KEY_TYPES::ECKEY, "Elliptic-curve scheme") - .value("ECKEY_DH", x509::KEY_TYPES::ECKEY_DH, "Elliptic-curve Diffie-Hellman") - .value("ECDSA", x509::KEY_TYPES::ECDSA, "Elliptic-curve Digital Signature Algorithm") - .value("RSA_ALT", x509::KEY_TYPES::RSA_ALT, "RSA scheme with an alternative implementation for signing and decrypting") - .value("RSASSA_PSS", x509::KEY_TYPES::RSASSA_PSS, "RSA Probabilistic signature scheme"); - - LIEF::enum_(cls_x509, "KEY_USAGE", "Key usage as defined in `RFC #5280 - section-4.2.1.3 `_") - .value("DIGITAL_SIGNATURE", x509::KEY_USAGE::DIGITAL_SIGNATURE, "The key is used for digital signature") - .value("NON_REPUDIATION", x509::KEY_USAGE::NON_REPUDIATION, "The key is used for digital signature AND to protects against falsely denying some action") - .value("KEY_ENCIPHERMENT", x509::KEY_USAGE::KEY_ENCIPHERMENT, "The key is used for enciphering private or secret keys") - .value("DATA_ENCIPHERMENT", x509::KEY_USAGE::DATA_ENCIPHERMENT, "The key is used for directly enciphering raw user data without the use of an intermediate symmetric cipher") - .value("KEY_AGREEMENT", x509::KEY_USAGE::KEY_AGREEMENT, "The Key is used for key agreement. (e.g. with Diffie-Hellman)") - .value("KEY_CERT_SIGN", x509::KEY_USAGE::KEY_CERT_SIGN, "The key is used for verifying signatures on public key certificates") - .value("CRL_SIGN", x509::KEY_USAGE::CRL_SIGN, "The key is used for verifying signatures on certificate revocation lists") - .value("ENCIPHER_ONLY", x509::KEY_USAGE::ENCIPHER_ONLY, "In **association with** KEY_AGREEMENT (otherwise the meaning is undefined), the key is only used for enciphering data while performing key agreement") - .value("DECIPHER_ONLY", x509::KEY_USAGE::DECIPHER_ONLY, "In **association with** KEY_AGREEMENT (otherwise the meaning is undefined), the key is only used for deciphering data while performing key agreement"); - - cls_x509 - .def_static("parse", - static_cast(&x509::parse), - "Parse " RST_CLASS_REF(lief.PE.x509) " certificate(s) from a file path given in the first parameter.\n" - "It returns a **list** of " RST_CLASS_REF(lief.PE.x509) " objects", - "path"_a) - - .def_static("parse", - static_cast&)>(&x509::parse), - "Parse " RST_CLASS_REF(lief.PE.x509) " certificate(s) from a raw blob given in the first parameter.\n" - "It returns a **list** of " RST_CLASS_REF(lief.PE.x509) " objects", - "raw"_a) - - .def_property_readonly("version", - &x509::version, - "X.509 version. (1=v1, 2=v2, 3=v3)") - - .def_property_readonly("serial_number", - [] (const x509& crt) -> py::bytes { - const std::vector& sn = crt.serial_number(); - return py::bytes(reinterpret_cast(sn.data()), sn.size()); - }, - "Unique id for certificate issued by a specific CA.") - - .def_property_readonly("signature_algorithm", - &x509::signature_algorithm, - "Signature algorithm (OID)") - - .def_property_readonly("valid_from", - &x509::valid_from, - "Start time of certificate validity") - - .def_property_readonly("valid_to", - &x509::valid_to, - "End time of certificate validity") - - .def_property_readonly("issuer", - [] (const x509& object) { - return safe_string_converter(object.issuer()); - }, - "Issuer of the certificate") - - .def_property_readonly("subject", - [] (const x509& object) { - return safe_string_converter(object.subject()); - }, - "Subject of the certificate") - - .def_property_readonly("raw", - [] (const x509& crt) -> py::bytes { - const std::vector& raw = crt.raw(); - return py::bytes(reinterpret_cast(raw.data()), raw.size()); - }, - "The raw bytes associated with this x509 cert (DER encoded)") - - .def_property_readonly("key_type", - &x509::key_type, - "Return the underlying public-key scheme (" RST_CLASS_REF(lief.PE.x509.KEY_TYPES) ")") - - .def_property_readonly("rsa_info", - &x509::rsa_info, - "If the underlying public-key scheme is RSA, return the " RST_CLASS_REF(lief.PE.RsaInfo) " associated with this certificate. " - "Otherwise, return None", - py::return_value_policy::take_ownership) - - .def_property_readonly("key_usage", - &x509::key_usage, - "Purpose of the key contained in the certificate (see " RST_CLASS_REF(lief.PE.x509.KEY_USAGE) ")") - - .def_property_readonly("ext_key_usage", - &x509::ext_key_usage, - "Indicates one or more purposes for which the certified public key may be used (list of OID)") - - .def_property_readonly("certificate_policies", - &x509::certificate_policies, - "Policy information terms as list of OID (see RFC #5280)") - - .def_property_readonly("is_ca", - &x509::is_ca) - - .def_property_readonly("signature", - [] (const x509& cert) -> py::bytes { - const std::vector& sig = cert.signature(); - return py::bytes(reinterpret_cast(sig.data()), sig.size()); - }, "The signature of the certificate") - - .def("verify", - static_cast(&x509::verify), - R"delim( - Verify that this certificate has been used **to trust** the given :class:`~lief.PE.x509` certificate - - It returns a set of flags defined by :class:`~lief.PE.x509.VERIFICATION_FLAGS` - - :Example: - - .. code-block:: python - - ca = lief.PE.x509.parse("ca.crt")[0] - signer = lief.PE.x509.parse("signer.crt")[0] - print(ca.verify(signer)) # lief.PE.x509.VERIFICATION_FLAGS.OK - - )delim", - "ca"_a) - - .def("is_trusted_by", - &x509::is_trusted_by, - R"delim( - Verify this certificate against a list of root CA (list of :class:`~lief.PE.x509` objects) - It returns a set of flags defined by :class:`~lief.PE.x509.VERIFICATION_FLAGS` - - :Example: - - .. code-block:: python - - signer = binary.signatures[0].signers[0] - microsoft_ca_bundle lief.PE.x509.parse("bundle.pem") - print(signer.cert.is_trusted_by(microsoft_ca_bundle)) - )delim", - "ca_list"_a) - - .def("__hash__", - [] (const x509& obj) { - return Hash::hash(obj); - }) - - .def("__str__", - [] (const x509& x509_crt) - { - std::ostringstream stream; - stream << x509_crt; - return safe_string_converter(stream.str()); - }); -} - -} -} - diff --git a/vendor/lief/api/python/PE/pyEnums.cpp b/vendor/lief/api/python/PE/pyEnums.cpp deleted file mode 100644 index 0769928..0000000 --- a/vendor/lief/api/python/PE/pyEnums.cpp +++ /dev/null @@ -1,1157 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "pyPE.hpp" -#define LIEF_PE_FORCE_UNDEF -#include "LIEF/PE/undef.h" -#include "LIEF/PE/enums.hpp" -#include "LIEF/PE/EnumToString.hpp" -#include "enums_wrapper.hpp" - -#define PY_ENUM(x) LIEF::PE::to_string(x), x - -namespace LIEF { -namespace PE { - - -void init_enums(py::module& m) { - - LIEF::enum_(m, "PE_TYPE") - .value(PY_ENUM(PE_TYPE::PE32)) - .value(PY_ENUM(PE_TYPE::PE32_PLUS)); - - LIEF::enum_(m, "MACHINE_TYPES") - .value(PY_ENUM(MACHINE_TYPES::MT_Invalid)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_UNKNOWN)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_AM33)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_AMD64)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_ARM)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_ARMNT)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_ARM64)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_EBC)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_I386)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_IA64)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_M32R)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_MIPS16)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_MIPSFPU)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_MIPSFPU16)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_POWERPC)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_POWERPCFP)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_R4000)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_SH3)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_SH3DSP)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_SH4)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_SH5)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_THUMB)) - .value(PY_ENUM(MACHINE_TYPES::IMAGE_FILE_MACHINE_WCEMIPSV2)); - - LIEF::enum_(m, "HEADER_CHARACTERISTICS", py::arithmetic()) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_RELOCS_STRIPPED)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_EXECUTABLE_IMAGE)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_LINE_NUMS_STRIPPED)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_LOCAL_SYMS_STRIPPED)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_AGGRESSIVE_WS_TRIM)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_LARGE_ADDRESS_AWARE)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_BYTES_REVERSED_LO)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_32BIT_MACHINE)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_DEBUG_STRIPPED)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_NET_RUN_FROM_SWAP)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_SYSTEM)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_DLL)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_UP_SYSTEM_ONLY)) - .value(PY_ENUM(HEADER_CHARACTERISTICS::IMAGE_FILE_BYTES_REVERSED_HI)); - - LIEF::enum_(m, "SUBSYSTEM") - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_UNKNOWN)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_NATIVE)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_WINDOWS_GUI)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_WINDOWS_CUI)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_OS2_CUI)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_POSIX_CUI)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_NATIVE_WINDOWS)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_WINDOWS_CE_GUI)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_EFI_APPLICATION)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_EFI_ROM)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_XBOX)) - .value(PY_ENUM(SUBSYSTEM::IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION)); - - LIEF::enum_(m, "DATA_DIRECTORY") - .value(PY_ENUM(DATA_DIRECTORY::EXPORT_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::IMPORT_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::RESOURCE_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::EXCEPTION_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::CERTIFICATE_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::BASE_RELOCATION_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::DEBUG)) - .value(PY_ENUM(DATA_DIRECTORY::ARCHITECTURE)) - .value(PY_ENUM(DATA_DIRECTORY::GLOBAL_PTR)) - .value(PY_ENUM(DATA_DIRECTORY::TLS_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::LOAD_CONFIG_TABLE)) - .value(PY_ENUM(DATA_DIRECTORY::BOUND_IMPORT)) - .value(PY_ENUM(DATA_DIRECTORY::IAT)) - .value(PY_ENUM(DATA_DIRECTORY::DELAY_IMPORT_DESCRIPTOR)) - .value(PY_ENUM(DATA_DIRECTORY::CLR_RUNTIME_HEADER)) - .value(PY_ENUM(DATA_DIRECTORY::RESERVED)); - - LIEF::enum_(m, "DLL_CHARACTERISTICS", py::arithmetic()) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NX_COMPAT)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NO_SEH)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_NO_BIND)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_APPCONTAINER)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_GUARD_CF)) - .value(PY_ENUM(DLL_CHARACTERISTICS::IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE)); - - - LIEF::enum_(m, "SECTION_CHARACTERISTICS", py::arithmetic()) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_TYPE_NO_PAD)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_CNT_CODE)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_CNT_INITIALIZED_DATA)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_CNT_UNINITIALIZED_DATA)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_OTHER)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_INFO)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_REMOVE)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_COMDAT)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_GPREL)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_PURGEABLE)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_16BIT)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_LOCKED)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_PRELOAD)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_1BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_2BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_4BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_8BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_16BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_32BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_64BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_128BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_256BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_512BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_1024BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_2048BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_4096BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_ALIGN_8192BYTES)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_LNK_NRELOC_OVFL)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_DISCARDABLE)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_NOT_CACHED)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_NOT_PAGED)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_SHARED)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_EXECUTE)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_READ)) - .value(PY_ENUM(SECTION_CHARACTERISTICS::IMAGE_SCN_MEM_WRITE)); - - LIEF::enum_(m, "SECTION_TYPES") - .value(PY_ENUM(PE_SECTION_TYPES::TEXT)) - .value(PY_ENUM(PE_SECTION_TYPES::TLS)) - .value(PY_ENUM(PE_SECTION_TYPES::IMPORT)) - .value(PY_ENUM(PE_SECTION_TYPES::DATA)) - .value(PY_ENUM(PE_SECTION_TYPES::BSS)) - .value(PY_ENUM(PE_SECTION_TYPES::RESOURCE)) - .value(PY_ENUM(PE_SECTION_TYPES::RELOCATION)) - .value(PY_ENUM(PE_SECTION_TYPES::EXPORT)) - .value(PY_ENUM(PE_SECTION_TYPES::UNKNOWN)); - - - LIEF::enum_(m, "SYMBOL_BASE_TYPES") - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_NULL)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_VOID)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_CHAR)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_SHORT)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_INT)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_LONG)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_FLOAT)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_DOUBLE)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_STRUCT)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_UNION)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_ENUM)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_MOE)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_BYTE)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_WORD)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_UINT)) - .value(PY_ENUM(SYMBOL_BASE_TYPES::IMAGE_SYM_TYPE_DWORD)); - - - LIEF::enum_(m, "SYMBOL_COMPLEX_TYPES") - .value(PY_ENUM(SYMBOL_COMPLEX_TYPES::IMAGE_SYM_DTYPE_NULL)) - .value(PY_ENUM(SYMBOL_COMPLEX_TYPES::IMAGE_SYM_DTYPE_POINTER)) - .value(PY_ENUM(SYMBOL_COMPLEX_TYPES::IMAGE_SYM_DTYPE_FUNCTION)) - .value(PY_ENUM(SYMBOL_COMPLEX_TYPES::IMAGE_SYM_DTYPE_ARRAY)) - .value(PY_ENUM(SYMBOL_COMPLEX_TYPES::SCT_COMPLEX_TYPE_SHIFT)); - - - LIEF::enum_(m, "SYMBOL_SECTION_NUMBER") - .value(PY_ENUM(SYMBOL_SECTION_NUMBER::IMAGE_SYM_DEBUG)) - .value(PY_ENUM(SYMBOL_SECTION_NUMBER::IMAGE_SYM_ABSOLUTE)) - .value(PY_ENUM(SYMBOL_SECTION_NUMBER::IMAGE_SYM_UNDEFINED)); - - - LIEF::enum_(m, "SYMBOL_STORAGE_CLASS") - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_END_OF_FUNCTION)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_NULL)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_AUTOMATIC)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_EXTERNAL)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_STATIC)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_REGISTER)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_EXTERNAL_DEF)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_LABEL)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_UNDEFINED_LABEL)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_MEMBER_OF_STRUCT)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_UNION_TAG)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_TYPE_DEFINITION)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_UNDEFINED_STATIC)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_ENUM_TAG)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_MEMBER_OF_ENUM)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_REGISTER_PARAM)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_BIT_FIELD)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_BLOCK)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_FUNCTION)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_END_OF_STRUCT)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_FILE)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_SECTION)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_WEAK_EXTERNAL)) - .value(PY_ENUM(SYMBOL_STORAGE_CLASS::IMAGE_SYM_CLASS_CLR_TOKEN)); - - - LIEF::enum_(m, "RELOCATIONS_BASE_TYPES") - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ABSOLUTE)) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGH)) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_LOW)) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGHLOW)) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGHADJ)) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_MIPS_JMPADDR)) - .value("ARM_MOV32A", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32A) - .value("ARM_MOV32", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32) - .value("RISCV_HI20", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_HI20) - .value("ARM_MOV32T", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32T) - .value("THUMB_MOV32", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_THUMB_MOV32) - .value("RISCV_LOW12I", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_LOW12I) - .value("RISCV_LOW12S", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_LOW12S) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_SECTION)) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_REL)) - .value("MIPS_JMPADDR16", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_MIPS_JMPADDR16) - .value("IA64_IMM64", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_IA64_IMM64) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_DIR64)) - .value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGH3ADJ)); - - - LIEF::enum_(m, "DEBUG_TYPES") - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_UNKNOWN)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_COFF)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_CODEVIEW)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_FPO)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_MISC)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_EXCEPTION)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_FIXUP)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_OMAP_TO_SRC)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_OMAP_FROM_SRC)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_BORLAND)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_CLSID)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_VC_FEATURE)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_POGO)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_ILTCG)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_MPX)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_REPRO)) - .value(PY_ENUM(DEBUG_TYPES::IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS)); - - - LIEF::enum_(m, "RESOURCE_TYPES") - .value(PY_ENUM(RESOURCE_TYPES::CURSOR)) - .value(PY_ENUM(RESOURCE_TYPES::BITMAP)) - .value(PY_ENUM(RESOURCE_TYPES::ICON)) - .value(PY_ENUM(RESOURCE_TYPES::MENU)) - .value(PY_ENUM(RESOURCE_TYPES::DIALOG)) - .value(PY_ENUM(RESOURCE_TYPES::STRING)) - .value(PY_ENUM(RESOURCE_TYPES::FONTDIR)) - .value(PY_ENUM(RESOURCE_TYPES::FONT)) - .value(PY_ENUM(RESOURCE_TYPES::ACCELERATOR)) - .value(PY_ENUM(RESOURCE_TYPES::RCDATA)) - .value(PY_ENUM(RESOURCE_TYPES::MESSAGETABLE)) - .value(PY_ENUM(RESOURCE_TYPES::GROUP_CURSOR)) - .value(PY_ENUM(RESOURCE_TYPES::GROUP_ICON)) - .value(PY_ENUM(RESOURCE_TYPES::VERSION)) - .value(PY_ENUM(RESOURCE_TYPES::DLGINCLUDE)) - .value(PY_ENUM(RESOURCE_TYPES::PLUGPLAY)) - .value(PY_ENUM(RESOURCE_TYPES::VXD)) - .value(PY_ENUM(RESOURCE_TYPES::ANICURSOR)) - .value(PY_ENUM(RESOURCE_TYPES::ANIICON)) - .value(PY_ENUM(RESOURCE_TYPES::HTML)) - .value(PY_ENUM(RESOURCE_TYPES::MANIFEST)); - - - LIEF::enum_(m, "RESOURCE_LANGS") - .value(PY_ENUM(RESOURCE_LANGS::LANG_NEUTRAL)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_INVARIANT)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_AFRIKAANS)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ALBANIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ARABIC)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ARMENIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ASSAMESE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_AZERI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_BASQUE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_BELARUSIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_BANGLA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_BULGARIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_CATALAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_CHINESE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_CROATIAN)) - .value("BOSNIAN", RESOURCE_LANGS::LANG_BOSNIAN) - .value(PY_ENUM(RESOURCE_LANGS::LANG_CZECH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_DANISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_DIVEHI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_DUTCH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ENGLISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ESTONIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_FAEROESE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_FARSI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_FINNISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_FRENCH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_GALICIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_GEORGIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_GERMAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_GREEK)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_GUJARATI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_HEBREW)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_HINDI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_HUNGARIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ICELANDIC)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_INDONESIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ITALIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_JAPANESE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_KANNADA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_KASHMIRI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_KAZAK)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_KONKANI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_KOREAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_KYRGYZ)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_LATVIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_LITHUANIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MACEDONIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MALAY)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MALAYALAM)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MANIPURI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MARATHI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MONGOLIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_NEPALI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_NORWEGIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ORIYA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_POLISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_PORTUGUESE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_PUNJABI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ROMANIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_RUSSIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SANSKRIT)) - .value("SERBIAN", RESOURCE_LANGS::LANG_SERBIAN) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SINDHI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SLOVAK)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SLOVENIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SPANISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SWAHILI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SWEDISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SYRIAC)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TAMIL)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TATAR)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TELUGU)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_THAI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TURKISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_UKRAINIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_URDU)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_UZBEK)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_VIETNAMESE)) - .value("GAELIC", RESOURCE_LANGS::LANG_GAELIC) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MALTESE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_MAORI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_RHAETO_ROMANCE)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SAMI)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SORBIAN)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_SUTU)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TSONGA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TSWANA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_VENDA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_XHOSA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ZULU)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_ESPERANTO)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_WALON)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_CORNISH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_WELSH)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_BRETON)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_INUKTITUT)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_IRISH)) - .value("LOWER_SORBIAN", RESOURCE_LANGS::LANG_LOWER_SORBIAN) - .value(PY_ENUM(RESOURCE_LANGS::LANG_PULAR)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_QUECHUA)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TAMAZIGHT)) - .value(PY_ENUM(RESOURCE_LANGS::LANG_TIGRINYA)) - .value("VALENCIAN", RESOURCE_LANGS::LANG_VALENCIAN); - - LIEF::enum_(m, "RESOURCE_SUBLANGS") - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_AFRIKAANS_SOUTH_AFRICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ALBANIAN_ALBANIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ALSATIAN_FRANCE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_AMHARIC_ETHIOPIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_ALGERIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_BAHRAIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_EGYPT)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_IRAQ)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_JORDAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_KUWAIT)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_LEBANON)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_LIBYA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_MOROCCO)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_OMAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_QATAR)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_SAUDI_ARABIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_SYRIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_TUNISIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_UAE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARABIC_YEMEN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ARMENIAN_ARMENIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ASSAMESE_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_AZERI_CYRILLIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_AZERI_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BASHKIR_RUSSIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BASQUE_BASQUE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BELARUSIAN_BELARUS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BANGLA_BANGLADESH)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BANGLA_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BRETON_FRANCE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_BULGARIAN_BULGARIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CATALAN_CATALAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CHINESE_HONGKONG)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CHINESE_MACAU)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CHINESE_SIMPLIFIED)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CHINESE_SINGAPORE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CHINESE_TRADITIONAL)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CORSICAN_FRANCE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CROATIAN_CROATIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CUSTOM_DEFAULT)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CUSTOM_UNSPECIFIED)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_CZECH_CZECH_REPUBLIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_DANISH_DENMARK)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_DARI_AFGHANISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_DEFAULT)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_DIVEHI_MALDIVES)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_DUTCH_BELGIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_DUTCH)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_AUS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_BELIZE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_CAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_CARIBBEAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_EIRE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_JAMAICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_MALAYSIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_NZ)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_PHILIPPINES)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_SINGAPORE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_SOUTH_AFRICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_TRINIDAD)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_UK)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_US)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_ZIMBABWE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ENGLISH_IRELAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ESTONIAN_ESTONIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FAEROESE_FAROE_ISLANDS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FILIPINO_PHILIPPINES)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FINNISH_FINLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FRENCH_BELGIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FRENCH_CANADIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FRENCH_LUXEMBOURG)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FRENCH_MONACO)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FRENCH_SWISS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FRENCH)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_FRISIAN_NETHERLANDS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GALICIAN_GALICIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GEORGIAN_GEORGIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GERMAN_AUSTRIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GERMAN_LIECHTENSTEIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GERMAN_LUXEMBOURG)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GERMAN_SWISS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GERMAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GREEK_GREECE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GREENLANDIC_GREENLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_GUJARATI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_HAUSA_NIGERIA_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_HEBREW_ISRAEL)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_HINDI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_HUNGARIAN_HUNGARY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ICELANDIC_ICELAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_IGBO_NIGERIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_INDONESIAN_INDONESIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_INUKTITUT_CANADA_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_INUKTITUT_CANADA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_IRISH_IRELAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ITALIAN_SWISS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ITALIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_JAPANESE_JAPAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KANNADA_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KASHMIRI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KASHMIRI_SASIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KAZAK_KAZAKHSTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KHMER_CAMBODIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KICHE_GUATEMALA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KINYARWANDA_RWANDA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KONKANI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KOREAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_KYRGYZ_KYRGYZSTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_LAO_LAO)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_LATVIAN_LATVIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_LITHUANIAN_CLASSIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_LITHUANIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_LOWER_SORBIAN_GERMANY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_LUXEMBOURGISH_LUXEMBOURG)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MACEDONIAN_MACEDONIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MALAY_BRUNEI_DARUSSALAM)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MALAY_MALAYSIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MALAYALAM_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MALTESE_MALTA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MAORI_NEW_ZEALAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MAPUDUNGUN_CHILE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MARATHI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MOHAWK_MOHAWK)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_MONGOLIAN_PRC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_NEPALI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_NEPALI_NEPAL)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_NEUTRAL)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_NORWEGIAN_BOKMAL)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_NORWEGIAN_NYNORSK)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_OCCITAN_FRANCE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ORIYA_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_PASHTO_AFGHANISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_PERSIAN_IRAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_POLISH_POLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_PORTUGUESE_BRAZILIAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_PORTUGUESE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_PUNJABI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_QUECHUA_BOLIVIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_QUECHUA_ECUADOR)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_QUECHUA_PERU)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ROMANIAN_ROMANIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ROMANSH_SWITZERLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_RUSSIAN_RUSSIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_INARI_FINLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_LULE_NORWAY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_LULE_SWEDEN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_NORTHERN_FINLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_NORTHERN_NORWAY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_NORTHERN_SWEDEN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_SKOLT_FINLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_SOUTHERN_NORWAY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SAMI_SOUTHERN_SWEDEN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SANSKRIT_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SERBIAN_CROATIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SERBIAN_CYRILLIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SERBIAN_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SINDHI_AFGHANISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SINDHI_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SINDHI_PAKISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SINHALESE_SRI_LANKA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SLOVAK_SLOVAKIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SLOVENIAN_SLOVENIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_ARGENTINA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_BOLIVIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_CHILE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_COLOMBIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_COSTA_RICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_DOMINICAN_REPUBLIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_ECUADOR)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_EL_SALVADOR)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_GUATEMALA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_HONDURAS)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_MEXICAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_MODERN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_NICARAGUA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_PANAMA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_PARAGUAY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_PERU)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_PUERTO_RICO)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_URUGUAY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_US)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH_VENEZUELA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SPANISH)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SWAHILI_KENYA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SWEDISH_FINLAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SWEDISH)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SYRIAC_SYRIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_SYS_DEFAULT)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TAJIK_TAJIKISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TAMAZIGHT_ALGERIA_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TAMIL_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TATAR_RUSSIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TELUGU_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_THAI_THAILAND)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TIBETAN_PRC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TIGRIGNA_ERITREA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TSWANA_SOUTH_AFRICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TURKISH_TURKEY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TURKMEN_TURKMENISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_UI_CUSTOM_DEFAULT)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_UIGHUR_PRC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_UKRAINIAN_UKRAINE)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_UPPER_SORBIAN_GERMANY)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_URDU_INDIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_URDU_PAKISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_UZBEK_CYRILLIC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_UZBEK_LATIN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_VIETNAMESE_VIETNAM)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_WELSH_UNITED_KINGDOM)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_WOLOF_SENEGAL)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_XHOSA_SOUTH_AFRICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_YAKUT_RUSSIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_YI_PRC)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_YORUBA_NIGERIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_ZULU_SOUTH_AFRICA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_PULAR_SENEGAL)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_PUNJABI_PAKISTAN)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TSWANA_BOTSWANA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TAMIL_SRI_LANKA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TIGRINYA_ETHIOPIA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_TIGRINYA_ERITREA)) - .value(PY_ENUM(RESOURCE_SUBLANGS::SUBLANG_VALENCIAN_VALENCIA)); - - LIEF::enum_(m, "EXTENDED_WINDOW_STYLES") - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_DLGMODALFRAME)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_NOPARENTNOTIFY)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_TOPMOST)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_ACCEPTFILES)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_TRANSPARENT)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_MDICHILD)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_TOOLWINDOW)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_WINDOWEDGE)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_CLIENTEDGE)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_CONTEXTHELP)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_RIGHT)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_LEFT)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_RTLREADING)) - .value("LTRREADING", EXTENDED_WINDOW_STYLES::WS_EX_LTRREADING) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_LEFTSCROLLBAR)) - .value("RIGHTSCROLLBAR", EXTENDED_WINDOW_STYLES::WS_EX_RIGHTSCROLLBAR) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_CONTROLPARENT)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_STATICEDGE)) - .value(PY_ENUM(EXTENDED_WINDOW_STYLES::WS_EX_APPWINDOW)); - - - - LIEF::enum_(m, "WINDOW_STYLES") - .value(PY_ENUM(WINDOW_STYLES::WS_OVERLAPPED)) - .value(PY_ENUM(WINDOW_STYLES::WS_POPUP)) - .value(PY_ENUM(WINDOW_STYLES::WS_CHILD)) - .value(PY_ENUM(WINDOW_STYLES::WS_MINIMIZE)) - .value(PY_ENUM(WINDOW_STYLES::WS_VISIBLE)) - .value(PY_ENUM(WINDOW_STYLES::WS_DISABLED)) - .value(PY_ENUM(WINDOW_STYLES::WS_CLIPSIBLINGS)) - .value(PY_ENUM(WINDOW_STYLES::WS_CLIPCHILDREN)) - .value(PY_ENUM(WINDOW_STYLES::WS_MAXIMIZE)) - .value(PY_ENUM(WINDOW_STYLES::WS_CAPTION)) - .value(PY_ENUM(WINDOW_STYLES::WS_BORDER)) - .value(PY_ENUM(WINDOW_STYLES::WS_DLGFRAME)) - .value(PY_ENUM(WINDOW_STYLES::WS_VSCROLL)) - .value(PY_ENUM(WINDOW_STYLES::WS_HSCROLL)) - .value(PY_ENUM(WINDOW_STYLES::WS_SYSMENU)) - .value(PY_ENUM(WINDOW_STYLES::WS_THICKFRAME)) - .value("GROUP", WINDOW_STYLES::WS_GROUP) - .value("TABSTOP", WINDOW_STYLES::WS_TABSTOP) - .value(PY_ENUM(WINDOW_STYLES::WS_MINIMIZEBOX)) - .value(PY_ENUM(WINDOW_STYLES::WS_MAXIMIZEBOX)); - - - LIEF::enum_(m, "DIALOG_BOX_STYLES") - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_ABSALIGN)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_SYSMODAL)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_LOCALEDIT)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_SETFONT)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_MODALFRAME)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_NOIDLEMSG)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_SETFOREGROUND)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_3DLOOK)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_FIXEDSYS)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_NOFAILCREATE)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_CONTROL)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_CENTER)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_CENTERMOUSE)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_CONTEXTHELP)) - .value(PY_ENUM(DIALOG_BOX_STYLES::DS_SHELLFONT)); - - - LIEF::enum_(m, "FIXED_VERSION_OS") - .value(PY_ENUM(FIXED_VERSION_OS::VOS_UNKNOWN)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_DOS)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_NT)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS__WINDOWS16)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS__WINDOWS32)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_OS216)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_OS232)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS__PM16)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS__PM32)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_DOS_WINDOWS16)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_DOS_WINDOWS32)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_NT_WINDOWS32)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_OS216_PM16)) - .value(PY_ENUM(FIXED_VERSION_OS::VOS_OS232_PM32)); - - LIEF::enum_(m, "FIXED_VERSION_FILE_FLAGS") - .value(PY_ENUM(FIXED_VERSION_FILE_FLAGS::VS_FF_DEBUG)) - .value(PY_ENUM(FIXED_VERSION_FILE_FLAGS::VS_FF_INFOINFERRED)) - .value(PY_ENUM(FIXED_VERSION_FILE_FLAGS::VS_FF_PATCHED)) - .value(PY_ENUM(FIXED_VERSION_FILE_FLAGS::VS_FF_PRERELEASE)) - .value(PY_ENUM(FIXED_VERSION_FILE_FLAGS::VS_FF_PRIVATEBUILD)) - .value(PY_ENUM(FIXED_VERSION_FILE_FLAGS::VS_FF_SPECIALBUILD)); - - - LIEF::enum_(m, "FIXED_VERSION_FILE_TYPES") - .value(PY_ENUM(FIXED_VERSION_FILE_TYPES::VFT_APP)) - .value(PY_ENUM(FIXED_VERSION_FILE_TYPES::VFT_DLL)) - .value(PY_ENUM(FIXED_VERSION_FILE_TYPES::VFT_DRV)) - .value(PY_ENUM(FIXED_VERSION_FILE_TYPES::VFT_FONT)) - .value(PY_ENUM(FIXED_VERSION_FILE_TYPES::VFT_STATIC_LIB)) - .value(PY_ENUM(FIXED_VERSION_FILE_TYPES::VFT_UNKNOWN)) - .value(PY_ENUM(FIXED_VERSION_FILE_TYPES::VFT_VXD)); - - - LIEF::enum_(m, "FIXED_VERSION_FILE_SUB_TYPES") - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_COMM)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_DISPLAY)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_INSTALLABLE)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_KEYBOARD)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_LANGUAGE)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_MOUSE)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_NETWORK)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_PRINTER)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_SOUND)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_SYSTEM)) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_DRV_VERSIONED_PRINTER)) - .value("FONT_RASTER", FIXED_VERSION_FILE_SUB_TYPES::VFT2_FONT_RASTER) - .value("FONT_TRUETYPE", FIXED_VERSION_FILE_SUB_TYPES::VFT2_FONT_TRUETYPE) - .value("FONT_VECTOR", FIXED_VERSION_FILE_SUB_TYPES::VFT2_FONT_VECTOR) - .value(PY_ENUM(FIXED_VERSION_FILE_SUB_TYPES::VFT2_UNKNOWN)); - - LIEF::enum_(m, "CODE_PAGES") - .value(PY_ENUM(CODE_PAGES::CP_IBM037)) - .value(PY_ENUM(CODE_PAGES::CP_IBM437)) - .value(PY_ENUM(CODE_PAGES::CP_IBM500)) - .value(PY_ENUM(CODE_PAGES::CP_ASMO_708)) - .value(PY_ENUM(CODE_PAGES::CP_DOS_720)) - .value(PY_ENUM(CODE_PAGES::CP_IBM737)) - .value(PY_ENUM(CODE_PAGES::CP_IBM775)) - .value(PY_ENUM(CODE_PAGES::CP_IBM850)) - .value(PY_ENUM(CODE_PAGES::CP_IBM852)) - .value(PY_ENUM(CODE_PAGES::CP_IBM855)) - .value(PY_ENUM(CODE_PAGES::CP_IBM857)) - .value(PY_ENUM(CODE_PAGES::CP_IBM00858)) - .value(PY_ENUM(CODE_PAGES::CP_IBM860)) - .value(PY_ENUM(CODE_PAGES::CP_IBM861)) - .value(PY_ENUM(CODE_PAGES::CP_DOS_862)) - .value(PY_ENUM(CODE_PAGES::CP_IBM863)) - .value(PY_ENUM(CODE_PAGES::CP_IBM864)) - .value(PY_ENUM(CODE_PAGES::CP_IBM865)) - .value(PY_ENUM(CODE_PAGES::CP_CP866)) - .value(PY_ENUM(CODE_PAGES::CP_IBM869)) - .value(PY_ENUM(CODE_PAGES::CP_IBM870)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_874)) - .value(PY_ENUM(CODE_PAGES::CP_CP875)) - .value(PY_ENUM(CODE_PAGES::CP_SHIFT_JIS)) - .value(PY_ENUM(CODE_PAGES::CP_GB2312)) - .value(PY_ENUM(CODE_PAGES::CP_KS_C_5601_1987)) - .value(PY_ENUM(CODE_PAGES::CP_BIG5)) - .value(PY_ENUM(CODE_PAGES::CP_IBM1026)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01047)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01140)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01141)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01142)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01143)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01144)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01145)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01146)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01147)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01148)) - .value(PY_ENUM(CODE_PAGES::CP_IBM01149)) - .value(PY_ENUM(CODE_PAGES::CP_UTF_16)) - .value(PY_ENUM(CODE_PAGES::CP_UNICODEFFFE)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1250)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1251)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1252)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1253)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1254)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1255)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1256)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1257)) - .value(PY_ENUM(CODE_PAGES::CP_WINDOWS_1258)) - .value(PY_ENUM(CODE_PAGES::CP_JOHAB)) - .value(PY_ENUM(CODE_PAGES::CP_MACINTOSH)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_JAPANESE)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_CHINESETRAD)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_KOREAN)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_ARABIC)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_HEBREW)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_GREEK)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_CYRILLIC)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_CHINESESIMP)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_ROMANIAN)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_UKRAINIAN)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_THAI)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_CE)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_ICELANDIC)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_TURKISH)) - .value(PY_ENUM(CODE_PAGES::CP_X_MAC_CROATIAN)) - .value(PY_ENUM(CODE_PAGES::CP_UTF_32)) - .value(PY_ENUM(CODE_PAGES::CP_UTF_32BE)) - .value(PY_ENUM(CODE_PAGES::CP_X_CHINESE_CNS)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20001)) - .value(PY_ENUM(CODE_PAGES::CP_X_CHINESE_ETEN)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20003)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20004)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20005)) - .value(PY_ENUM(CODE_PAGES::CP_X_IA5)) - .value(PY_ENUM(CODE_PAGES::CP_X_IA5_GERMAN)) - .value(PY_ENUM(CODE_PAGES::CP_X_IA5_SWEDISH)) - .value(PY_ENUM(CODE_PAGES::CP_X_IA5_NORWEGIAN)) - .value(PY_ENUM(CODE_PAGES::CP_US_ASCII)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20261)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20269)) - .value(PY_ENUM(CODE_PAGES::CP_IBM273)) - .value(PY_ENUM(CODE_PAGES::CP_IBM277)) - .value(PY_ENUM(CODE_PAGES::CP_IBM278)) - .value(PY_ENUM(CODE_PAGES::CP_IBM280)) - .value(PY_ENUM(CODE_PAGES::CP_IBM284)) - .value(PY_ENUM(CODE_PAGES::CP_IBM285)) - .value(PY_ENUM(CODE_PAGES::CP_IBM290)) - .value(PY_ENUM(CODE_PAGES::CP_IBM297)) - .value(PY_ENUM(CODE_PAGES::CP_IBM420)) - .value(PY_ENUM(CODE_PAGES::CP_IBM423)) - .value(PY_ENUM(CODE_PAGES::CP_IBM424)) - .value(PY_ENUM(CODE_PAGES::CP_X_EBCDIC_KOREANEXTENDED)) - .value(PY_ENUM(CODE_PAGES::CP_IBM_THAI)) - .value(PY_ENUM(CODE_PAGES::CP_KOI8_R)) - .value(PY_ENUM(CODE_PAGES::CP_IBM871)) - .value(PY_ENUM(CODE_PAGES::CP_IBM880)) - .value(PY_ENUM(CODE_PAGES::CP_IBM905)) - .value(PY_ENUM(CODE_PAGES::CP_IBM00924)) - .value(PY_ENUM(CODE_PAGES::CP_EUC_JP_JIS)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20936)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP20949)) - .value(PY_ENUM(CODE_PAGES::CP_CP1025)) - .value(PY_ENUM(CODE_PAGES::CP_KOI8_U)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_1)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_2)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_3)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_4)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_5)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_6)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_7)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_8)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_9)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_13)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_15)) - .value(PY_ENUM(CODE_PAGES::CP_X_EUROPA)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_8859_8_I)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_2022_JP)) - .value(PY_ENUM(CODE_PAGES::CP_CSISO2022JP)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_2022_JP_JIS)) - .value(PY_ENUM(CODE_PAGES::CP_ISO_2022_KR)) - .value(PY_ENUM(CODE_PAGES::CP_X_CP50227)) - .value(PY_ENUM(CODE_PAGES::CP_EUC_JP)) - .value(PY_ENUM(CODE_PAGES::CP_EUC_CN)) - .value(PY_ENUM(CODE_PAGES::CP_EUC_KR)) - .value(PY_ENUM(CODE_PAGES::CP_HZ_GB_2312)) - .value(PY_ENUM(CODE_PAGES::CP_GB18030)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_DE)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_BE)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_TA)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_TE)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_AS)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_OR)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_KA)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_MA)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_GU)) - .value(PY_ENUM(CODE_PAGES::CP_X_ISCII_PA)) - .value(PY_ENUM(CODE_PAGES::CP_UTF_7)) - .value(PY_ENUM(CODE_PAGES::CP_UTF_8)); - - LIEF::enum_(m, "WIN_VERSION") - .value(PY_ENUM(WIN_VERSION::WIN_UNKNOWN)) - .value(PY_ENUM(WIN_VERSION::WIN_SEH)) - .value(PY_ENUM(WIN_VERSION::WIN8_1)) - .value(PY_ENUM(WIN_VERSION::WIN10_0_9879)) - .value(PY_ENUM(WIN_VERSION::WIN10_0_14286)) - .value(PY_ENUM(WIN_VERSION::WIN10_0_14383)) - .value(PY_ENUM(WIN_VERSION::WIN10_0_14901)) - .value(PY_ENUM(WIN_VERSION::WIN10_0_15002)) - .value(PY_ENUM(WIN_VERSION::WIN10_0_16237)); - - LIEF::enum_(m, "GUARD_CF_FLAGS", py::arithmetic()) - .value(PY_ENUM(GUARD_CF_FLAGS::GCF_NONE)) - .value(PY_ENUM(GUARD_CF_FLAGS::GCF_INSTRUMENTED)) - .value(PY_ENUM(GUARD_CF_FLAGS::GCF_W_INSTRUMENTED)) - .value(PY_ENUM(GUARD_CF_FLAGS::GCF_FUNCTION_TABLE_PRESENT)) - .value(PY_ENUM(GUARD_CF_FLAGS::GCF_EXPORT_SUPPRESSION_INFO_PRESENT)) - .value(PY_ENUM(GUARD_CF_FLAGS::GCF_ENABLE_EXPORT_SUPPRESSION)) - .value(PY_ENUM(GUARD_CF_FLAGS::GCF_LONGJUMP_TABLE_PRESENT)) - .value(PY_ENUM(GUARD_CF_FLAGS::GRF_INSTRUMENTED)) - .value(PY_ENUM(GUARD_CF_FLAGS::GRF_ENABLE)) - .value(PY_ENUM(GUARD_CF_FLAGS::GRF_STRICT)); - - - LIEF::enum_(m, "CODE_VIEW_SIGNATURES") - .value(PY_ENUM(CODE_VIEW_SIGNATURES::CVS_UNKNOWN)) - .value(PY_ENUM(CODE_VIEW_SIGNATURES::CVS_PDB_70)) - .value(PY_ENUM(CODE_VIEW_SIGNATURES::CVS_PDB_20)) - .value(PY_ENUM(CODE_VIEW_SIGNATURES::CVS_CV_50)) - .value(PY_ENUM(CODE_VIEW_SIGNATURES::CVS_CV_41)); - - LIEF::enum_(m, "POGO_SIGNATURES") - .value(PY_ENUM(POGO_SIGNATURES::POGO_UNKNOWN)) - .value(PY_ENUM(POGO_SIGNATURES::POGO_LCTG)) - .value(PY_ENUM(POGO_SIGNATURES::POGO_PGI)); - - LIEF::enum_(m, "ACCELERATOR_FLAGS", py::arithmetic()) - .value(PY_ENUM(ACCELERATOR_FLAGS::FVIRTKEY)) - .value(PY_ENUM(ACCELERATOR_FLAGS::FNOINVERT)) - .value(PY_ENUM(ACCELERATOR_FLAGS::FSHIFT)) - .value(PY_ENUM(ACCELERATOR_FLAGS::FCONTROL)) - .value(PY_ENUM(ACCELERATOR_FLAGS::FALT)) - .value(PY_ENUM(ACCELERATOR_FLAGS::END)); - - LIEF::enum_(m, "ACCELERATOR_VK_CODES") - .value("VK_LBUTTON" , ACCELERATOR_VK_CODES::VK_LBUTTON) - .value("VK_RBUTTON" , ACCELERATOR_VK_CODES::VK_RBUTTON) - .value("VK_CANCEL" , ACCELERATOR_VK_CODES::VK_CANCEL) - .value("VK_MBUTTON" , ACCELERATOR_VK_CODES::VK_MBUTTON) - .value("VK_XBUTTON1" , ACCELERATOR_VK_CODES::VK_XBUTTON1) - .value("VK_XBUTTON2" , ACCELERATOR_VK_CODES::VK_XBUTTON2) - .value("VK_BACK" , ACCELERATOR_VK_CODES::VK_BACK) - .value("VK_TAB" , ACCELERATOR_VK_CODES::VK_TAB) - .value("VK_CLEAR" , ACCELERATOR_VK_CODES::VK_CLEAR) - .value("VK_RETURN" , ACCELERATOR_VK_CODES::VK_RETURN) - .value("VK_SHIFT" , ACCELERATOR_VK_CODES::VK_SHIFT) - .value("VK_CONTROL" , ACCELERATOR_VK_CODES::VK_CONTROL) - .value("VK_MENU" , ACCELERATOR_VK_CODES::VK_MENU) - .value("VK_PAUSE" , ACCELERATOR_VK_CODES::VK_PAUSE) - .value("VK_CAPITAL" , ACCELERATOR_VK_CODES::VK_CAPITAL) - .value("VK_KANA" , ACCELERATOR_VK_CODES::VK_KANA) - .value("VK_HANGUEL" , ACCELERATOR_VK_CODES::VK_HANGUEL) - .value("VK_HANGUL" , ACCELERATOR_VK_CODES::VK_HANGUL) - .value("VK_IME_ON" , ACCELERATOR_VK_CODES::VK_IME_ON) - .value("VK_JUNJA" , ACCELERATOR_VK_CODES::VK_JUNJA) - .value("VK_FINAL" , ACCELERATOR_VK_CODES::VK_FINAL) - .value("VK_HANJA" , ACCELERATOR_VK_CODES::VK_HANJA) - .value("VK_KANJI" , ACCELERATOR_VK_CODES::VK_KANJI) - .value("VK_IME_OFF" , ACCELERATOR_VK_CODES::VK_IME_OFF) - .value("VK_ESCAPE" , ACCELERATOR_VK_CODES::VK_ESCAPE) - .value("VK_CONVERT" , ACCELERATOR_VK_CODES::VK_CONVERT) - .value("VK_NONCONVERT" , ACCELERATOR_VK_CODES::VK_NONCONVERT) - .value("VK_ACCEPT" , ACCELERATOR_VK_CODES::VK_ACCEPT) - .value("VK_MODECHANGE" , ACCELERATOR_VK_CODES::VK_MODECHANGE) - .value("VK_SPACE" , ACCELERATOR_VK_CODES::VK_SPACE) - .value("VK_PRIOR" , ACCELERATOR_VK_CODES::VK_PRIOR) - .value("VK_NEXT" , ACCELERATOR_VK_CODES::VK_NEXT) - .value("VK_END" , ACCELERATOR_VK_CODES::VK_END) - .value("VK_HOME" , ACCELERATOR_VK_CODES::VK_HOME) - .value("VK_LEFT" , ACCELERATOR_VK_CODES::VK_LEFT) - .value("VK_UP" , ACCELERATOR_VK_CODES::VK_UP) - .value("VK_RIGHT" , ACCELERATOR_VK_CODES::VK_RIGHT) - .value("VK_DOWN" , ACCELERATOR_VK_CODES::VK_DOWN) - .value("VK_SELECT" , ACCELERATOR_VK_CODES::VK_SELECT) - .value("VK_PRINT" , ACCELERATOR_VK_CODES::VK_PRINT) - .value("VK_EXECUTE" , ACCELERATOR_VK_CODES::VK_EXECUTE) - .value("VK_SNAPSHOT" , ACCELERATOR_VK_CODES::VK_SNAPSHOT) - .value("VK_INSERT" , ACCELERATOR_VK_CODES::VK_INSERT) - .value("VK_DELETE" , ACCELERATOR_VK_CODES::VK_DELETE) - .value("VK_HELP" , ACCELERATOR_VK_CODES::VK_HELP) - .value("VK_0" , ACCELERATOR_VK_CODES::VK_0) - .value("VK_1" , ACCELERATOR_VK_CODES::VK_1) - .value("VK_2" , ACCELERATOR_VK_CODES::VK_2) - .value("VK_3" , ACCELERATOR_VK_CODES::VK_3) - .value("VK_4" , ACCELERATOR_VK_CODES::VK_4) - .value("VK_5" , ACCELERATOR_VK_CODES::VK_5) - .value("VK_6" , ACCELERATOR_VK_CODES::VK_6) - .value("VK_7" , ACCELERATOR_VK_CODES::VK_7) - .value("VK_8" , ACCELERATOR_VK_CODES::VK_8) - .value("VK_9" , ACCELERATOR_VK_CODES::VK_9) - .value("VK_A" , ACCELERATOR_VK_CODES::VK_A) - .value("VK_B" , ACCELERATOR_VK_CODES::VK_B) - .value("VK_C" , ACCELERATOR_VK_CODES::VK_C) - .value("VK_D" , ACCELERATOR_VK_CODES::VK_D) - .value("VK_E" , ACCELERATOR_VK_CODES::VK_E) - .value("VK_F" , ACCELERATOR_VK_CODES::VK_F) - .value("VK_G" , ACCELERATOR_VK_CODES::VK_G) - .value("VK_H" , ACCELERATOR_VK_CODES::VK_H) - .value("VK_I" , ACCELERATOR_VK_CODES::VK_I) - .value("VK_J" , ACCELERATOR_VK_CODES::VK_J) - .value("VK_K" , ACCELERATOR_VK_CODES::VK_K) - .value("VK_L" , ACCELERATOR_VK_CODES::VK_L) - .value("VK_M" , ACCELERATOR_VK_CODES::VK_M) - .value("VK_N" , ACCELERATOR_VK_CODES::VK_N) - .value("VK_O" , ACCELERATOR_VK_CODES::VK_O) - .value("VK_P" , ACCELERATOR_VK_CODES::VK_P) - .value("VK_Q" , ACCELERATOR_VK_CODES::VK_Q) - .value("VK_R" , ACCELERATOR_VK_CODES::VK_R) - .value("VK_S" , ACCELERATOR_VK_CODES::VK_S) - .value("VK_T" , ACCELERATOR_VK_CODES::VK_T) - .value("VK_U" , ACCELERATOR_VK_CODES::VK_U) - .value("VK_V" , ACCELERATOR_VK_CODES::VK_V) - .value("VK_W" , ACCELERATOR_VK_CODES::VK_W) - .value("VK_X" , ACCELERATOR_VK_CODES::VK_X) - .value("VK_Y" , ACCELERATOR_VK_CODES::VK_Y) - .value("VK_Z" , ACCELERATOR_VK_CODES::VK_Z) - .value("VK_LWIN" , ACCELERATOR_VK_CODES::VK_LWIN) - .value("VK_RWIN" , ACCELERATOR_VK_CODES::VK_RWIN) - .value("VK_APPS" , ACCELERATOR_VK_CODES::VK_APPS) - .value("VK_SLEEP" , ACCELERATOR_VK_CODES::VK_SLEEP) - .value("VK_NUMPAD0" , ACCELERATOR_VK_CODES::VK_NUMPAD0) - .value("VK_NUMPAD1" , ACCELERATOR_VK_CODES::VK_NUMPAD1) - .value("VK_NUMPAD2" , ACCELERATOR_VK_CODES::VK_NUMPAD2) - .value("VK_NUMPAD3" , ACCELERATOR_VK_CODES::VK_NUMPAD3) - .value("VK_NUMPAD4" , ACCELERATOR_VK_CODES::VK_NUMPAD4) - .value("VK_NUMPAD5" , ACCELERATOR_VK_CODES::VK_NUMPAD5) - .value("VK_NUMPAD6" , ACCELERATOR_VK_CODES::VK_NUMPAD6) - .value("VK_NUMPAD7" , ACCELERATOR_VK_CODES::VK_NUMPAD7) - .value("VK_NUMPAD8" , ACCELERATOR_VK_CODES::VK_NUMPAD8) - .value("VK_NUMPAD9" , ACCELERATOR_VK_CODES::VK_NUMPAD9) - .value("VK_MULTIPLY" , ACCELERATOR_VK_CODES::VK_MULTIPLY) - .value("VK_ADD" , ACCELERATOR_VK_CODES::VK_ADD) - .value("VK_SEPARATOR" , ACCELERATOR_VK_CODES::VK_SEPARATOR) - .value("VK_SUBTRACT" , ACCELERATOR_VK_CODES::VK_SUBTRACT) - .value("VK_DECIMAL" , ACCELERATOR_VK_CODES::VK_DECIMAL) - .value("VK_DIVIDE" , ACCELERATOR_VK_CODES::VK_DIVIDE) - .value("VK_F1" , ACCELERATOR_VK_CODES::VK_F1) - .value("VK_F2" , ACCELERATOR_VK_CODES::VK_F2) - .value("VK_F3" , ACCELERATOR_VK_CODES::VK_F3) - .value("VK_F4" , ACCELERATOR_VK_CODES::VK_F4) - .value("VK_F5" , ACCELERATOR_VK_CODES::VK_F5) - .value("VK_F6" , ACCELERATOR_VK_CODES::VK_F6) - .value("VK_F7" , ACCELERATOR_VK_CODES::VK_F7) - .value("VK_F8" , ACCELERATOR_VK_CODES::VK_F8) - .value("VK_F9" , ACCELERATOR_VK_CODES::VK_F9) - .value("VK_F10" , ACCELERATOR_VK_CODES::VK_F10) - .value("VK_F11" , ACCELERATOR_VK_CODES::VK_F11) - .value("VK_F12" , ACCELERATOR_VK_CODES::VK_F12) - .value("VK_F13" , ACCELERATOR_VK_CODES::VK_F13) - .value("VK_F14" , ACCELERATOR_VK_CODES::VK_F14) - .value("VK_F15" , ACCELERATOR_VK_CODES::VK_F15) - .value("VK_F16" , ACCELERATOR_VK_CODES::VK_F16) - .value("VK_F17" , ACCELERATOR_VK_CODES::VK_F17) - .value("VK_F18" , ACCELERATOR_VK_CODES::VK_F18) - .value("VK_F19" , ACCELERATOR_VK_CODES::VK_F19) - .value("VK_F20" , ACCELERATOR_VK_CODES::VK_F20) - .value("VK_F21" , ACCELERATOR_VK_CODES::VK_F21) - .value("VK_F22" , ACCELERATOR_VK_CODES::VK_F22) - .value("VK_F23" , ACCELERATOR_VK_CODES::VK_F23) - .value("VK_F24" , ACCELERATOR_VK_CODES::VK_F24) - .value("VK_NUMLOCK" , ACCELERATOR_VK_CODES::VK_NUMLOCK) - .value("VK_SCROLL" , ACCELERATOR_VK_CODES::VK_SCROLL) - .value("VK_LSHIFT" , ACCELERATOR_VK_CODES::VK_LSHIFT) - .value("VK_RSHIFT" , ACCELERATOR_VK_CODES::VK_RSHIFT) - .value("VK_LCONTROL" , ACCELERATOR_VK_CODES::VK_LCONTROL) - .value("VK_RCONTROL" , ACCELERATOR_VK_CODES::VK_RCONTROL) - .value("VK_LMENU" , ACCELERATOR_VK_CODES::VK_LMENU) - .value("VK_RMENU" , ACCELERATOR_VK_CODES::VK_RMENU) - .value("VK_BROWSER_BACK" , ACCELERATOR_VK_CODES::VK_BROWSER_BACK) - .value("VK_BROWSER_FORWARD" , ACCELERATOR_VK_CODES::VK_BROWSER_FORWARD) - .value("VK_BROWSER_REFRESH" , ACCELERATOR_VK_CODES::VK_BROWSER_REFRESH) - .value("VK_BROWSER_STOP" , ACCELERATOR_VK_CODES::VK_BROWSER_STOP) - .value("VK_BROWSER_SEARCH" , ACCELERATOR_VK_CODES::VK_BROWSER_SEARCH) - .value("VK_BROWSER_FAVORITES" , ACCELERATOR_VK_CODES::VK_BROWSER_FAVORITES) - .value("VK_BROWSER_HOME" , ACCELERATOR_VK_CODES::VK_BROWSER_HOME) - .value("VK_VOLUME_MUTE" , ACCELERATOR_VK_CODES::VK_VOLUME_MUTE) - .value("VK_VOLUME_DOWN" , ACCELERATOR_VK_CODES::VK_VOLUME_DOWN) - .value("VK_VOLUME_UP" , ACCELERATOR_VK_CODES::VK_VOLUME_UP) - .value("VK_MEDIA_NEXT_TRACK" , ACCELERATOR_VK_CODES::VK_MEDIA_NEXT_TRACK) - .value("VK_MEDIA_PREV_TRACK" , ACCELERATOR_VK_CODES::VK_MEDIA_PREV_TRACK) - .value("VK_MEDIA_STOP" , ACCELERATOR_VK_CODES::VK_MEDIA_STOP) - .value("VK_MEDIA_PLAY_PAUSE" , ACCELERATOR_VK_CODES::VK_MEDIA_PLAY_PAUSE) - .value("VK_LAUNCH_MAIL" , ACCELERATOR_VK_CODES::VK_LAUNCH_MAIL) - .value("VK_LAUNCH_MEDIA_SELECT" , ACCELERATOR_VK_CODES::VK_LAUNCH_MEDIA_SELECT) - .value("VK_LAUNCH_APP1" , ACCELERATOR_VK_CODES::VK_LAUNCH_APP1) - .value("VK_LAUNCH_APP2" , ACCELERATOR_VK_CODES::VK_LAUNCH_APP2) - .value("VK_OEM_1" , ACCELERATOR_VK_CODES::VK_OEM_1) - .value("VK_OEM_PLUS" , ACCELERATOR_VK_CODES::VK_OEM_PLUS) - .value("VK_OEM_COMMA" , ACCELERATOR_VK_CODES::VK_OEM_COMMA) - .value("VK_OEM_MINUS" , ACCELERATOR_VK_CODES::VK_OEM_MINUS) - .value("VK_OEM_PERIOD" , ACCELERATOR_VK_CODES::VK_OEM_PERIOD) - .value("VK_OEM_2" , ACCELERATOR_VK_CODES::VK_OEM_2) - .value("VK_OEM_4" , ACCELERATOR_VK_CODES::VK_OEM_4) - .value("VK_OEM_5" , ACCELERATOR_VK_CODES::VK_OEM_5) - .value("VK_OEM_6" , ACCELERATOR_VK_CODES::VK_OEM_6) - .value("VK_OEM_7" , ACCELERATOR_VK_CODES::VK_OEM_7) - .value("VK_OEM_8" , ACCELERATOR_VK_CODES::VK_OEM_8) - .value("VK_OEM_102" , ACCELERATOR_VK_CODES::VK_OEM_102) - .value("VK_PROCESSKEY" , ACCELERATOR_VK_CODES::VK_PROCESSKEY) - .value("VK_PACKET" , ACCELERATOR_VK_CODES::VK_PACKET) - .value("VK_ATTN" , ACCELERATOR_VK_CODES::VK_ATTN) - .value("VK_CRSEL" , ACCELERATOR_VK_CODES::VK_CRSEL) - .value("VK_EXSEL" , ACCELERATOR_VK_CODES::VK_EXSEL) - .value("VK_EREOF" , ACCELERATOR_VK_CODES::VK_EREOF) - .value("VK_PLAY" , ACCELERATOR_VK_CODES::VK_PLAY) - .value("VK_ZOOM" , ACCELERATOR_VK_CODES::VK_ZOOM) - .value("VK_NONAME" , ACCELERATOR_VK_CODES::VK_NONAME) - .value("VK_PA1" , ACCELERATOR_VK_CODES::VK_PA1) - .value("VK_OEM_CLEAR" , ACCELERATOR_VK_CODES::VK_OEM_CLEAR); - - LIEF::enum_(m, "ALGORITHMS") - .value(PY_ENUM(ALGORITHMS::UNKNOWN)) - .value(PY_ENUM(ALGORITHMS::SHA_512)) - .value(PY_ENUM(ALGORITHMS::SHA_384)) - .value(PY_ENUM(ALGORITHMS::SHA_256)) - .value(PY_ENUM(ALGORITHMS::SHA_1)) - .value(PY_ENUM(ALGORITHMS::MD5)) - .value(PY_ENUM(ALGORITHMS::MD4)) - .value(PY_ENUM(ALGORITHMS::MD2)) - .value(PY_ENUM(ALGORITHMS::RSA)) - .value(PY_ENUM(ALGORITHMS::EC)) - - .value(PY_ENUM(ALGORITHMS::MD5_RSA)) - .value(PY_ENUM(ALGORITHMS::SHA1_DSA)) - .value(PY_ENUM(ALGORITHMS::SHA1_RSA)) - - .value(PY_ENUM(ALGORITHMS::SHA_256_RSA)) - .value(PY_ENUM(ALGORITHMS::SHA_384_RSA)) - .value(PY_ENUM(ALGORITHMS::SHA_512_RSA)) - - .value(PY_ENUM(ALGORITHMS::SHA1_ECDSA)) - .value(PY_ENUM(ALGORITHMS::SHA_256_ECDSA)) - .value(PY_ENUM(ALGORITHMS::SHA_384_ECDSA)) - .value(PY_ENUM(ALGORITHMS::SHA_512_ECDSA)); - - - LIEF::enum_(m, "SIG_ATTRIBUTE_TYPES") - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::UNKNOWN)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::CONTENT_TYPE)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::GENERIC_TYPE)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::SPC_SP_OPUS_INFO)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::MS_COUNTER_SIGN)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::MS_SPC_NESTED_SIGN)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::MS_SPC_STATEMENT_TYPE)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::PKCS9_AT_SEQUENCE_NUMBER)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::PKCS9_COUNTER_SIGNATURE)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::PKCS9_MESSAGE_DIGEST)) - .value(PY_ENUM(SIG_ATTRIBUTE_TYPES::PKCS9_SIGNING_TIME)); -} - -} -} diff --git a/vendor/lief/api/python/PE/pyPE.cpp b/vendor/lief/api/python/PE/pyPE.cpp deleted file mode 100644 index 8ec6206..0000000 --- a/vendor/lief/api/python/PE/pyPE.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * Copyright 2017 - 2021 K. Nakagawa - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/PE/signature/OIDToString.hpp" - -#include "pyPE.hpp" - -namespace LIEF { -namespace PE { - -void init_python_module(py::module& m) { - py::module LIEF_PE_module = m.def_submodule("PE", "Python API for the LIEF's PE format"); - - init_enums(LIEF_PE_module); - init_objects(LIEF_PE_module); - init_utils(LIEF_PE_module); - - LIEF_PE_module.def("oid_to_string", - &oid_to_string, - "Convert an OID to a human-readable string"); - - - // Opaque containers - py::bind_vector>(m, "ListLangCodeItem"); - py::bind_map(m, "DictStringVersion"); -} - -void init_objects(py::module& m) { - CREATE(Parser, m); - - CREATE(DosHeader, m); - CREATE(Header, m); - CREATE(OptionalHeader, m); - CREATE(RichHeader, m); - CREATE(RichEntry, m); - CREATE(DataDirectory, m); - CREATE(Section, m); - CREATE(Relocation, m); - CREATE(RelocationEntry, m); - CREATE(Export, m); - CREATE(ExportEntry, m); - CREATE(TLS, m); - CREATE(Symbol, m); - CREATE(Debug, m); - CREATE(CodeView, m); - CREATE(CodeViewPDB, m); - CREATE(Pogo, m); - CREATE(PogoEntry, m); - CREATE(Import, m); - CREATE(ImportEntry, m); - CREATE(DelayImport, m); - CREATE(DelayImportEntry, m); - CREATE(ResourcesManager, m); - CREATE(ResourceNode, m); - CREATE(ResourceData, m); - CREATE(ResourceDirectory, m); - CREATE(ResourceVersion, m); - CREATE(ResourceStringFileInfo, m); - CREATE(ResourceFixedFileInfo, m); - CREATE(ResourceVarFileInfo, m); - CREATE(LangCodeItem, m); - CREATE(ResourceIcon, m); - CREATE(ResourceDialog, m); - CREATE(ResourceDialogItem, m); - CREATE(ResourceStringTable, m); - CREATE(ResourceAccelerator, m); - CREATE(Signature, m); - CREATE(RsaInfo, m); - CREATE(x509, m); - CREATE(ContentInfo, m); - CREATE(SignerInfo, m); - CREATE(CodeIntegrity, m); - CREATE(Attribute, m); - CREATE(ContentType, m); - CREATE(GenericType, m); - CREATE(MsSpcNestedSignature, m); - CREATE(MsSpcStatementType, m); - CREATE(PKCS9AtSequenceNumber, m); - CREATE(PKCS9CounterSignature, m); - CREATE(PKCS9MessageDigest, m); - CREATE(PKCS9SigningTime, m); - CREATE(SpcSpOpusInfo, m); - - CREATE(LoadConfiguration, m); - CREATE(LoadConfigurationV0, m); - CREATE(LoadConfigurationV1, m); - CREATE(LoadConfigurationV2, m); - CREATE(LoadConfigurationV3, m); - CREATE(LoadConfigurationV4, m); - CREATE(LoadConfigurationV5, m); - CREATE(LoadConfigurationV6, m); - CREATE(LoadConfigurationV7, m); - - CREATE(Binary, m); - CREATE(Builder, m); - -} - - -} -} diff --git a/vendor/lief/api/python/PE/pyPE.hpp b/vendor/lief/api/python/PE/pyPE.hpp deleted file mode 100644 index ae4c328..0000000 --- a/vendor/lief/api/python/PE/pyPE.hpp +++ /dev/null @@ -1,127 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * Copyright 2017 - 2021 K. Nakagawa - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_PE_H_ -#define PY_LIEF_PE_H_ - -#include -#include - -#include -#include - -#include "LIEF/PE.hpp" - -#include "pyLIEF.hpp" - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - -namespace LIEF { -namespace PE { - -template -void create(py::module&); - -void init_python_module(py::module& m); -void init_objects(py::module&); -void init_enums(py::module&); -void init_utils(py::module&); - -SPECIALIZE_CREATE(Parser); - -SPECIALIZE_CREATE(Binary); -SPECIALIZE_CREATE(DosHeader); -SPECIALIZE_CREATE(Header); -SPECIALIZE_CREATE(OptionalHeader); -SPECIALIZE_CREATE(RichHeader); -SPECIALIZE_CREATE(RichEntry); -SPECIALIZE_CREATE(DataDirectory); -SPECIALIZE_CREATE(Section); -SPECIALIZE_CREATE(Relocation); -SPECIALIZE_CREATE(RelocationEntry); -SPECIALIZE_CREATE(Export); -SPECIALIZE_CREATE(ExportEntry); -SPECIALIZE_CREATE(TLS); -SPECIALIZE_CREATE(Symbol); -SPECIALIZE_CREATE(Debug); -SPECIALIZE_CREATE(CodeView); -SPECIALIZE_CREATE(CodeViewPDB); -SPECIALIZE_CREATE(Pogo); -SPECIALIZE_CREATE(PogoEntry); -SPECIALIZE_CREATE(Import); -SPECIALIZE_CREATE(ImportEntry); -SPECIALIZE_CREATE(DelayImport); -SPECIALIZE_CREATE(DelayImportEntry); -SPECIALIZE_CREATE(ResourceNode); -SPECIALIZE_CREATE(ResourceData); -SPECIALIZE_CREATE(ResourceDirectory); -SPECIALIZE_CREATE(ResourcesManager); -SPECIALIZE_CREATE(ResourceVersion); -SPECIALIZE_CREATE(ResourceStringFileInfo); -SPECIALIZE_CREATE(ResourceFixedFileInfo); -SPECIALIZE_CREATE(ResourceVarFileInfo); -SPECIALIZE_CREATE(LangCodeItem); -SPECIALIZE_CREATE(ResourceIcon); -SPECIALIZE_CREATE(ResourceStringTable); -SPECIALIZE_CREATE(ResourceDialog); -SPECIALIZE_CREATE(ResourceDialogItem); -SPECIALIZE_CREATE(ResourceAccelerator); - -SPECIALIZE_CREATE(Signature); -SPECIALIZE_CREATE(RsaInfo); -SPECIALIZE_CREATE(x509); -SPECIALIZE_CREATE(SignerInfo); -SPECIALIZE_CREATE(Attribute); -SPECIALIZE_CREATE(ContentInfo); -SPECIALIZE_CREATE(ContentType); -SPECIALIZE_CREATE(GenericType); -SPECIALIZE_CREATE(MsSpcNestedSignature); -SPECIALIZE_CREATE(MsSpcStatementType); -SPECIALIZE_CREATE(PKCS9AtSequenceNumber); -SPECIALIZE_CREATE(PKCS9CounterSignature); -SPECIALIZE_CREATE(PKCS9MessageDigest); -SPECIALIZE_CREATE(PKCS9SigningTime); -SPECIALIZE_CREATE(SpcSpOpusInfo); - -SPECIALIZE_CREATE(CodeIntegrity); -SPECIALIZE_CREATE(LoadConfiguration); -SPECIALIZE_CREATE(LoadConfigurationV0); -SPECIALIZE_CREATE(LoadConfigurationV1); -SPECIALIZE_CREATE(LoadConfigurationV2); -SPECIALIZE_CREATE(LoadConfigurationV3); -SPECIALIZE_CREATE(LoadConfigurationV4); -SPECIALIZE_CREATE(LoadConfigurationV5); -SPECIALIZE_CREATE(LoadConfigurationV6); -SPECIALIZE_CREATE(LoadConfigurationV7); - -SPECIALIZE_CREATE(ResourcesManager); - -SPECIALIZE_CREATE(Builder); - -} -} - - -// Opaque containers -PYBIND11_MAKE_OPAQUE(std::vector) -using dict_langcode_item = std::map; -PYBIND11_MAKE_OPAQUE(dict_langcode_item) - -#endif diff --git a/vendor/lief/api/python/PE/pyUtils.cpp b/vendor/lief/api/python/PE/pyUtils.cpp deleted file mode 100644 index f376ef7..0000000 --- a/vendor/lief/api/python/PE/pyUtils.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPE.hpp" -#include "pyErr.hpp" - -#include "LIEF/PE/utils.hpp" - -namespace LIEF { -namespace PE { - -void init_utils(py::module& m) { - py::enum_(m, "IMPHASH_MODE", - "Enum to define the behavior of :func:`~lief.PE.get_imphash`") - .value("DEFAULT", IMPHASH_MODE::DEFAULT, "Default implementation") - .value("LIEF", IMPHASH_MODE::LIEF, "Same as DEFAULT") - .value("PEFILE", IMPHASH_MODE::PEFILE, "Use pefile algorithm") - .value("VT", IMPHASH_MODE::VT, "Same as PEFILE since Virus Total is using pefile"); - - m.def("is_pe", - static_cast(&is_pe), - "Check if the given file is a ``PE``", - "file"_a); - - m.def("is_pe", - static_cast&)>(&is_pe), - "Check if the given raw data is a ``PE``", - "raw"_a); - - m.def("get_type", - [] (const std::string& file) { - return error_or(static_cast (*)(const std::string&)>(&get_type), file); - }, - "If the input file is a ``PE`` one, return the " RST_CLASS_REF(lief.PE.PE_TYPE) " \n" - "If the function fails to determine the type, it returns a " RST_CLASS_REF(lief.lief_errors) "", - "file"_a); - - - m.def("get_type", - [] (const std::vector& raw) { - return error_or(static_cast (*)(const std::vector&)>(&get_type), raw); - }, - "If the input *raw* data represent a ``PE`` file, return the " RST_CLASS_REF(lief.PE.PE_TYPE) " \n" - "If the function fails to determine the type, it returns a " RST_CLASS_REF(lief.lief_errors) "", - "raw"_a); - - m.def("get_imphash", - &get_imphash, - R"delim( - Compute the hash of imported functions - - Properties of the hash generated: - - * Order agnostic - * Casse agnostic - * Ordinal (**in some extent**) agnostic - * - - If one needs the same output as Virus Total (i.e. pefile), you can use :attr:`~lief.PE.IMPHASH_MODE.PEFILE` - as second parameter. - - .. warning:: - The algorithm used to compute the *imphash* value has some variations compared to Yara, pefile, - VT implementation - - .. seealso:: - https://www.fireeye.com/blog/threat-research/2014/01/tracking-malware-import-hashing.html - )delim", - "binary"_a, "mode"_a = IMPHASH_MODE::DEFAULT); - - m.def("resolve_ordinals", - [] (const Import& import, bool strict = false, bool use_std = false) { - return error_or(resolve_ordinals, import, strict, use_std); - }, - "Take an " RST_CLASS_REF(lief.PE.Import) " as entry and try to resolve its ordinal imports\n\n" - - "The ``strict`` boolean parameter enables to throw a " RST_CLASS_REF(lief.not_found) " exception " - "if the ordinal can't be resolved. Otherwise it skips the entry.", - "import"_a, "strict"_a = false, "use_std"_a = false, - py::return_value_policy::copy); -} - -} -} diff --git a/vendor/lief/api/python/VDEX/CMakeLists.txt b/vendor/lief/api/python/VDEX/CMakeLists.txt deleted file mode 100644 index ffffd66..0000000 --- a/vendor/lief/api/python/VDEX/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -set(LIEF_PYTHON_VDEX_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyVDEX.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyUtils.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyHeader.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyParser.cpp" - "${CMAKE_CURRENT_LIST_DIR}/objects/pyFile.cpp" -) - -set(LIEF_PYTHON_VDEX_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyVDEX.hpp") - -source_group("Source Files\\VDEX" FILES ${LIEF_PYTHON_VDEX_SRC}) -source_group("Header Files\\VDEX" FILES ${LIEF_PYTHON_VDEX_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_VDEX_SRC}" "${LIEF_PYTHON_VDEX_HDR}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/../") - - diff --git a/vendor/lief/api/python/VDEX/objects/pyFile.cpp b/vendor/lief/api/python/VDEX/objects/pyFile.cpp deleted file mode 100644 index d347c09..0000000 --- a/vendor/lief/api/python/VDEX/objects/pyFile.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/VDEX/File.hpp" -#include "LIEF/VDEX/hash.hpp" - -#include "pyIterators.hpp" -#include "pyVDEX.hpp" - -namespace LIEF { -namespace VDEX { - -template -using no_const_getter = T (File::*)(); - -template -using no_const_func = T (File::*)(P); - -template -using getter_t = T (File::*)() const; - -template -using setter_t = void (File::*)(T); - -template<> -void create(py::module& m) { - - // File object - py::class_ file(m, "File", "VDEX File representation"); - - /* - * it_dex_files is also registered by OAT/pyBinary.cpp and pybind11 - * seems not able to see their (limited) scope such as it raises - * generic_type: type "it_dex_files" is already registered! - * - * NOTE(romain): I tried to add py::local_module in pyIterator.hpp without - * success - */ - try { - init_ref_iterator(file, "it_dex_files"); - } catch (const std::runtime_error&) {} - - file - .def_property_readonly("header", - static_cast>(&File::header), - "Return the VDEX " RST_CLASS_REF(lief.VDEX.Header) "", - py::return_value_policy::reference) - - .def_property_readonly("dex_files", - static_cast>(&File::dex_files), - "Return an iterator over " RST_CLASS_REF(lief.DEX.File) "", - py::return_value_policy::reference) - - .def_property_readonly("dex2dex_json_info", - &File::dex2dex_json_info) - - .def("__eq__", &File::operator==) - .def("__ne__", &File::operator!=) - .def("__hash__", - [] (const File& file) { - return Hash::hash(file); - }) - - - .def("__str__", - [] (const File& file) - { - std::ostringstream stream; - stream << file; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/VDEX/objects/pyHeader.cpp b/vendor/lief/api/python/VDEX/objects/pyHeader.cpp deleted file mode 100644 index a0e81a8..0000000 --- a/vendor/lief/api/python/VDEX/objects/pyHeader.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/VDEX/Header.hpp" -#include "LIEF/VDEX/hash.hpp" - -#include "pyVDEX.hpp" - -namespace LIEF { -namespace VDEX { - -template -using getter_t = T (Header::*)(void) const; - -template -using setter_t = void (Header::*)(T); - -template<> -void create
(py::module& m) { - - py::class_(m, "Header", "VDEX Header representation") - - .def_property_readonly("magic", - static_cast>(&Header::magic), - "Magic value used to identify VDEX") - - .def_property_readonly("version", - static_cast>(&Header::version), - "VDEX version number") - - .def_property_readonly("nb_dex_files", - static_cast>(&Header::nb_dex_files), - "Number of " RST_CLASS_REF(lief.DEX.File) " files registered") - - .def_property_readonly("dex_size", - static_cast>(&Header::dex_size), - "Size of **all** " RST_CLASS_REF(lief.DEX.File) "") - - .def_property_readonly("verifier_deps_size", - static_cast>(&Header::verifier_deps_size), - "Size of verifier deps section") - - .def_property_readonly("quickening_info_size", - static_cast>(&Header::quickening_info_size), - "Size of quickening info section") - - .def("__eq__", &Header::operator==) - .def("__ne__", &Header::operator!=) - .def("__hash__", - [] (const Header& header) { - return Hash::hash(header); - }) - - .def("__str__", - [] (const Header& header) - { - std::ostringstream stream; - stream << header; - std::string str = stream.str(); - return str; - }); -} - -} -} - diff --git a/vendor/lief/api/python/VDEX/objects/pyParser.cpp b/vendor/lief/api/python/VDEX/objects/pyParser.cpp deleted file mode 100644 index e7d87e9..0000000 --- a/vendor/lief/api/python/VDEX/objects/pyParser.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyVDEX.hpp" - -#include "LIEF/VDEX/Parser.hpp" - -#include - -namespace LIEF { -namespace VDEX { - -template<> -void create(py::module& m) { - - // Parser (Parser) - m.def("parse", - static_cast (*) (const std::string&)>(&Parser::parse), - "Parse the given filename and return a " RST_CLASS_REF(lief.VDEX.File) " object", - "filename"_a, - py::return_value_policy::take_ownership); - - m.def("parse", - static_cast (*) (const std::vector&, const std::string&)>(&Parser::parse), - "Parse the given raw data and return a " RST_CLASS_REF(lief.VDEX.File) " object", - "raw"_a, py::arg("name") = "", - py::return_value_policy::take_ownership); - - - m.def("parse", - [] (py::object byteio, const std::string& name) { - const auto& io = py::module::import("io"); - const auto& RawIOBase = io.attr("RawIOBase"); - const auto& BufferedIOBase = io.attr("BufferedIOBase"); - const auto& TextIOBase = io.attr("TextIOBase"); - - py::object rawio; - - - if (py::isinstance(byteio, RawIOBase)) { - rawio = byteio; - } - - else if (py::isinstance(byteio, BufferedIOBase)) { - rawio = byteio.attr("raw"); - } - - else if (py::isinstance(byteio, TextIOBase)) { - rawio = byteio.attr("buffer").attr("raw"); - } - - else { - throw py::type_error(py::repr(byteio).cast().c_str()); - } - - std::string raw_str = static_cast(rawio.attr("readall")()); - std::vector raw = { - std::make_move_iterator(std::begin(raw_str)), - std::make_move_iterator(std::end(raw_str))}; - - return LIEF::VDEX::Parser::parse(std::move(raw), name); - }, - "io"_a, - "name"_a = "", - py::return_value_policy::take_ownership); -} -} -} diff --git a/vendor/lief/api/python/VDEX/pyUtils.cpp b/vendor/lief/api/python/VDEX/pyUtils.cpp deleted file mode 100644 index 5112f5b..0000000 --- a/vendor/lief/api/python/VDEX/pyUtils.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyVDEX.hpp" - -#include "LIEF/VDEX/utils.hpp" - -namespace LIEF { -namespace VDEX { - -void init_utils(py::module& m) { - - m.def("is_vdex", - static_cast(&is_vdex), - "Check if the **file** given in parameter is an VDEX", - "path"_a); - - m.def("is_vdex", - static_cast&)>(&is_vdex), - "Check if the **raw data** given in parameter is a VDEX", - "raw"_a); - - m.def("version", - static_cast(&version), - "Return the VDEX version of the **file** given in parameter", - "file"_a); - - m.def("version", - static_cast&)>(&version), - "Return the VDEX version of the **raw data** given in parameter", - "raw"_a); - - m.def("android_version", - &android_version, - "Return the " RST_CLASS_REF(lief.Android.ANDROID_VERSIONS) " associated with the given VDEX version ", - "vdex_version"_a); -} - -} -} - diff --git a/vendor/lief/api/python/VDEX/pyVDEX.cpp b/vendor/lief/api/python/VDEX/pyVDEX.cpp deleted file mode 100644 index 44ddc0e..0000000 --- a/vendor/lief/api/python/VDEX/pyVDEX.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyVDEX.hpp" - - -namespace LIEF { -namespace VDEX { -void init_python_module(py::module& m) { - py::module LIEF_VDEX_module = m.def_submodule("VDEX", "Python API for VDEX format"); - - init_objects(LIEF_VDEX_module); - init_utils(LIEF_VDEX_module); -} - - -void init_objects(py::module& m) { - CREATE(Parser, m); - CREATE(File, m); - CREATE(Header, m); -} - -} -} diff --git a/vendor/lief/api/python/VDEX/pyVDEX.hpp b/vendor/lief/api/python/VDEX/pyVDEX.hpp deleted file mode 100644 index 05da5f6..0000000 --- a/vendor/lief/api/python/VDEX/pyVDEX.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_VDEX_H_ -#define PY_LIEF_VDEX_H_ - -#include "LIEF/VDEX.hpp" - -#include "pyLIEF.hpp" - -#define SPECIALIZE_CREATE(X) \ - template<> \ - void create(py::module&) - -#define CREATE(X,Y) create(Y) - - -namespace LIEF { -namespace VDEX { - -template -void create(py::module&); - -void init_python_module(py::module& m); - -void init_objects(py::module&); - -void init_utils(py::module&); - - -SPECIALIZE_CREATE(Parser); -SPECIALIZE_CREATE(File); -SPECIALIZE_CREATE(Header); - -} -} - - -#endif diff --git a/vendor/lief/api/python/encoding.cpp b/vendor/lief/api/python/encoding.cpp deleted file mode 100644 index eded042..0000000 --- a/vendor/lief/api/python/encoding.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "encoding.hpp" - -py::object safe_string_converter(const std::string& str) { - auto global = py::dict(py::module::import("__main__").attr("__dict__")); - auto local = py::dict(); - py::bytes name_bytes = py::bytes(str); - local["name_bytes"] = name_bytes; - -#if PY_MAJOR_VERSION >= 3 - py::eval(R"( -encodings = ["big5", "big5hkscs", "cp037", "cp424", "cp437", "cp500", "cp737", "cp775", "cp850", "cp852", "cp855", - "cp856", "cp857", "cp860", "cp861", "cp862", "cp863", "cp864", "cp865", "cp866", "cp869", "cp874", "cp875", "cp932", "cp949", - "cp950", "cp1006", "cp1026", "cp1140", "cp1250", "cp1251", "cp1252", "cp1253", "cp1254", "cp1255", "cp1256", "cp1257", "cp1258", - "euc_jp", "euc_jis_2004", "euc_jisx0213", "euc_kr", "gb2312", "gbk", "gb18030", "hz", "iso2022_jp", "iso2022_jp_1", "iso2022_jp_2", - "iso2022_jp_2004", "iso2022_jp_3", "iso2022_jp_ext", "iso2022_kr", "latin_1", "iso8859_2", "iso8859_3", "iso8859_4", "iso8859_5", - "iso8859_6", "iso8859_7", "iso8859_8", "iso8859_9", "iso8859_10", "iso8859_13", "iso8859_14", "iso8859_15", "johab", "koi8_r", "koi8_u", - "mac_cyrillic", "mac_greek", "mac_iceland", "mac_latin2", "mac_roman", "mac_turkish", "ptcp154", "shift_jis", "shift_jis_2004", - "shift_jisx0213", "utf_32", "utf_32_be", "utf_32_le", "utf_16", "utf_16_be", "utf_16_le", "utf_7", "utf_8_sig" ] -for e in encodings: - try: - name_str = name_bytes.decode(e) - break - except (UnicodeEncodeError, UnicodeDecodeError) as e: - continue -name_str = name_bytes.decode('ascii', 'backslashreplace') - )", global, local); -#else - py::eval(R"( -def handler(err): - start = err.start - end = err.end - return (u"".join([u"\\x{0:02x}".format(ord(err.object[i])) for i in range(start,end)]),end) -import codecs -codecs.register_error('backslashreplace_', handler) -name_str = name_bytes.decode('ascii', 'backslashreplace_') - )", global, local); -#endif - return local["name_str"]; -} diff --git a/vendor/lief/api/python/encoding.hpp b/vendor/lief/api/python/encoding.hpp deleted file mode 100644 index 1dac00c..0000000 --- a/vendor/lief/api/python/encoding.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ENCODING_H_ -#define PY_LIEF_ENCODING_H_ - - -#include -#include - -namespace py = pybind11; - -py::object safe_string_converter(const std::string& str); - -#endif diff --git a/vendor/lief/api/python/enums_wrapper.hpp b/vendor/lief/api/python/enums_wrapper.hpp deleted file mode 100644 index 68c5c17..0000000 --- a/vendor/lief/api/python/enums_wrapper.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ENUMS_WRAPPER_H_ -#define PY_LIEF_ENUMS_WRAPPER_H_ -#include -#include - -#include "LIEF/visibility.h" - -namespace py = pybind11; - -namespace LIEF { - -template -class LIEF_LOCAL enum_ : public pybind11::enum_ { - public: - using py::enum_::def; - using py::enum_::def_property_readonly_static; - using Scalar = typename py::enum_::Scalar; - - template - enum_(const py::handle &scope, const char *name, const Extra&... extra) : - py::enum_{scope, name, extra...} - { - constexpr bool is_arithmetic = py::detail::any_of...>::value; - def("__eq__", [](const Type &value, Scalar value2) { return (Scalar) value == value2; }); - def("__ne__", [](const Type &value, Scalar value2) { return (Scalar) value != value2; }); - if (is_arithmetic) { - def("__lt__", [](const Type &value, Scalar value2) { return (Scalar) value < value2; }); - def("__gt__", [](const Type &value, Scalar value2) { return (Scalar) value > value2; }); - def("__le__", [](const Type &value, Scalar value2) { return (Scalar) value <= value2; }); - def("__ge__", [](const Type &value, Scalar value2) { return (Scalar) value >= value2; }); - def("__invert__", [](const Type &value) { return ~((Scalar) value); }); - def("__and__", [](const Type &value, Scalar value2) { return (Scalar) value & value2; }); - def("__or__", [](const Type &value, Scalar value2) { return (Scalar) value | value2; }); - def("__xor__", [](const Type &value, Scalar value2) { return (Scalar) value ^ value2; }); - def("__rand__", [](const Type &value, Scalar value2) { return (Scalar) value & value2; }); - def("__ror__", [](const Type &value, Scalar value2) { return (Scalar) value | value2; }); - def("__rxor__", [](const Type &value, Scalar value2) { return (Scalar) value ^ value2; }); - def("__and__", [](const Type &value, const Type &value2) { return (Scalar) value & (Scalar) value2; }); - def("__or__", [](const Type &value, const Type &value2) { return (Scalar) value | (Scalar) value2; }); - def("__xor__", [](const Type &value, const Type &value2) { return (Scalar) value ^ (Scalar) value2; }); - } - } -}; - -} - -#endif diff --git a/vendor/lief/api/python/platforms/CMakeLists.txt b/vendor/lief/api/python/platforms/CMakeLists.txt deleted file mode 100644 index 98d74f4..0000000 --- a/vendor/lief/api/python/platforms/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(LIEF_PYTHON_PLATFORM_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyPlatform.cpp" -) - -set(LIEF_PYTHON_PLATFORM_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyPlatform.hpp") - -source_group("Source Files\\Platform" FILES ${LIEF_PYTHON_PLATFORM_SRC}) -source_group("Header Files\\Platform" FILES ${LIEF_PYTHON_PLATFORM_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_PLATFORM_HDR}" "${LIEF_PYTHON_PLATFORM_SRC}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/../") - -include("${CMAKE_CURRENT_LIST_DIR}/android/CMakeLists.txt") diff --git a/vendor/lief/api/python/platforms/android/CMakeLists.txt b/vendor/lief/api/python/platforms/android/CMakeLists.txt deleted file mode 100644 index 43a3475..0000000 --- a/vendor/lief/api/python/platforms/android/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(LIEF_PYTHON_ANDROID_SRC - "${CMAKE_CURRENT_LIST_DIR}/pyAndroid.cpp" - "${CMAKE_CURRENT_LIST_DIR}/pyVersion.cpp" -) - -set(LIEF_PYTHON_ANDROID_HDR - "${CMAKE_CURRENT_LIST_DIR}/pyAndroid.hpp") - -source_group("Source Files\\Android" FILES ${LIEF_PYTHON_ANDROID_SRC}) -source_group("Header Files\\Android" FILES ${LIEF_PYTHON_ANDROID_HDR}) - -target_sources(pyLIEF PRIVATE "${LIEF_PYTHON_ANDROID_SRC}" "${LIEF_PYTHON_ANDROID_HDR}") -target_include_directories(pyLIEF PUBLIC "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/../../") - diff --git a/vendor/lief/api/python/platforms/android/pyAndroid.cpp b/vendor/lief/api/python/platforms/android/pyAndroid.cpp deleted file mode 100644 index ed93771..0000000 --- a/vendor/lief/api/python/platforms/android/pyAndroid.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyAndroid.hpp" - -namespace LIEF { -namespace Android { - -void init_python_module(py::module& m) { - py::module lief_android_module = m.def_submodule("Android", "Python API for Android platform"); - - init_versions(lief_android_module); - -} - -} -} diff --git a/vendor/lief/api/python/platforms/android/pyAndroid.hpp b/vendor/lief/api/python/platforms/android/pyAndroid.hpp deleted file mode 100644 index 3cf50a9..0000000 --- a/vendor/lief/api/python/platforms/android/pyAndroid.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ANDROID_H_ -#define PY_LIEF_ANDROID_H_ - -#include "LIEF/platforms/android.hpp" -#include "pyLIEF.hpp" - -namespace LIEF { -namespace Android { - -void init_python_module(py::module&); -void init_versions(py::module&); - -} -} - -#endif diff --git a/vendor/lief/api/python/platforms/android/pyVersion.cpp b/vendor/lief/api/python/platforms/android/pyVersion.cpp deleted file mode 100644 index d2a2da2..0000000 --- a/vendor/lief/api/python/platforms/android/pyVersion.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyAndroid.hpp" -#include "LIEF/platforms/android/version.hpp" - -#define PY_ENUM(x) to_string(x), x - -namespace LIEF { -namespace Android { - -void init_versions(py::module& m) { - py::enum_(m, "ANDROID_VERSIONS") - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_UNKNOWN)) - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_601)) - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_700)) - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_710)) - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_712)) - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_800)) - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_810)) - .value(PY_ENUM(ANDROID_VERSIONS::VERSION_900)); - - m.def("code_name", - &code_name, - "Return the Android code associated with a " RST_CLASS_REF(lief.Android.ANDROID_VERSIONS) ".\n" - - "For example: ``Nougat``", - "version"_a); - - m.def("version_string", - &version_string, - "Return the " RST_CLASS_REF(lief.Android.ANDROID_VERSIONS) " as a string.\n" - - "For example: ``7.0.1``", - "version"_a); -} - -} -} diff --git a/vendor/lief/api/python/platforms/pyPlatform.cpp b/vendor/lief/api/python/platforms/pyPlatform.cpp deleted file mode 100644 index 8a9e645..0000000 --- a/vendor/lief/api/python/platforms/pyPlatform.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyPlatform.hpp" -#include "enums_wrapper.hpp" - -namespace LIEF { - -void init_python_platforms(py::module& m) { - LIEF::enum_(m, "PLATFORMS") - .value("UNKNOWN", PLATFORMS::UNKNOWN) - .value("LINUX", PLATFORMS::LINUX) - .value("ANDROID", PLATFORMS::ANDROID_PLAT) - .value("WINDOWS", PLATFORMS::WINDOWS) - .value("IOS", PLATFORMS::IOS) - .value("OSX", PLATFORMS::OSX); - - m.def("current_platform", ¤t_platform, - "Return the current plaform (Linux, Windows, ...) as a :attr:`lief.PLATFORMS` enum"); - -} - -} diff --git a/vendor/lief/api/python/platforms/pyPlatform.hpp b/vendor/lief/api/python/platforms/pyPlatform.hpp deleted file mode 100644 index 5b8eeb8..0000000 --- a/vendor/lief/api/python/platforms/pyPlatform.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_PLATFORM_H_ -#define PY_LIEF_PLATFORM_H_ - -#include "LIEF/platforms.hpp" -#include "pyLIEF.hpp" - -namespace LIEF { - -void init_python_platforms(py::module&); - -} - -#endif diff --git a/vendor/lief/api/python/pyErr.cpp b/vendor/lief/api/python/pyErr.cpp deleted file mode 100644 index b40054a..0000000 --- a/vendor/lief/api/python/pyErr.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyErr.hpp" - -void init_LIEF_errors(py::module& m) { - py::class_(m, "ok_t", - R"delim( - Opaque value returned when a **void** function - is executed successfully. - )delim") - .def("__bool__", [] (const LIEF::ok_t& ok) { return true; }); - - py::enum_(m, "lief_errors", R"delim( - Enum class which represents an error generated by LIEF's functions - )delim") - .value("read_error", lief_errors::read_error) - .value("not_found", lief_errors::not_found) - .value("not_implemented", lief_errors::not_implemented) - .value("not_supported", lief_errors::not_supported) - .value("corrupted", lief_errors::corrupted) - .value("conversion_error", lief_errors::conversion_error) - .value("read_out_of_bound", lief_errors::read_out_of_bound) - .value("asn1_bad_tag", lief_errors::asn1_bad_tag) - .value("file_error", lief_errors::file_error) - .value("file_format_error", lief_errors::file_format_error) - .value("parsing_error", lief_errors::parsing_error) - .value("build_error", lief_errors::build_error) - .value("data_too_large", lief_errors::data_too_large) - ; -} diff --git a/vendor/lief/api/python/pyErr.hpp b/vendor/lief/api/python/pyErr.hpp deleted file mode 100644 index aebeb82..0000000 --- a/vendor/lief/api/python/pyErr.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ERR_H_ -#define PY_LIEF_ERR_H_ -#include -#include "LIEF/errors.hpp" - -namespace py = pybind11; - - -template >{}, int> = 0> -py::object error_or(Func f, Ts&&... args) { - auto&& ret = f(std::forward(args)...); - if (!ret) { - return py::cast(LIEF::as_lief_err(ret)); - } - return py::cast(ret.value()); -} - - -template >{}, int> = 0> -py::object error_or(Func f, Ts&&... args) { - auto&& ret = std::mem_fn(f)(std::forward(args)...); - if (!ret) { - return py::cast(LIEF::as_lief_err(ret)); - } - return py::cast(ret.value()); -} - - -void init_LIEF_errors(py::module&); - -#endif diff --git a/vendor/lief/api/python/pyExceptions.cpp b/vendor/lief/api/python/pyExceptions.cpp deleted file mode 100644 index adca363..0000000 --- a/vendor/lief/api/python/pyExceptions.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyLIEF.hpp" -#include "LIEF/exception.hpp" - -void init_LIEF_exceptions(py::module& m) { - auto& exception = py::register_exception(m, "exception"); - auto& bad_file = py::register_exception(m, "bad_file", exception.ptr()); - py::register_exception(m, "bad_format", bad_file.ptr()); - py::register_exception(m, "not_implemented", exception.ptr()); - py::register_exception(m, "not_supported", exception.ptr()); - py::register_exception(m, "read_out_of_bound", exception.ptr()); - py::register_exception(m, "integrity_error", exception.ptr()); - py::register_exception(m, "not_found", exception.ptr()); - py::register_exception(m, "corrupted", exception.ptr()); - py::register_exception(m, "conversion_error", exception.ptr()); - py::register_exception(m, "type_error", exception.ptr()); - py::register_exception(m, "builder_error", exception.ptr()); - py::register_exception(m, "parser_error", exception.ptr()); - auto& pe_error = py::register_exception(m, "pe_error", exception.ptr()); - py::register_exception(m, "pe_bad_section_name", pe_error.ptr()); -} diff --git a/vendor/lief/api/python/pyHash.cpp b/vendor/lief/api/python/pyHash.cpp deleted file mode 100644 index a0cfdd7..0000000 --- a/vendor/lief/api/python/pyHash.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/config.h" -#include "LIEF/hash.hpp" - -#include "pyLIEF.hpp" - -void init_hash_functions(py::module& m) { - m.def("hash", static_cast(&LIEF::hash)); - m.def("hash", static_cast&)>(&LIEF::hash)); - m.def("hash", - [] (py::bytes bytes) { - std::string x = bytes; - std::vector data = {std::begin(x), std::end(x)}; - return LIEF::hash(data); - }); - - m.def("hash", - [] (const std::string& bytes) { - std::vector data = {std::begin(bytes), std::end(bytes)}; - return LIEF::hash(data); - }); -} diff --git a/vendor/lief/api/python/pyIterators.hpp b/vendor/lief/api/python/pyIterators.hpp deleted file mode 100644 index ac4d52a..0000000 --- a/vendor/lief/api/python/pyIterators.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_ITERATORS_H_ -#define PY_LIEF_ITERATORS_H_ -#include - -#include "LIEF/LIEF.hpp" - -namespace py = pybind11; - -template -void init_ref_iterator(py::handle& m, const char* it_name) { - py::class_(m, it_name) - .def("__getitem__", - [](T& v, size_t i) -> typename T::reference { - if (i >= v.size()) - throw py::index_error(); - return v[i]; - }, - py::return_value_policy::reference_internal, py::keep_alive<1, 0>()) - - .def("__len__", - [] (T& v) { - return v.size(); - }) - - .def("__iter__", - [] (const T& v) { - return py::make_iterator(std::begin(v), std::end(v)); - }, py::keep_alive<0, 1>()) - - .def("__next__", - [] (T& v) -> typename T::reference { - if (v == std::end(v)) { - throw py::stop_iteration(); - } - return *(v++); - }, py::return_value_policy::reference_internal, py::keep_alive<1, 0>()); - - - -} - -#endif diff --git a/vendor/lief/api/python/pyJson.cpp b/vendor/lief/api/python/pyJson.cpp deleted file mode 100644 index d7a6b52..0000000 --- a/vendor/lief/api/python/pyJson.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/config.h" -#include "LIEF/json.hpp" -#include "LIEF/Abstract/json.hpp" -#include "LIEF/Object.hpp" - -#include "pyLIEF.hpp" - -void init_json_functions(py::module& m) { - m.def("to_json", &LIEF::to_json); - m.def("to_json_from_abstract", &LIEF::to_json_from_abstract); -} diff --git a/vendor/lief/api/python/pyLIEF.cpp b/vendor/lief/api/python/pyLIEF.cpp deleted file mode 100644 index 9790351..0000000 --- a/vendor/lief/api/python/pyLIEF.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "LIEF/logging.hpp" -#include "LIEF/version.h" -#include "pyLIEF.hpp" -#include "pyAbstract.hpp" - -#if defined(LIEF_ELF_SUPPORT) - #include "ELF/pyELF.hpp" -#endif - -#if defined(LIEF_PE_SUPPORT) - #include "PE/pyPE.hpp" -#endif - -#if defined(LIEF_MACHO_SUPPORT) - #include "MachO/pyMachO.hpp" -#endif - -#if defined(LIEF_OAT_SUPPORT) - #include "OAT/pyOAT.hpp" -#endif - -#if defined(LIEF_VDEX_SUPPORT) - #include "VDEX/pyVDEX.hpp" -#endif - -#if defined(LIEF_DEX_SUPPORT) - #include "DEX/pyDEX.hpp" -#endif - -#if defined(LIEF_ART_SUPPORT) - #include "ART/pyART.hpp" -#endif - - -#include "platforms/android/pyAndroid.hpp" -#include "platforms/pyPlatform.hpp" - - -PYBIND11_MODULE(lief, LIEF_module) { - - LIEF_module.attr("__version__") = py::str(LIEF_VERSION); - LIEF_module.attr("__tag__") = py::str(LIEF_TAG); - LIEF_module.attr("__commit__") = py::str(LIEF_COMMIT); - LIEF_module.attr("__is_tagged__") = py::bool_(LIEF_TAGGED); - LIEF_module.doc() = "Python API for LIEF"; - - LIEF::init_python_platforms(LIEF_module); - - init_LIEF_Object_class(LIEF_module); - - init_LIEF_errors(LIEF_module); - - init_LIEF_Logger(LIEF_module); - - // Init custom LIEF exceptions - init_LIEF_exceptions(LIEF_module); - - // Init the LIEF module - LIEF::init_python_module(LIEF_module); - - init_hash_functions(LIEF_module); - - - // Init the ELF module -#if defined(LIEF_ELF_SUPPORT) - LIEF::ELF::init_python_module(LIEF_module); -#endif - - // Init the PE module -#if defined(LIEF_PE_SUPPORT) - LIEF::PE::init_python_module(LIEF_module); -#endif - - // Init the MachO module -#if defined(LIEF_MACHO_SUPPORT) - LIEF::MachO::init_python_module(LIEF_module); -#endif - -// Init the OAT module -#if defined(LIEF_OAT_SUPPORT) - LIEF::OAT::init_python_module(LIEF_module); -#endif - -// Init the VDEX module -#if defined(LIEF_VDEX_SUPPORT) - LIEF::VDEX::init_python_module(LIEF_module); -#endif - -// Init the DEX module -#if defined(LIEF_DEX_SUPPORT) - LIEF::DEX::init_python_module(LIEF_module); -#endif - -// Init the ART module -#if defined(LIEF_ART_SUPPORT) - LIEF::ART::init_python_module(LIEF_module); -#endif - - LIEF::Android::init_python_module(LIEF_module); - - // Init util functions - init_utils_functions(LIEF_module); - - - init_json_functions(LIEF_module); -} diff --git a/vendor/lief/api/python/pyLIEF.hpp b/vendor/lief/api/python/pyLIEF.hpp deleted file mode 100644 index bbac3a8..0000000 --- a/vendor/lief/api/python/pyLIEF.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef PY_LIEF_H_ -#define PY_LIEF_H_ - -#include -#include -#include -#include - -#include - -#include "encoding.hpp" - -#include "pyErr.hpp" - -#define RST_CLASS_REF(X) ":class:`~"#X"`" -#define RST_CLASS_REF_FULL(X) ":class:`"#X"`" - -#define RST_ATTR_REF(X) ":attr:`~"#X"`" -#define RST_ATTR_REF_FULL(X) ":attr:`"#X"`" - -#define RST_METH_REF(X) ":class:`~"#X"`" -#define RST_METH_REF_FULL(X) ":class:`"#X"`" - -namespace py = pybind11; - -using namespace pybind11::literals; - -void init_LIEF_Object_class(py::module&); -void init_LIEF_Logger(py::module&); -void init_LIEF_exceptions(py::module&); -void init_LIEF_module(py::module&); -void init_hash_functions(py::module&); - - -void init_utils_functions(py::module&); - -void init_json_functions(py::module&); - -#endif diff --git a/vendor/lief/api/python/pyLogger.cpp b/vendor/lief/api/python/pyLogger.cpp deleted file mode 100644 index 210bc6d..0000000 --- a/vendor/lief/api/python/pyLogger.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "pyLIEF.hpp" - -#include "LIEF/logging.hpp" - -#define PY_ENUM(x) LIEF::logging::to_string(x), x - -void init_LIEF_Logger(py::module& m) { - py::module logging = m.def_submodule("logging"); - - py::enum_(logging, "LOGGING_LEVEL") - .value(PY_ENUM(LIEF::logging::LOGGING_LEVEL::LOG_TRACE)) - .value(PY_ENUM(LIEF::logging::LOGGING_LEVEL::LOG_DEBUG)) - .value(PY_ENUM(LIEF::logging::LOGGING_LEVEL::LOG_CRITICAL)) - .value(PY_ENUM(LIEF::logging::LOGGING_LEVEL::LOG_ERR)) - .value(PY_ENUM(LIEF::logging::LOGGING_LEVEL::LOG_WARN)) - .value(PY_ENUM(LIEF::logging::LOGGING_LEVEL::LOG_INFO)); - - logging.def("disable", - &LIEF::logging::disable, - "Disable the logger globally"); - - logging.def("enable", - &LIEF::logging::enable, - "Enable the logger globally"); - - logging.def("set_level", - &LIEF::logging::set_level, - "Change logging level", - "level"_a); -} diff --git a/vendor/lief/api/python/pyObject.cpp b/vendor/lief/api/python/pyObject.cpp deleted file mode 100644 index 4f65c86..0000000 --- a/vendor/lief/api/python/pyObject.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "pyLIEF.hpp" -#include "LIEF/Object.hpp" - -void init_LIEF_Object_class(py::module& m) { - py::class_(m, "Object"); -} diff --git a/vendor/lief/api/python/pyUtils.cpp b/vendor/lief/api/python/pyUtils.cpp deleted file mode 100644 index c6e6cbc..0000000 --- a/vendor/lief/api/python/pyUtils.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* Copyright 2017 - 2022 R. Thomas - * Copyright 2017 - 2022 Quarkslab - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "LIEF/PE/utils.hpp" -#include "LIEF/MachO/utils.hpp" -#include "LIEF/ELF/utils.hpp" - -#include "LIEF/OAT.hpp" -#include "LIEF/DEX.hpp" -#include "LIEF/VDEX.hpp" -#include "LIEF/ART.hpp" - -#define LIEF_PE_FORCE_UNDEF -#include "LIEF/PE/undef.h" -#include "pyLIEF.hpp" - -void init_utils_functions(py::module& m) { - - - m.def("shell", - [] (void) { - const auto& InteractiveShellEmbed = py::module::import("IPython").attr("terminal").attr("embed").attr("InteractiveShellEmbed"); - const auto& ipshell = InteractiveShellEmbed("banner1"_a = "Dropping into IPython", "exit_msg"_a = "Leaving Interpreter, back to program."); - return ipshell(); - }, - "Drop into an IPython Interpreter"); - - - m.def("demangle", [] (const std::string& name) -> py::object { - #if defined(__unix__) - int status; - char* demangled_name = abi::__cxa_demangle(name.c_str(), 0, 0, &status); - if (status == 0) { - std::string realname = demangled_name; - free(demangled_name); - return py::str(realname); - } else { - return py::none(); - } - #else - return py::none(); - #endif - }); - - m.def("breakp", - [] (void) { - py::object set_trace = py::module::import("pdb").attr("set_trace"); - return set_trace(); - }, - "Trigger 'pdb.set_trace()'"); - -#if defined(LIEF_PE_SUPPORT) - m.def("is_pe", - static_cast(&LIEF::PE::is_pe), - "Check if the given file is a ``PE`` (from filename)", - "filename"_a); - - m.def("is_pe", - static_cast&)>(&LIEF::PE::is_pe), - "Check if the given raw data is a ``PE``", - "raw"_a); -#endif - -#if defined(LIEF_ELF_SUPPORT) - m.def("is_elf", - static_cast(&LIEF::ELF::is_elf), - "Check if the given file is an ``ELF``", - "filename"_a); - - - m.def("is_elf", - static_cast&)>(&LIEF::ELF::is_elf), - "Check if the given raw data is an ``ELF``", - "raw"_a); -#endif - -#if defined(LIEF_MACHO_SUPPORT) - m.def("is_macho", - static_cast(&LIEF::MachO::is_macho), - "Check if the given file is a ``MachO`` (from filename)", - "filename"_a); - - - m.def("is_macho", - static_cast&)>(&LIEF::MachO::is_macho), - "Check if the given raw data is a ``MachO``", - "raw"_a); - -#endif - - -#if defined(LIEF_OAT_SUPPORT) - m.def("is_oat", - static_cast(&LIEF::OAT::is_oat), - "Check if the given file is an ``OAT`` (from filename)", - "filename"_a); - - - m.def("is_oat", - static_cast&)>(&LIEF::OAT::is_oat), - "Check if the given raw data is an ``OAT``", - "raw"_a); - - m.def("is_oat", - static_cast(&LIEF::OAT::is_oat), - "Check if the given " RST_CLASS_REF(lief.ELF.Binary) " is an ``OAT``", - "elf"_a); - - - m.def("oat_version", - static_cast(&LIEF::OAT::version), - "Return the OAT version of the given file", - "filename"_a); - - - m.def("oat_version", - static_cast&)>(&LIEF::OAT::version), - "Return the OAT version of the raw data", - "raw"_a); - - m.def("oat_version", - static_cast(&LIEF::OAT::version), - "Return the OAT version of the given " RST_CLASS_REF(lief.ELF.Binary) "", - "elf"_a); - -#endif - -#if defined(LIEF_DEX_SUPPORT) - m.def("is_dex", - static_cast(&LIEF::DEX::is_dex), - "Check if the given file is a ``DEX`` (from filename)", - "filename"_a); - - - m.def("is_dex", - static_cast&)>(&LIEF::DEX::is_dex), - "Check if the given raw data is a ``DEX``", - "raw"_a); - - m.def("dex_version", - static_cast(&LIEF::DEX::version), - "Return the OAT version of the given file", - "filename"_a); - - - m.def("dex_version", - static_cast&)>(&LIEF::DEX::version), - "Return the DEX version of the raw data", - "raw"_a); - -#endif - - -#if defined(LIEF_VDEX_SUPPORT) - m.def("is_vdex", - static_cast(&LIEF::VDEX::is_vdex), - "Check if the given file is a ``VDEX`` (from filename)", - "filename"_a); - - m.def("is_vdex", - static_cast&)>(&LIEF::VDEX::is_vdex), - "Check if the given raw data is a ``VDEX``", - "raw"_a); - - m.def("vdex_version", - static_cast(&LIEF::VDEX::version), - "Return the VDEX version of the given file", - "filename"_a); - - - m.def("vdex_version", - static_cast&)>(&LIEF::VDEX::version), - "Return the VDEX version of the raw data", - "raw"_a); - -#endif - - -#if defined(LIEF_ART_SUPPORT) - m.def("is_art", - static_cast(&LIEF::ART::is_art), - "Check if the given file is an ``ART`` (from filename)", - "filename"_a); - - m.def("is_art", - static_cast&)>(&LIEF::ART::is_art), - "Check if the given raw data is an ``ART``", - "raw"_a); - - m.def("art_version", - static_cast(&LIEF::ART::version), - "Return the ART version of the given file", - "filename"_a); - - - m.def("art_version", - static_cast&)>(&LIEF::ART::version), - "Return the ART version of the raw data", - "raw"_a); - -#endif - - -}