-
-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Segment split info * Sub framework * Dyld environment
- Loading branch information
1 parent
d1a7252
commit 9e3b5b4
Showing
26 changed files
with
947 additions
and
50 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,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. | ||
*/ | ||
#include <algorithm> | ||
|
||
#include <string> | ||
#include <sstream> | ||
|
||
#include "LIEF/MachO/hash.hpp" | ||
#include "LIEF/MachO/DyldEnvironment.hpp" | ||
|
||
#include "pyMachO.hpp" | ||
|
||
template<class T> | ||
using getter_t = T (DyldEnvironment::*)(void) const; | ||
|
||
template<class T> | ||
using setter_t = void (DyldEnvironment::*)(T); | ||
|
||
|
||
void init_MachO_DyldEnvironment_class(py::module& m) { | ||
|
||
py::class_<DyldEnvironment, LoadCommand>(m, "DyldEnvironment") | ||
|
||
.def_property("value", | ||
static_cast<getter_t<const std::string&>>(&DyldEnvironment::value), | ||
static_cast<setter_t<const std::string&>>(&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(); | ||
}); | ||
|
||
} |
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,64 @@ | ||
/* 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 <algorithm> | ||
|
||
#include <string> | ||
#include <sstream> | ||
|
||
#include "LIEF/MachO/hash.hpp" | ||
#include "LIEF/MachO/SegmentSplitInfo.hpp" | ||
|
||
#include "pyMachO.hpp" | ||
|
||
template<class T> | ||
using getter_t = T (SegmentSplitInfo::*)(void) const; | ||
|
||
template<class T> | ||
using setter_t = void (SegmentSplitInfo::*)(T); | ||
|
||
|
||
void init_MachO_SegmentSplitInfo_class(py::module& m) { | ||
|
||
py::class_<SegmentSplitInfo, LoadCommand>(m, "SegmentSplitInfo") | ||
|
||
.def_property("data_offset", | ||
static_cast<getter_t<uint32_t>>(&SegmentSplitInfo::data_offset), | ||
static_cast<setter_t<uint32_t>>(&SegmentSplitInfo::data_offset), | ||
"Offset in the binary where data start") | ||
|
||
.def_property("data_size", | ||
static_cast<getter_t<uint32_t>>(&SegmentSplitInfo::data_size), | ||
static_cast<setter_t<uint32_t>>(&SegmentSplitInfo::data_size), | ||
"Size of the raw data") | ||
|
||
.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; | ||
}); | ||
|
||
} |
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. | ||
*/ | ||
#include <algorithm> | ||
|
||
#include <string> | ||
#include <sstream> | ||
|
||
#include "LIEF/MachO/hash.hpp" | ||
#include "LIEF/MachO/SubFramework.hpp" | ||
|
||
#include "pyMachO.hpp" | ||
|
||
template<class T> | ||
using getter_t = T (SubFramework::*)(void) const; | ||
|
||
template<class T> | ||
using setter_t = void (SubFramework::*)(T); | ||
|
||
|
||
void init_MachO_SubFramework_class(py::module& m) { | ||
|
||
py::class_<SubFramework, LoadCommand>(m, "SubFramework") | ||
|
||
.def_property("umbrella", | ||
static_cast<getter_t<const std::string&>>(&SubFramework::umbrella), | ||
static_cast<setter_t<const std::string&>>(&SubFramework::umbrella), | ||
"") | ||
|
||
.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; | ||
}); | ||
|
||
} |
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
Oops, something went wrong.