KUNAI Static Analyzer
Kunai is a library for doing static binary analysis of Dalvik.
Loading...
Searching...
No Matches
external_class.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 external_class.hpp
7// @brief A class for managing external classes that does not exist in
8// current DEX or current apk file
9
10#ifndef KUNAI_DEX_ANALYSIS_EXTERNAL_CLASS_HPP
11#define KUNAI_DEX_ANALYSIS_EXTERNAL_CLASS_HPP
12
13#include "Kunai/DEX/analysis/external_method.hpp"
14#include <iostream>
15#include <vector>
16#include <memory>
17
18namespace KUNAI
19{
20namespace DEX
21{
23 {
25 std::string name;
27 std::vector<ExternalMethod*> methods;
29 std::vector<encodedfield_t> fields;
30 public:
31 ExternalClass(std::string& name) : name(name)
32 {}
33
36 std::string& get_name()
37 {
38 return name;
39 }
40
43 const std::vector<ExternalMethod*>& get_methods() const
44 {
45 return methods;
46 }
47
50 std::vector<ExternalMethod*>& get_methods()
51 {
52 return methods;
53 }
54
58 {
59 methods.push_back(method);
60 }
61
66 {
67 fields.push_back(std::make_unique<EncodedField>(field, TYPES::access_flags::NONE));
68 }
69
72 const std::vector<std::unique_ptr<EncodedField>>& get_fields() const
73 {
74 return fields;
75 }
76
79 std::vector<std::unique_ptr<EncodedField>>& get_fields()
80 {
81 return fields;
82 }
83 };
84} // namespace DEX
85} // namespace KUNAI
86
87
88#endif
Definition external_class.hpp:23
std::vector< ExternalMethod * > & get_methods()
Get a reference to the methods of the class.
Definition external_class.hpp:50
void add_external_field(FieldID *field)
Add a new EncodedField to the class, we do not know if this is static or any other kind of field.
Definition external_class.hpp:65
const std::vector< ExternalMethod * > & get_methods() const
Get a constant reference to the methods of the class.
Definition external_class.hpp:43
std::string & get_name()
Get the name of the external class.
Definition external_class.hpp:36
void add_external_method(ExternalMethod *method)
Add an external method to the list of methods.
Definition external_class.hpp:57
const std::vector< std::unique_ptr< EncodedField > > & get_fields() const
Get a constant reference to the fields of this class.
Definition external_class.hpp:72
std::vector< std::unique_ptr< EncodedField > > & get_fields()
Get a reference to the fields of this class.
Definition external_class.hpp:79
Definition external_method.hpp:23
FieldID represent one of the fields from the DEX file.
Definition fields.hpp:28
utilities
Definition analysis.hpp:23