KUNAI Static Analyzer
Kunai is a library for doing static binary analysis of Dalvik.
|
Base class for the Instructions of the Dalvik Bytecode. More...
#include <dalvik_instructions.hpp>
Public Member Functions | |
Instruction (std::vector< uint8_t > &bytecode, std::size_t index, dexinsttype_t instruction_type) | |
Constructor of the Instruction, here is applied the parsing of the opcodes. | |
Instruction (std::vector< uint8_t > &bytecode, std::size_t index, dexinsttype_t instruction_type, std::uint32_t length) | |
virtual | ~Instruction ()=default |
Destructor of the instruction. | |
virtual TYPES::Kind | get_kind () const |
Get the kind of instruction, use a DalvikOpcodes function. | |
virtual dexinsttype_t | get_instruction_type () const |
Get the instruction type from the enum. | |
virtual std::uint32_t | get_instruction_length () const |
Get the length of the instruction. | |
virtual std::uint32_t | get_instruction_opcode () const |
Get the opcode of the instruction. | |
virtual void | set_address (std::uint64_t address) |
Set the address of the instruction. | |
virtual std::uint64_t | get_address () const |
Get the address of the instruction. | |
virtual std::string | print_instruction () |
Return a string with the representation of the instruction. | |
virtual void | print_instruction (std::ostream &os) |
Print the instruction on a given stream. | |
virtual const std::span< std::uint8_t > & | get_opcodes () |
Return the op codes in raw from the instruction. | |
virtual bool | is_terminator () |
Check if the instruction is a terminator (branch, ret, multibranch) | |
virtual bool | has_side_effects () const |
Instruction has or can have some side effect. | |
virtual bool | may_throw () const |
May throw an exception. | |
Base class for the Instructions of the Dalvik Bytecode.
|
inline |
Constructor of the Instruction, here is applied the parsing of the opcodes.
bytecode | |
index | |
instruction_type |
|
inline |
op_codes we can read here for all the classes that derives from Instruction, we have that is the bytecode from the index to index+length
|
inlinevirtual |
Get the address of the instruction.
|
inlinevirtual |
Get the length of the instruction.
|
inlinevirtual |
Get the opcode of the instruction.
|
inlinevirtual |
Get the instruction type from the enum.
|
inlinevirtual |
Get the kind of instruction, use a DalvikOpcodes function.
|
inlinevirtual |
Return the op codes in raw from the instruction.
|
virtual |
Instruction has or can have some side effect.
|
inlinevirtual |
Check if the instruction is a terminator (branch, ret, multibranch)
|
virtual |
May throw an exception.
|
inlinevirtual |
Return a string with the representation of the instruction.
Reimplemented in KUNAI::DEX::Instruction10x, KUNAI::DEX::Instruction12x, KUNAI::DEX::Instruction11n, KUNAI::DEX::Instruction11x, KUNAI::DEX::Instruction10t, KUNAI::DEX::Instruction20t, KUNAI::DEX::Instruction20bc, KUNAI::DEX::Instruction22x, KUNAI::DEX::Instruction21t, KUNAI::DEX::Instruction21s, KUNAI::DEX::Instruction21h, KUNAI::DEX::Instruction21c, KUNAI::DEX::Instruction23x, KUNAI::DEX::Instruction22b, KUNAI::DEX::Instruction22t, KUNAI::DEX::Instruction22s, KUNAI::DEX::Instruction22c, KUNAI::DEX::Instruction22cs, KUNAI::DEX::Instruction30t, KUNAI::DEX::Instruction32x, KUNAI::DEX::Instruction31i, KUNAI::DEX::Instruction31t, KUNAI::DEX::Instruction31c, KUNAI::DEX::Instruction35c, KUNAI::DEX::Instruction3rc, KUNAI::DEX::Instruction45cc, KUNAI::DEX::Instruction4rcc, KUNAI::DEX::Instruction51l, KUNAI::DEX::PackedSwitch, KUNAI::DEX::SparseSwitch, KUNAI::DEX::FillArrayData, and KUNAI::DEX::DalvikIncorrectInstruction.
|
inlinevirtual |
Print the instruction on a given stream.
os | stream where to print the instruction |
Reimplemented in KUNAI::DEX::Instruction10x, KUNAI::DEX::Instruction12x, KUNAI::DEX::Instruction11n, KUNAI::DEX::Instruction11x, KUNAI::DEX::Instruction10t, KUNAI::DEX::Instruction20t, KUNAI::DEX::Instruction20bc, KUNAI::DEX::Instruction22x, KUNAI::DEX::Instruction21t, KUNAI::DEX::Instruction21s, KUNAI::DEX::Instruction21h, KUNAI::DEX::Instruction21c, KUNAI::DEX::Instruction23x, KUNAI::DEX::Instruction22b, KUNAI::DEX::Instruction22t, KUNAI::DEX::Instruction22s, KUNAI::DEX::Instruction22c, KUNAI::DEX::Instruction22cs, KUNAI::DEX::Instruction30t, KUNAI::DEX::Instruction32x, KUNAI::DEX::Instruction31i, KUNAI::DEX::Instruction31t, KUNAI::DEX::Instruction31c, KUNAI::DEX::Instruction35c, KUNAI::DEX::Instruction3rc, KUNAI::DEX::Instruction45cc, KUNAI::DEX::Instruction4rcc, KUNAI::DEX::Instruction51l, KUNAI::DEX::PackedSwitch, KUNAI::DEX::SparseSwitch, KUNAI::DEX::FillArrayData, and KUNAI::DEX::DalvikIncorrectInstruction.
|
inlinevirtual |
Set the address of the instruction.
address | new address of the instruction |