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,
const
std::string& name =
""
);
36
37
Parser
&
operator=
(
const
Parser
& copy) =
delete
;
38
Parser
(
const
Parser
& copy) =
delete
;
39
40
private
:
41
Parser
();
42
Parser
(
const
std::string& file);
43
Parser
(std::vector<uint8_t> data);
44
virtual
~Parser
();
45
46
void
init(
const
std::string& name,
art_version_t
version
);
47
48
template
<
typename
ART_T>
49
void
parse_file();
50
51
template
<
typename
ART_T>
52
size_t
parse_header();
53
54
template
<
typename
ART_T,
typename
PTR_T>
55
void
parse_sections();
56
57
template
<
typename
ART_T,
typename
PTR_T>
58
void
parse_roots();
59
60
template
<
typename
ART_T,
typename
PTR_T>
61
void
parse_methods();
62
63
// Section parsing
64
template
<
typename
ART_T,
typename
PTR_T>
65
void
parse_objects(
size_t
offset,
size_t
size);
66
67
template
<
typename
ART_T,
typename
PTR_T>
68
void
parse_art_fields(
size_t
offset,
size_t
size);
69
70
template
<
typename
ART_T,
typename
PTR_T>
71
void
parse_art_methods(
size_t
offset,
size_t
size);
72
73
template
<
typename
ART_T,
typename
PTR_T>
74
void
parse_interned_strings(
size_t
offset,
size_t
size);
75
76
// Parse an **Array** of java.lang.DexCache objects
77
template
<
typename
ART_T,
typename
PTR_T>
78
void
parse_dex_caches(
size_t
offset,
size_t
size);
79
80
// Parse a **Single** java.lang.DexCache object
81
template
<
typename
ART_T,
typename
PTR_T>
82
void
parse_dex_cache(
size_t
object_offset);
83
84
// Parse an **Array** of java.lang.Class objects
85
template
<
typename
ART_T,
typename
PTR_T>
86
void
parse_class_roots(
size_t
offset,
size_t
size);
87
88
// Parse java.lang.Class objects
89
template
<
typename
ART_T,
typename
PTR_T>
90
void
parse_class(
size_t
offset);
91
92
// Parse java.lang.String objects
93
template
<
typename
ART_T,
typename
PTR_T>
94
void
parse_jstring(
size_t
offset);
95
96
98
//template<typename ART_T, typename PTR_T>
99
//void parse_class_roots(size_t object_offset);
100
101
std::unique_ptr<File> file_;
102
std::unique_ptr<BinaryStream> stream_;
103
uint32_t imagebase_ = 0;
104
};
105
}
// namespace ART
106
}
// namespace LIEF
107
#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:41
Generated by
1.17.0