Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Provide MachO::ParserConfig to parametrize the parsing.
Resolve: #105
- Loading branch information
1 parent
c61caae
commit 880b99a
Showing
16 changed files
with
232 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* Copyright 2017 R. Thomas | ||
* Copyright 2017 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 <string> | ||
|
||
#include "LIEF/MachO/ParserConfig.hpp" | ||
|
||
#include "pyMachO.hpp" | ||
|
||
void init_MachO_ParserConfig_class(py::module& m) { | ||
|
||
py::class_<ParserConfig>(m, "ParserConfig", "Configuration of MachO's parser") | ||
.def(py::init<>()) | ||
.def_property("parse_dyldinfo_deeply", | ||
static_cast<bool (ParserConfig::*)(void) const>(&ParserConfig::parse_dyldinfo_deeply), | ||
static_cast<ParserConfig& (ParserConfig::*)(bool)>(&ParserConfig::parse_dyldinfo_deeply), | ||
"If set to ``True``, parse deeply the " RST_CLASS_REF(lief.MachO.DyldInfo) " " | ||
"structure. It includes Exports, Bindings and Rebases") | ||
|
||
.def_property_readonly_static("deep", | ||
[] (py::object /* self */) { return ParserConfig::deep(); }, | ||
"foobar") | ||
|
||
.def_property_readonly_static("quick", | ||
[] (py::object /* self */) { return ParserConfig::quick(); }, | ||
""); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* Copyright 2017 R. Thomas | ||
* Copyright 2017 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 LIEF_MACHO_PARSER_CONFIG_H_ | ||
#define LIEF_MACHO_PARSER_CONFIG_H_ | ||
#include "LIEF/visibility.h" | ||
|
||
namespace LIEF { | ||
namespace MachO { | ||
|
||
class DLL_PUBLIC ParserConfig { | ||
public: | ||
ParserConfig(void); | ||
ParserConfig& operator=(const ParserConfig&); | ||
ParserConfig(const ParserConfig&); | ||
~ParserConfig(void); | ||
|
||
//! @brief Return a configuration so that the all objects supported by | ||
//! LIEF are parsed | ||
//! | ||
//! With this configuration: | ||
//! * ``parse_dyldinfo_deeply`` is set to ``true`` | ||
static ParserConfig deep(void); | ||
|
||
//! Return a configuration so that the parsing is quick | ||
//! | ||
//! With this configuration: | ||
//! * ``parse_dyldinfo_deeply`` is set to ``false`` | ||
static ParserConfig quick(void); | ||
|
||
//! @brief If ``flag`` is set to ``true``, | ||
//! Exports, Bindings and Rebases opcodes are | ||
//! parsed. | ||
//! | ||
//! @warning Enabling this flag can slow down the parsing | ||
ParserConfig& parse_dyldinfo_deeply(bool flag); | ||
|
||
//! @brief Whether or not bindings, exports, and rebases are parsed | ||
bool parse_dyldinfo_deeply(void) const; | ||
|
||
private: | ||
bool dyldinfo_deeply_; | ||
}; | ||
|
||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.