KUNAI Static Analyzer
Kunai is a library for doing static binary analysis of Dalvik.
Loading...
Searching...
No Matches
parser.hpp
1//--------------------------------------------------------------------*- C++ -*-
2// Kunai-static-analyzer: library for doing analysis of dalvik files
3// @author Farenain <kunai.static.analysis@gmail.com>
4// @author Ernesto Java <javaernesto@gmail.com>
5//
6// @file parser.hpp
7// @brief class representing the DEX parser it contains all the headers
8// from the DEX file.
9#ifndef KUNAI_DEX_PARSER_PARSER_HPP
10#define KUNAI_DEX_PARSER_PARSER_HPP
11
12#include "Kunai/DEX/parser/header.hpp"
13#include "Kunai/DEX/parser/map_item.hpp"
14#include "Kunai/DEX/parser/strings.hpp"
15#include "Kunai/DEX/parser/types.hpp"
16#include "Kunai/DEX/parser/protos.hpp"
17#include "Kunai/DEX/parser/fields.hpp"
18#include "Kunai/DEX/parser/methods.hpp"
19#include "Kunai/DEX/parser/classes.hpp"
20#include "Kunai/Utils/kunaistream.hpp"
21
22
23namespace KUNAI
24{
25namespace DEX
26{
27
28 class Parser
29 {
32 Header header;
33
37 MapList maplist;
38
41 Strings strings;
42
44 Types types;
45
47 Protos protos;
48
50 Fields fields;
51
53 Methods methods;
54
56 Classes classes;
57
59 stream::KunaiStream* stream;
60
61 public:
62
65 Parser(stream::KunaiStream* stream) : stream(stream)
66 {}
67
69 ~Parser() = default;
70
72 void parse_file();
73
76 const Header& get_header_const() const
77 {
78 return header;
79 }
80
84 {
85 return header;
86 }
87
91 {
92 return maplist;
93 }
94
98 {
99 return maplist;
100 }
101
105 {
106 return strings;
107 }
108
112 {
113 return strings;
114 }
115
118 const Types& get_types_const() const
119 {
120 return types;
121 }
122
126 {
127 return types;
128 }
129
133 {
134 return protos;
135 }
136
140 {
141 return protos;
142 }
143
147 {
148 return fields;
149 }
150
154 {
155 return methods;
156 }
157
161 {
162 return classes;
163 }
164 };
165} // namespace DEX
166} // namespace KUNAI
167
168
169#endif
All classes from the DEX files.
Definition classes.hpp:290
Fields will contain all the FieldID from the DEX file.
Definition fields.hpp:114
Definition header.hpp:25
Class representing the Map List, this map contains different information about different types.
Definition map_item.hpp:23
Methods contains all the MethodIDs from the DEX file.
Definition methods.hpp:118
Definition parser.hpp:29
Header & get_header()
Return a reference from the dex header.
Definition parser.hpp:83
Methods & get_methods()
get a reference to the methods
Definition parser.hpp:153
const Types & get_types_const() const
get a constant reference to the types
Definition parser.hpp:118
Fields & get_fields()
get a reference to the fields
Definition parser.hpp:146
const Protos & get_protos_const() const
get a constant reference to the prototypes
Definition parser.hpp:132
void parse_file()
parse the dex file and obtain the different objects
Protos & get_protos()
get a reference to the prototypes
Definition parser.hpp:139
Classes & get_classes()
Get a reference to the classes.
Definition parser.hpp:160
~Parser()=default
Destructor of the parser.
Strings & get_strings()
get a reference to the strings object
Definition parser.hpp:111
MapList & get_maplist()
Return a reference to the maplist with the map items.
Definition parser.hpp:97
Types & get_types()
get a reference to the types object
Definition parser.hpp:125
const Strings & get_strings_const() const
get a reference to the strings object, reference is constant
Definition parser.hpp:104
const MapList & get_maplist_const() const
Return a constant reference to the maplist with the map items.
Definition parser.hpp:90
Parser(stream::KunaiStream *stream)
Constructor of the parser.
Definition parser.hpp:65
const Header & get_header_const() const
Return a const reference from the dex header.
Definition parser.hpp:76
Class to manage all the ProtoID from the DEX file.
Definition protos.hpp:137
Storage class for all the strings of the DEX file.
Definition strings.hpp:34
Definition types.hpp:305
Class to manage an input file stream given for the analysis.
Definition kunaistream.hpp:20
utilities
Definition analysis.hpp:23