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 <memory>
19
20
#include "
LIEF/visibility.h
"
21
#include "
LIEF/ELF/Parser.hpp
"
22
23
namespace
LIEF
{
24
25
namespace
VDEX
{
26
class
File
;
27
}
28
29
namespace
DEX
{
30
class
Class
;
31
}
32
33
namespace
OAT
{
34
class
Binary
;
35
class
Class
;
36
38
class
LIEF_API
Parser
:
public
ELF::Parser
{
39
public
:
41
static
std::unique_ptr<Binary>
parse
(
const
std::string& oat_file);
42
static
std::unique_ptr<Binary>
parse
(
const
std::string& oat_file,
43
const
std::string& vdex_file);
44
45
static
std::unique_ptr<Binary>
parse
(std::vector<uint8_t> data);
46
47
Parser
&
operator=
(
const
Parser
& copy) =
delete
;
48
Parser
(
const
Parser
& copy) =
delete
;
49
50
protected
:
51
Parser
();
52
Parser
(
const
std::string& oat_file);
53
Parser
(std::vector<uint8_t> data);
54
~Parser
()
override
;
55
56
Binary
& oat_binary() {
57
// The type of the parent binary_ is guaranteed by the constructor
58
return
*
reinterpret_cast<
Binary
*
>
(binary_.get());
59
}
60
61
bool
has_vdex()
const
;
62
void
set_vdex(std::unique_ptr<VDEX::File> file);
63
64
template
<
typename
OAT_T>
65
void
parse_binary();
66
67
template
<
typename
OAT_T>
68
void
parse_header();
69
70
template
<
typename
OAT_T>
71
void
parse_header_keys();
72
73
template
<
typename
OAT_T>
74
void
parse_dex_files();
75
76
template
<
typename
OAT_T>
77
void
parse_type_lookup_table();
78
79
template
<
typename
OAT_T>
80
void
parse_oat_classes();
81
82
template
<
typename
OAT_T>
83
void
parse_oat_methods(uint64_t methods_offsets,
Class
& clazz,
const
DEX::Class
& dex_class);
84
85
void
init();
86
87
std::unique_ptr<LIEF::VDEX::File> vdex_file_;
88
89
uint64_t data_address_ = 0;
90
uint64_t data_size_ = 0;
91
92
uint64_t exec_start_ = 0;
93
uint64_t exec_size_ = 0;
94
};
95
96
}
// namespace OAT
97
}
// namespace LIEF
98
#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:45
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::DEX
Definition
DEX/Class.hpp:30
LIEF::OAT
Definition
ELF/Parser.hpp:32
LIEF::VDEX
Definition
OAT/Binary.hpp:31
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.17.0