LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
OAT
OAT/Parser.hpp
Go to the documentation of this file.
1
/* Copyright 2017 - 2026 R. Thomas
2
* Copyright 2017 - 2026 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_OAT_PARSER_H
17
#define LIEF_OAT_PARSER_H
18
#include <cstdint>
19
#include <memory>
20
21
#include "
LIEF/errors.hpp
"
22
#include "
LIEF/visibility.h
"
23
#include "
LIEF/ELF/Parser.hpp
"
24
25
namespace
LIEF
{
26
27
namespace
VDEX
{
28
class
File
;
29
}
30
31
namespace
DEX
{
32
class
Class
;
33
}
34
35
namespace
OAT
{
36
class
Binary
;
37
class
Class
;
38
40
class
LIEF_API
Parser
:
public
ELF::Parser
{
41
public
:
43
static
std::unique_ptr<Binary>
parse
(
const
std::string& oat_file);
44
static
std::unique_ptr<Binary>
parse
(
const
std::string& oat_file,
45
const
std::string& vdex_file);
46
47
static
std::unique_ptr<Binary>
parse
(std::vector<uint8_t> data);
48
49
Parser
&
operator=
(
const
Parser
& copy) =
delete
;
50
Parser
(
const
Parser
& copy) =
delete
;
51
52
protected
:
53
Parser
();
54
Parser
(
const
std::string& oat_file);
55
Parser
(std::vector<uint8_t> data);
56
~Parser
()
override
;
57
58
Binary
& oat_binary() {
59
// The type of the parent binary_ is guaranteed by the constructor
60
return
*
reinterpret_cast<
Binary
*
>
(binary_.get());
61
}
62
63
bool
has_vdex()
const
;
64
void
set_vdex(std::unique_ptr<VDEX::File> file);
65
66
template
<
typename
OAT_T>
67
void
parse_binary();
68
69
template
<
typename
OAT_T>
70
void
parse_header();
71
72
template
<
typename
OAT_T>
73
void
parse_header_keys();
74
75
template
<
typename
OAT_T>
76
void
parse_dex_files();
77
78
template
<
typename
OAT_T>
79
void
parse_type_lookup_table();
80
81
template
<
typename
OAT_T>
82
void
parse_oat_classes();
83
84
template
<
typename
OAT_T>
85
void
parse_oat_methods(uint64_t methods_offsets,
Class
& clazz,
86
const
DEX::Class
& dex_class);
87
88
void
init();
89
90
result<uint64_t>
oat_data_exec_gap()
const
;
91
92
std::unique_ptr<LIEF::VDEX::File> vdex_file_;
93
94
uint64_t data_address_ = 0;
95
uint64_t data_size_ = 0;
96
97
uint64_t exec_start_ = 0;
98
uint64_t exec_size_ = 0;
99
};
100
101
}
// namespace OAT
102
}
// namespace LIEF
103
#endif
Parser.hpp
LIEF::DEX::Class
Class which represents a DEX Class (i.e. a Java/Kotlin class).
Definition
DEX/Class.hpp:36
LIEF::ELF::Parser
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition
ELF/Parser.hpp:44
LIEF::OAT::Binary
Definition
OAT/Binary.hpp:41
LIEF::OAT::Class
Definition
OAT/Class.hpp:36
LIEF::OAT::Parser::parse
static std::unique_ptr< Binary > parse(const std::string &oat_file, const std::string &vdex_file)
LIEF::OAT::Parser::parse
static std::unique_ptr< Binary > parse(const std::string &oat_file)
Parse an OAT file.
LIEF::OAT::Parser::parse
static std::unique_ptr< Binary > parse(std::vector< uint8_t > data)
LIEF::OAT::Parser::operator=
Parser & operator=(const Parser ©)=delete
LIEF::OAT::Parser::Parser
Parser(const Parser ©)=delete
LIEF::VDEX::File
Main class for the VDEX module which represents a VDEX file.
Definition
VDEX/File.hpp:42
LIEF::result
Wrapper that contains an Object (T) or an error.
Definition
errors.hpp:78
errors.hpp
LIEF::DEX
Definition
DEX/Class.hpp:30
LIEF::OAT
Definition
ELF/Parser.hpp:31
LIEF::VDEX
Definition
OAT/Binary.hpp:31
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:41
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.17.0