KUNAI Static Analyzer
Kunai is a library for doing static binary analysis of Dalvik.
|
Class to keep all the Dalvik Basic Blocks from a method. More...
#include <analysis.hpp>
Public Types | |
enum | node_type_t { JOIN_NODE = 0 , BRANCH_NODE , REGULAR_NODE } |
Type of a node. | |
using | connected_blocks_t = std::unordered_map< DVMBasicBlock *, std::set< DVMBasicBlock * > > |
blocks that are connected with others | |
using | edges_t = std::vector< std::pair< DVMBasicBlock *, DVMBasicBlock * > > |
edges between nodes | |
Public Member Functions | |
~BasicBlocks () | |
Destructor of the BasicBlocks, we need to free the memory. | |
size_t | get_number_of_basic_blocks () const |
Return the number of basic blocks in the graph. | |
const connected_blocks_t & | get_predecessors () const |
Get all predecessors from all the blocks. | |
connected_blocks_t & | get_predecessors () |
Get all predecessors from all the blocks. | |
void | add_predecessor (DVMBasicBlock *node, DVMBasicBlock *pred) |
Add a node to the list of predecessors of another. | |
const connected_blocks_t & | get_sucessors () const |
Get all sucessors from all the blocks. | |
connected_blocks_t & | get_sucessors () |
Get all sucessors from all the blocks. | |
void | add_sucessor (DVMBasicBlock *node, DVMBasicBlock *suc) |
Add a node to the list of sucessors of another. | |
void | add_node (DVMBasicBlock *node) |
Add a node to the vector of nodes, we will transfer the ownership. | |
void | add_edge (DVMBasicBlock *src, DVMBasicBlock *dst) |
Add an edge to the basic blocks. | |
const edges_t & | get_edges () const |
Get a constant reference to the edges of the graph. | |
edges_t & | get_edges () |
Get a reference to the edges of the graph. | |
node_type_t | get_node_type (DVMBasicBlock *node) |
Get the node type between JOIN_NODE, BRANCH_NODE or REGULAR_NODE. | |
void | remove_node (DVMBasicBlock *node) |
Remove a node from the graph, this operation can be expensive on time. | |
DVMBasicBlock * | get_basic_block_by_idx (std::uint64_t idx) |
Get a basic block given an idx, the idx can be one address from the first to the last address of the block. | |
const std::vector< DVMBasicBlock * > & | get_nodes () const |
Get a constant reference to the nodes of the graph. | |
std::vector< DVMBasicBlock * > & | get_nodes () |
Get a reference to the nodes of the graph. | |
Class to keep all the Dalvik Basic Blocks from a method.
|
inline |
Add an edge to the basic blocks.
src | source node |
dst | edge node |
now add the sucessors and predecessors
|
inline |
Add a node to the vector of nodes, we will transfer the ownership.
node | node to push into our vector |
|
inline |
Add a node to the list of predecessors of another.
node | node to add predecessor |
pred | predecessor node |
|
inline |
Add a node to the list of sucessors of another.
node | node to add sucessor |
suc | sucessor node |
DVMBasicBlock * KUNAI::DEX::BasicBlocks::get_basic_block_by_idx | ( | std::uint64_t | idx | ) |
Get a basic block given an idx, the idx can be one address from the first to the last address of the block.
idx | address of the block to retrieve |
|
inline |
Get a reference to the edges of the graph.
|
inline |
Get a constant reference to the edges of the graph.
|
inline |
Get the node type between JOIN_NODE, BRANCH_NODE or REGULAR_NODE.
node | node to check |
|
inline |
Get a reference to the nodes of the graph.
|
inline |
Get a constant reference to the nodes of the graph.
|
inline |
Return the number of basic blocks in the graph.
|
inline |
Get all predecessors from all the blocks.
|
inline |
Get all predecessors from all the blocks.
|
inline |
Get all sucessors from all the blocks.
|
inline |
Get all sucessors from all the blocks.
void KUNAI::DEX::BasicBlocks::remove_node | ( | DVMBasicBlock * | node | ) |
Remove a node from the graph, this operation can be expensive on time.
node | node to remove |