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
ART
ART/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_ART_PARSER_H
17
#define LIEF_ART_PARSER_H
18
#include <memory>
19
#include <vector>
20
#include <string>
21
22
#include "
LIEF/ART/types.hpp
"
23
#include "
LIEF/visibility.h
"
24
25
namespace
LIEF
{
26
class
BinaryStream
;
27
namespace
ART
{
28
class
File
;
29
30
32
class
LIEF_API
Parser
{
33
public
:
34
static
std::unique_ptr<File>
parse
(
const
std::string& file);
35
static
std::unique_ptr<File>
parse
(std::vector<uint8_t> data,
36
const
std::string& name =
""
);
37
38
Parser
&
operator=
(
const
Parser
& copy) =
delete
;
39
Parser
(
const
Parser
& copy) =
delete
;
40
41
private
:
42
Parser
();
43
Parser
(
const
std::string& file);
44
Parser
(std::vector<uint8_t> data);
45
virtual
~Parser
();
46
47
void
init(
const
std::string& name,
art_version_t
version
);
48
49
template
<
typename
ART_T>
50
void
parse_file();
51
52
template
<
typename
ART_T>
53
size_t
parse_header();
54
55
template
<
typename
ART_T,
typename
PTR_T>
56
void
parse_sections();
57
58
template
<
typename
ART_T,
typename
PTR_T>
59
void
parse_roots();
60
61
template
<
typename
ART_T,
typename
PTR_T>
62
void
parse_methods();
63
64
// Section parsing
65
template
<
typename
ART_T,
typename
PTR_T>
66
void
parse_objects(
size_t
offset,
size_t
size);
67
68
template
<
typename
ART_T,
typename
PTR_T>
69
void
parse_art_fields(
size_t
offset,
size_t
size);
70
71
template
<
typename
ART_T,
typename
PTR_T>
72
void
parse_art_methods(
size_t
offset,
size_t
size);
73
74
template
<
typename
ART_T,
typename
PTR_T>
75
void
parse_interned_strings(
size_t
offset,
size_t
size);
76
77
// Parse an **Array** of java.lang.DexCache objects
78
template
<
typename
ART_T,
typename
PTR_T>
79
void
parse_dex_caches(
size_t
offset,
size_t
size);
80
81
// Parse a **Single** java.lang.DexCache object
82
template
<
typename
ART_T,
typename
PTR_T>
83
void
parse_dex_cache(
size_t
object_offset);
84
85
// Parse an **Array** of java.lang.Class objects
86
template
<
typename
ART_T,
typename
PTR_T>
87
void
parse_class_roots(
size_t
offset,
size_t
size);
88
89
// Parse java.lang.Class objects
90
template
<
typename
ART_T,
typename
PTR_T>
91
void
parse_class(
size_t
offset);
92
93
// Parse java.lang.String objects
94
template
<
typename
ART_T,
typename
PTR_T>
95
void
parse_jstring(
size_t
offset);
96
97
99
// template<typename ART_T, typename PTR_T>
100
// void parse_class_roots(size_t object_offset);
101
102
std::unique_ptr<File> file_;
103
std::unique_ptr<BinaryStream> stream_;
104
uint32_t imagebase_ = 0;
105
};
106
}
// namespace ART
107
}
// namespace LIEF
108
#endif
types.hpp
LIEF::ART::File
Definition
ART/File.hpp:29
LIEF::ART::Parser::parse
static std::unique_ptr< File > parse(std::vector< uint8_t > data, const std::string &name="")
LIEF::ART::Parser::operator=
Parser & operator=(const Parser ©)=delete
LIEF::ART::Parser::parse
static std::unique_ptr< File > parse(const std::string &file)
LIEF::ART::Parser::Parser
Parser(const Parser ©)=delete
LIEF::BinaryStream
Class that is used to a read stream of data from different sources.
Definition
BinaryStream.hpp:33
LIEF::ART
Namespace related to the LIEF's ART module.
Definition
ART/enums.hpp:20
LIEF::ART::version
art_version_t version(const std::string &file)
Return the ART version of the given file.
LIEF::ART::art_version_t
uint32_t art_version_t
Definition
ART/types.hpp:26
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:43
Generated by
1.17.0