LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
MachO/utils.hpp
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_MACHO_UTILS_H
17#define LIEF_MACHO_UTILS_H
18
19#include "LIEF/types.hpp"
20#include "LIEF/visibility.h"
21
22#include <string>
23#include <vector>
24
25namespace LIEF {
26class BinaryStream;
27namespace MachO {
28class Binary;
29class FatBinary;
30
32LIEF_API bool is_macho(BinaryStream& stream);
33
35LIEF_API bool is_macho(const std::string& file);
36
38LIEF_API bool is_macho(const std::vector<uint8_t>& raw);
39
41LIEF_API bool is_fat(const std::string& file);
42
44LIEF_API bool is_64(const std::string& file);
45
48LIEF_API bool check_layout(const Binary& binary, std::string* error = nullptr);
49
52LIEF_API bool check_layout(const FatBinary& binary, std::string* error = nullptr);
53}
54}
55
56
57#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:34
Class which represents a MachO binary.
Definition MachO/Binary.hpp:73
Class which represent a Mach-O (fat) binary This object is also used for representing Mach-O binaries...
Definition FatBinary.hpp:36
bool check_layout(const Binary &binary, std::string *error=nullptr)
Check the layout of the given Mach-O binary. It checks if it can be signed according to cctools-921/l...
bool is_fat(const std::string &file)
Check if the given file is a FAT Mach-O.
bool is_macho(BinaryStream &stream)
Check if the given stream wraps a Mach-O binary.
bool is_64(const std::string &file)
Check if the given Mach-O is 64-bits.
LIEF namespace.
Definition Abstract/Binary.hpp:32