Arion 1.0.2-alpha
A high-performance C++ framework for emulating executable binaries.
 
Loading...
Searching...
No Matches
hooks_manager.hpp File Reference
#include <arion/common/global_defs.hpp>
#include <arion/common/global_excepts.hpp>
#include <arion/unicorn/unicorn.h>
#include <functional>
#include <map>
#include <memory>
#include <stack>
#include <variant>

Go to the source code of this file.

Classes

struct  arion::ARION_HOOK_PARAM
 This structure is placed in the Unicorn user_data parameter of hooks. More...
 
struct  arion::ARION_HOOK
 This structure holds information about an Arion hook. More...
 
class  arion::HooksManager
 This class purpose is to manage user-defined Arion hooks including hook creation, deletion, trigger handling... More...
 

Namespaces

namespace  arion
 

Typedefs

using arion::HOOK_ID = uint64_t
 ID associated with a hook when created.
 
using arion::NO_PARAM_HOOK_CALLBACK = std::function< void(std::shared_ptr< Arion > arion, void *user_data)>
 
using arion::NO_PARAM_BOOL_HOOK_CALLBACK = std::function< bool(std::shared_ptr< Arion > arion, void *user_data)>
 
using arion::U32_HOOK_CALLBACK = std::function< void(std::shared_ptr< Arion > arion, uint32_t val, void *user_data)>
 
using arion::ADDR_SZ_HOOK_CALLBACK = std::function< void(std::shared_ptr< Arion > arion, ADDR addr, size_t sz, void *user_data)>
 
using arion::MEM_HOOK_CALLBACK = std::function< bool(std::shared_ptr< Arion > arion, uc_mem_type type, uint64_t addr, int size, int64_t val, void *user_data)>
 
using arion::EDGE_HOOK_CALLBACK = std::function< void(std::shared_ptr< Arion > arion, uc_tb *cur, uc_tb *prev, void *user_data)>
 
using arion::TCG_HOOK_CALLBACK = std::function< void(std::shared_ptr< Arion > arion, uint64_t addr, uint64_t arg1, uint64_t arg2, int size, void *user_data)>
 
using arion::TLB_HOOK_CALLBACK = std::function< bool(std::shared_ptr< Arion > arion, uint64_t addr, uc_mem_type type, uc_tlb_entry *result, void *user_data)>
 
using arion::PROCESS_HOOK_CALLBACK = std::function< void(std::shared_ptr< Arion > arion, std::shared_ptr< Arion > child, void *user_data)>
 
using arion::SYSCALL_HOOK_CALLBACK = std::function< void(std::shared_ptr< Arion > arion, uint64_t sysno, std::vector< SYS_PARAM > params, bool *handled, void *user_data)>
 
using arion::HOOK_CALLBACK = std::variant< NO_PARAM_HOOK_CALLBACK, NO_PARAM_BOOL_HOOK_CALLBACK, U32_HOOK_CALLBACK, ADDR_SZ_HOOK_CALLBACK, MEM_HOOK_CALLBACK, EDGE_HOOK_CALLBACK, TCG_HOOK_CALLBACK, TLB_HOOK_CALLBACK, PROCESS_HOOK_CALLBACK, SYSCALL_HOOK_CALLBACK >
 Variant type that represents any possible hook callback type supported by Arion.
 

Enumerations

enum  arion::ARION_HOOK_TYPE {
  arion::INTR_HOOK , arion::INSN_HOOK , arion::CODE_HOOK , arion::BLOCK_HOOK ,
  arion::MEM_READ_UNMAPPED_HOOK , arion::MEM_WRITE_UNMAPPED_HOOK , arion::MEM_FETCH_UNMAPPED_HOOK , arion::MEM_READ_PROT_HOOK ,
  arion::MEM_WRITE_PROT_HOOK , arion::MEM_FETCH_PROT_HOOK , arion::MEM_READ_HOOK , arion::MEM_WRITE_HOOK ,
  arion::MEM_FETCH_HOOK , arion::MEM_READ_AFTER_HOOK , arion::INSN_INVALID_HOOK , arion::EDGE_GENERATED_HOOK ,
  arion::TCG_OPCODE_HOOK , arion::TLB_FILL_HOOK , arion::FORK_HOOK , arion::EXECVE_HOOK ,
  arion::SYSCALL_HOOK
}
 Types for Arion hooks. More...
 

Functions

void arion::arion_intr_hook (uc_engine *uc, uint32_t intno, void *user_data)
 
void arion::arion_insn_hook (uc_engine *uc, void *user_data)
 
void arion::arion_code_hook (uc_engine *uc, uint64_t address, uint32_t size, void *user_data)
 
void arion::arion_block_hook (uc_engine *uc, uint64_t address, uint32_t size, void *user_data)
 
bool arion::arion_mem_read_unmapped_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_write_unmapped_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_fetch_unmapped_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_read_prot_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_write_prot_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_fetch_prot_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_read_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_write_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_fetch_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_mem_read_after_hook (uc_engine *uc, uc_mem_type access, uint64_t addr, int size, int64_t val, void *user_data)
 
bool arion::arion_insn_invalid_hook (uc_engine *uc, void *user_data)
 
void arion::arion_edge_generated_hook (uc_engine *uc, uc_tb *cur, uc_tb *prev, void *user_data)
 
void arion::arion_tcg_opcode_hook (uc_engine *uc, uint64_t addr, uint64_t arg1, uint64_t arg2, int size, void *user_data)
 
bool arion::arion_tlb_fill_hook (uc_engine *uc, uint64_t addr, uc_mem_type type, uc_tlb_entry *result, void *user_data)
 

Variables

std::map< ARION_HOOK_TYPE, uc_hook_type > arion::ARION_UC_HOOK_TYPES
 A map identifying a Unicorn hook type given its associated Arion hook type.
 
std::map< ARION_HOOK_TYPE, void * > arion::ARION_UC_HOOK_FUNCS
 A map identifying a hook function given its associated Arion hook type.