Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_core.h>
Go to the source code of this file.
Classes | |
struct | go_pc_line_table_t |
struct | go_string_recover_t |
struct | go_string_info_t |
struct | go_asm_pattern_t |
struct | go_signature_t |
Macros | |
#define | GO_MAX_STRING_SIZE 0x4000 |
#define | GO_1_2 (12) |
#define | GO_1_16 (116) |
#define | GO_1_18 (118) |
#define | IS_GOPCLNTAB_1_2_LE(x) (x[0] == 0xfb && x[1] == 0xff && x[2] == 0xff && x[3] == 0xff) |
#define | IS_GOPCLNTAB_1_2_BE(x) (x[3] == 0xfb && x[2] == 0xff && x[1] == 0xff && x[0] == 0xff) |
#define | IS_GOPCLNTAB_1_16_LE(x) (x[0] == 0xfa && x[1] == 0xff && x[2] == 0xff && x[3] == 0xff) |
#define | IS_GOPCLNTAB_1_16_BE(x) (x[3] == 0xfa && x[2] == 0xff && x[1] == 0xff && x[0] == 0xff) |
#define | IS_GOPCLNTAB_1_18_LE(x) (x[0] == 0xf0 && x[1] == 0xff && x[2] == 0xff && x[3] == 0xff) |
#define | IS_GOPCLNTAB_1_18_BE(x) (x[3] == 0xf0 && x[2] == 0xff && x[1] == 0xff && x[0] == 0xff) |
#define | is_addr_outside(x) ((x) <= begin || (x) >= end) |
#define | go_is_sign_match_autosize(ctx, info, sigs) go_is_sign_match(ctx, info, sigs, RZ_ARRAY_SIZE(sigs)) |
#define | go_asm_pattern_name(arch, bits, mnemonic) go_##arch##_##bits##_##mnemonic |
#define | go_asm_pattern_define(arch, bits, mnemonic, pattern, mask, set_xref) static GoAsmPattern go_asm_pattern_name(arch, bits, mnemonic) = { (const ut8 *)pattern, (const ut8 *)mask, (sizeof(pattern) - 1), set_xref } |
Typedefs | |
typedef struct go_pc_line_table_t | GoPcLnTab |
typedef struct go_string_recover_t | GoStrRecover |
typedef struct go_string_info_t | GoStrInfo |
typedef struct go_asm_pattern_t | GoAsmPattern |
typedef bool(* | GoDecodeCb) (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
typedef struct go_signature_t | GoSignature |
typedef ut32(* | GoStrRecoverCb) (GoStrRecover *ctx) |
Functions | |
ut32 | go_func_tab_field_size (GoPcLnTab *pclntab) |
ut64 | go_uintptr (GoPcLnTab *pclntab, ut8 *bytes) |
ut64 | go_offset (GoPcLnTab *pclntab, ut32 n_word) |
ut64 | go_data (GoPcLnTab *pclntab, ut32 n_word) |
static bool | is_pclntab_valid (GoPcLnTab *pclntab) |
static void | add_new_func_symbol (RzCore *core, const char *name, ut64 vaddr) |
static ut32 | core_recover_golang_functions_go_1_18 (RzCore *core, GoPcLnTab *pclntab) |
static ut32 | core_recover_golang_functions_go_1_16 (RzCore *core, GoPcLnTab *pclntab) |
static ut32 | core_recover_golang_functions_go_1_2 (RzCore *core, GoPcLnTab *pclntab) |
RZ_API bool | rz_core_analysis_recover_golang_functions (RzCore *core) |
reads pclntab table in go binaries and recovers functions. Follows the code https://github.com/golang/go/blob/master/src/debug/gosym/pclntab.go#L188 More... | |
static bool | add_new_bin_string (RzCore *core, char *string, ut64 vaddr, ut32 size) |
static bool | recover_string_at (GoStrRecover *ctx, ut64 str_addr, ut64 str_size) |
static bool | go_is_sign_match (GoStrRecover *ctx, GoStrInfo *info, GoSignature *sigs, const size_t n_sigs) |
static ut32 | decode_one_opcode_size (GoStrRecover *ctx) |
static bool | decode_from_table (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
static bool | decode_val_set_size (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
static bool | decode_val_set_addr (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
static bool | decode_val_add_addr (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
static bool | decode_ptr_set_addr (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
static bool | decode_disp_set_addr (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
go_asm_pattern_define (x86, 64, lea, "\x48\x00\x00\x00\x00\x00\x00", "\xff\x00\x00\x00\x00\x00\x00", true) | |
go_asm_pattern_define (x86, 64, mov_imm0, "\xb9\x00\x00\x00\x00", "\xff\x00\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 64, mov_imm1, "\x48\xc7\x00\x00\x00\x00\x00\x00", "\xff\xff\x00\x00\x00\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 64, mov_imm2, "\x41\x00\x00\x00\x00\x00", "\xff\x00\x00\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 64, mov_imm3, "\xbb\x00\x00\x00\x00", "\xff\x00\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 64, mov_imm4, "\xbf\x00\x00\x00\x00", "\xff\x00\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 64, mov_reg0, "\x48\x00\x00\x00", "\xff\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 64, mov_reg1, "\x48\x00\x00\x00\x00", "\xff\x00\x00\x00\x00", false) | |
static ut32 | golang_recover_string_x64 (GoStrRecover *ctx) |
go_asm_pattern_define (x86, 32, lea, "\x8d\x00\x00\x00\x00\x00", "\xff\x00\x00\x00\x00\x00", true) | |
go_asm_pattern_define (x86, 32, mov_imm0, "\xc7\x00\x00\x00\x00\x00\x00", "\xff\x00\x00\x00\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 32, mov_imm1, "\xc7\x00\x00\x00\x00\x00\x00\x00", "\xff\x00\x00\x00\x00\x00\x00\x00", false) | |
go_asm_pattern_define (x86, 32, mov_reg0, "\x89\x00\x00", "\xff\x00\x00", false) | |
go_asm_pattern_define (x86, 32, mov_reg1, "\x89\x00\x00\x00", "\xff\x00\x00\x00", false) | |
static ut32 | golang_recover_string_x86 (GoStrRecover *ctx) |
go_asm_pattern_define (arm, 64, adrp, "\x00\x00\x00\x80", "\x00\x00\x00\x8f", true) | |
go_asm_pattern_define (arm, 64, add, "\x00\x00\x00\x01", "\x00\x00\x00\x6f", false) | |
go_asm_pattern_define (arm, 64, orr, "\x00\x00\x00\x22", "\x00\x00\x80\x6f", false) | |
go_asm_pattern_define (arm, 64, movz, "\x00\x00\x80\x42", "\x00\x00\x80\x6f", false) | |
go_asm_pattern_define (arm, 64, any, "\x00\x00\x00\x00", "\x00\x00\x00\x00", false) | |
static ut32 | golang_recover_string_arm64 (GoStrRecover *ctx) |
static bool | decode_ldr_set_addr (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
go_asm_pattern_define (arm, 32, ldr, "\x00\x00\x9f\xe5", "\x00\x00\x9f\xe5", true) | |
go_asm_pattern_define (arm, 32, mov, "\x00\x00\xa0\xe3", "\x00\x00\xa0\xe3", false) | |
go_asm_pattern_define (arm, 32, any, "\x00\x00\x00\x00", "\x00\x00\x00\x00", false) | |
static ut32 | golang_recover_string_arm32 (GoStrRecover *ctx) |
static bool | decode_lui_set_addr (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
go_asm_pattern_define (mips, 32, any, "\x00\x00\x00\x00", "\x00\x00\x00\x00", false) | |
go_asm_pattern_define (mipsbe, 32, addiu, "\x24\x00\x00\x00", "\xff\x00\x00\x00", false) | |
go_asm_pattern_define (mipsle, 32, addiu, "\x00\x00\x00\x24", "\x00\x00\x00\xff", false) | |
go_asm_pattern_define (mipsbe, 32, lui, "\x3c\x00\x00\x00", "\xff\x00\x00\x00", true) | |
go_asm_pattern_define (mipsle, 32, lui, "\x00\x00\x00\x3c", "\x00\x00\x00\xff", true) | |
static ut32 | golang_recover_string_mips32 (GoStrRecover *ctx) |
go_asm_pattern_define (mips, 64, any, "\x00\x00\x00\x00", "\x00\x00\x00\x00", false) | |
go_asm_pattern_define (mipsbe, 64, daddu, "\x00\x00\x00\x2d", "\x00\x00\x00\xff", false) | |
go_asm_pattern_define (mipsle, 64, daddu, "\x2d\x00\x00\x00", "\xff\x00\x00\x00", false) | |
go_asm_pattern_define (mipsbe, 64, daddiu, "\x64\x00\x00\x00", "\xfc\x00\x00\x00", false) | |
go_asm_pattern_define (mipsle, 64, daddiu, "\x00\x00\x00\x64", "\x00\x00\x00\xfc", false) | |
go_asm_pattern_define (mipsbe, 64, move, "\x64\x00\x00\x00", "\xff\xe0\x00\x00", false) | |
go_asm_pattern_define (mipsle, 64, move, "\x00\x00\x00\x64", "\x00\x00\xe0\xff", false) | |
go_asm_pattern_define (mipsbe, 64, lui, "\x3c\x00\x00\x00", "\xff\x00\x00\x00", true) | |
go_asm_pattern_define (mipsle, 64, lui, "\x00\x00\x00\x3c", "\x00\x00\x00\xff", true) | |
static ut32 | golang_recover_string_mips64 (GoStrRecover *ctx) |
go_asm_pattern_define (ppc, 64, any, "\x00\x00\x00\x00", "\x00\x00\x00\x00", false) | |
go_asm_pattern_define (ppcle, 64, lis, "\x00\x00\x00\x3c", "\x00\x00\x00\xfc", true) | |
go_asm_pattern_define (ppcbe, 64, lis, "\x3c\x00\x00\x00", "\xfc\x00\x00\x00", true) | |
go_asm_pattern_define (ppcle, 64, addi, "\x00\x00\x00\x38", "\x00\x00\x00\xfc", false) | |
go_asm_pattern_define (ppcbe, 64, addi, "\x38\x00\x00\x00", "\xfc\x00\x00\x00", false) | |
go_asm_pattern_define (ppcle, 64, li, "\x00\x00\x00\x38", "\x00\x00\x1f\xfc", false) | |
go_asm_pattern_define (ppcbe, 64, li, "\x38\x00\x00\x00", "\xfc\x1f\x00\x00", false) | |
static ut32 | golang_recover_string_ppc64 (GoStrRecover *ctx) |
static bool | decode_auipc_set_addr (RzCore *core, GoStrInfo *info, ut64 pc, const ut8 *buffer, const ut32 size) |
go_asm_pattern_define (riscv, 64, auipc, "\x17\x00\x00\x00", "\x7f\x00\x00\x00", true) | |
go_asm_pattern_define (riscv, 64, addi, "\x13\x00\x00\x00", "\x7f\x00\x00\x00", false) | |
go_asm_pattern_define (riscv, 64, addiw, "\x1b\x00\x00\x00", "\x7f\x70\x00\x00", false) | |
go_asm_pattern_define (riscv, 64, li, "\x13\x00\x00\x00", "\x7f\x80\x0F\x00", false) | |
go_asm_pattern_define (riscv, 64, any, "\x00\x00\x00\x00", "\x00\x00\x00\x00", false) | |
static ut32 | golang_recover_string_riscv64 (GoStrRecover *ctx) |
RZ_API void | rz_core_analysis_resolve_golang_strings (RzCore *core) |
Attempts to recover all golang string. More... | |
#define go_is_sign_match_autosize | ( | ctx, | |
info, | |||
sigs | |||
) | go_is_sign_match(ctx, info, sigs, RZ_ARRAY_SIZE(sigs)) |
typedef struct go_asm_pattern_t GoAsmPattern |
typedef struct go_pc_line_table_t GoPcLnTab |
typedef struct go_signature_t GoSignature |
typedef struct go_string_info_t GoStrInfo |
typedef struct go_string_recover_t GoStrRecover |
typedef ut32(* GoStrRecoverCb) (GoStrRecover *ctx) |
Definition at line 486 of file golang.c.
References rz_core_t::bin, free(), rz_core_t::io, rz_bin_string_t::length, rz_bin_file_t::o, rz_bin_string_t::ordinal, rz_bin_string_t::paddr, rz_bin_cur(), rz_bin_object_get_string_at(), rz_bin_object_get_strings(), rz_bin_string_database_add(), rz_bin_string_free(), rz_io_v2p(), rz_list_length(), RZ_LOG_ERROR, RZ_NEW0, RZ_STRING_ENC_UTF8, rz_bin_string_t::size, rz_bin_string_t::string, rz_bin_object_t::strings, strings(), rz_bin_string_t::type, ut64(), and rz_bin_string_t::vaddr.
Referenced by recover_string_at().
Definition at line 136 of file golang.c.
References rz_core_t::bin, rz_bin_symbol_t::bind, rz_core_t::flags, rz_core_t::io, rz_bin_file_t::o, RZ_BIN_BIND_GLOBAL_STR, rz_bin_cur(), rz_bin_symbol_free(), rz_bin_symbol_new(), RZ_BIN_TYPE_FUNC_STR, rz_flag_set(), rz_io_v2p(), rz_list_append(), RZ_LOG_ERROR, rz_bin_object_t::symbols, rz_bin_symbol_t::type, and ut64().
Referenced by core_recover_golang_functions_go_1_16(), core_recover_golang_functions_go_1_18(), and core_recover_golang_functions_go_1_2().
Definition at line 235 of file golang.c.
References add_new_func_symbol(), go_pc_line_table_t::big_endian, go_pc_line_table_t::cutab, go_pc_line_table_t::filetab, rz_core_t::flags, free(), go_pc_line_table_t::funcdata, go_pc_line_table_t::funcnametab, go_pc_line_table_t::functab, go_pc_line_table_t::functabsize, go_data(), go_func_tab_field_size(), go_offset(), go_uintptr(), i, go_pc_line_table_t::io, is_pclntab_valid(), memset(), name, go_pc_line_table_t::nfiletab, go_pc_line_table_t::nfunctab, NULL, go_pc_line_table_t::pctab, PFMT64x, go_pc_line_table_t::ptrsize, rz_core_notify_done(), rz_core_notify_error(), rz_flag_set(), RZ_FLAGS_FS_SYMBOLS, rz_io_nread_at(), RZ_LOG_ERROR, RZ_LOG_INFO, rz_name_filter(), rz_read_ble32(), rz_str_len_utf8_ansi(), rz_str_newf(), rz_strf, and ut64().
Referenced by rz_core_analysis_recover_golang_functions().
Definition at line 160 of file golang.c.
References add_new_func_symbol(), go_pc_line_table_t::big_endian, go_pc_line_table_t::cutab, go_pc_line_table_t::filetab, rz_core_t::flags, free(), go_pc_line_table_t::funcdata, go_pc_line_table_t::funcnametab, go_pc_line_table_t::functab, go_pc_line_table_t::functabsize, go_data(), go_func_tab_field_size(), go_offset(), go_uintptr(), i, go_pc_line_table_t::io, is_pclntab_valid(), memset(), name, go_pc_line_table_t::nfiletab, go_pc_line_table_t::nfunctab, NULL, go_pc_line_table_t::pctab, PFMT64x, go_pc_line_table_t::ptrsize, rz_core_notify_done(), rz_core_notify_error(), rz_flag_set(), RZ_FLAGS_FS_SYMBOLS, rz_io_nread_at(), RZ_LOG_ERROR, RZ_LOG_INFO, rz_name_filter(), rz_read_ble32(), rz_str_len_utf8_ansi(), rz_str_newf(), rz_strf, go_pc_line_table_t::text_start, and ut64().
Referenced by rz_core_analysis_recover_golang_functions().
Definition at line 312 of file golang.c.
References add_new_func_symbol(), go_pc_line_table_t::big_endian, go_pc_line_table_t::filetab, rz_core_t::flags, free(), go_pc_line_table_t::functab, go_pc_line_table_t::functabsize, go_func_tab_field_size(), go_uintptr(), i, go_pc_line_table_t::io, is_pclntab_valid(), memset(), name, go_pc_line_table_t::nfiletab, go_pc_line_table_t::nfunctab, NULL, PFMT64x, go_pc_line_table_t::ptrsize, rz_core_notify_done(), rz_core_notify_error(), rz_flag_set(), RZ_FLAGS_FS_SYMBOLS, rz_io_nread_at(), RZ_LOG_ERROR, RZ_LOG_INFO, rz_name_filter(), rz_read_ble32(), rz_str_len_utf8_ansi(), rz_str_newf(), rz_strf, ut64(), and go_pc_line_table_t::vaddr.
Referenced by rz_core_analysis_recover_golang_functions().
|
static |
Definition at line 1496 of file golang.c.
References rz_core_t::analysis, info(), pc, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_DISASM, and rz_analysis_op_t::val.
|
static |
Definition at line 722 of file golang.c.
References rz_core_t::analysis, rz_analysis_op_t::disp, info(), pc, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), and RZ_ANALYSIS_OP_MASK_DISASM.
|
static |
Definition at line 662 of file golang.c.
References rz_core_t::analysis, rz_analysis_t::big_endian, rz_analysis_t::bits, info(), rz_core_t::io, rz_io_nread_at(), rz_read_ble(), and autogen_x86imm::tmp.
|
static |
Definition at line 1036 of file golang.c.
References addr, rz_core_t::analysis, rz_analysis_t::big_endian, info(), rz_core_t::io, pc, rz_analysis_op_t::ptr, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_DISASM, rz_io_nread_at(), rz_read_ble32(), autogen_x86imm::tmp, and ut64().
|
static |
Definition at line 1112 of file golang.c.
References rz_core_t::analysis, info(), pc, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_DISASM, and rz_analysis_op_t::val.
|
static |
Definition at line 645 of file golang.c.
References rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_DISASM, and rz_analysis_op_t::size.
Referenced by golang_recover_string_x64(), and golang_recover_string_x86().
|
static |
Definition at line 710 of file golang.c.
References rz_core_t::analysis, info(), pc, rz_analysis_op_t::ptr, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), and RZ_ANALYSIS_OP_MASK_DISASM.
|
static |
Definition at line 698 of file golang.c.
References rz_core_t::analysis, info(), pc, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_DISASM, and rz_analysis_op_t::val.
|
static |
Definition at line 686 of file golang.c.
References rz_core_t::analysis, info(), pc, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_DISASM, and rz_analysis_op_t::val.
|
static |
Definition at line 674 of file golang.c.
References rz_core_t::analysis, info(), pc, rz_analysis_op(), rz_analysis_op_fini(), rz_analysis_op_init(), RZ_ANALYSIS_OP_MASK_DISASM, and rz_analysis_op_t::val.
go_asm_pattern_define | ( | arm | , |
32 | , | ||
any | , | ||
"\x00\x00\x00\x00" | , | ||
"\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | arm | , |
64 | , | ||
any | , | ||
"\x00\x00\x00\x00" | , | ||
"\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | arm | , |
64 | , | ||
movz | , | ||
"\x00\x00\x80\x42" | , | ||
"\x00\x00\x80\x6f" | , | ||
false | |||
) |
go_asm_pattern_define | ( | arm | , |
64 | , | ||
orr | , | ||
"\x00\x00\x00\x22" | , | ||
"\x00\x00\x80\x6f" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mips | , |
32 | , | ||
any | , | ||
"\x00\x00\x00\x00" | , | ||
"\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mips | , |
64 | , | ||
any | , | ||
"\x00\x00\x00\x00" | , | ||
"\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsbe | , |
32 | , | ||
addiu | , | ||
"\x24\x00\x00\x00" | , | ||
"\xff\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsbe | , |
32 | , | ||
lui | , | ||
"\x3c\x00\x00\x00" | , | ||
"\xff\x00\x00\x00" | , | ||
true | |||
) |
go_asm_pattern_define | ( | mipsbe | , |
64 | , | ||
daddiu | , | ||
"\x64\x00\x00\x00" | , | ||
"\xfc\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsbe | , |
64 | , | ||
daddu | , | ||
"\x00\x00\x00\x2d" | , | ||
"\x00\x00\x00\xff" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsbe | , |
64 | , | ||
lui | , | ||
"\x3c\x00\x00\x00" | , | ||
"\xff\x00\x00\x00" | , | ||
true | |||
) |
go_asm_pattern_define | ( | mipsbe | , |
64 | , | ||
move | , | ||
"\x64\x00\x00\x00" | , | ||
"\xff\xe0\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsle | , |
32 | , | ||
addiu | , | ||
"\x00\x00\x00\x24" | , | ||
"\x00\x00\x00\xff" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsle | , |
32 | , | ||
lui | , | ||
"\x00\x00\x00\x3c" | , | ||
"\x00\x00\x00\xff" | , | ||
true | |||
) |
go_asm_pattern_define | ( | mipsle | , |
64 | , | ||
daddiu | , | ||
"\x00\x00\x00\x64" | , | ||
"\x00\x00\x00\xfc" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsle | , |
64 | , | ||
daddu | , | ||
"\x2d\x00\x00\x00" | , | ||
"\xff\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | mipsle | , |
64 | , | ||
lui | , | ||
"\x00\x00\x00\x3c" | , | ||
"\x00\x00\x00\xff" | , | ||
true | |||
) |
go_asm_pattern_define | ( | mipsle | , |
64 | , | ||
move | , | ||
"\x00\x00\x00\x64" | , | ||
"\x00\x00\xe0\xff" | , | ||
false | |||
) |
go_asm_pattern_define | ( | ppc | , |
64 | , | ||
any | , | ||
"\x00\x00\x00\x00" | , | ||
"\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | ppcbe | , |
64 | , | ||
addi | , | ||
"\x38\x00\x00\x00" | , | ||
"\xfc\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | ppcbe | , |
64 | , | ||
li | , | ||
"\x38\x00\x00\x00" | , | ||
"\xfc\x1f\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | ppcbe | , |
64 | , | ||
lis | , | ||
"\x3c\x00\x00\x00" | , | ||
"\xfc\x00\x00\x00" | , | ||
true | |||
) |
go_asm_pattern_define | ( | ppcle | , |
64 | , | ||
addi | , | ||
"\x00\x00\x00\x38" | , | ||
"\x00\x00\x00\xfc" | , | ||
false | |||
) |
go_asm_pattern_define | ( | ppcle | , |
64 | , | ||
li | , | ||
"\x00\x00\x00\x38" | , | ||
"\x00\x00\x1f\xfc" | , | ||
false | |||
) |
go_asm_pattern_define | ( | ppcle | , |
64 | , | ||
lis | , | ||
"\x00\x00\x00\x3c" | , | ||
"\x00\x00\x00\xfc" | , | ||
true | |||
) |
go_asm_pattern_define | ( | riscv | , |
64 | , | ||
addi | , | ||
"\x13\x00\x00\x00" | , | ||
"\x7f\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | riscv | , |
64 | , | ||
addiw | , | ||
"\x1b\x00\x00\x00" | , | ||
"\x7f\x70\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | riscv | , |
64 | , | ||
any | , | ||
"\x00\x00\x00\x00" | , | ||
"\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | riscv | , |
64 | , | ||
auipc | , | ||
"\x17\x00\x00\x00" | , | ||
"\x7f\x00\x00\x00" | , | ||
true | |||
) |
go_asm_pattern_define | ( | riscv | , |
64 | , | ||
li | , | ||
"\x13\x00\x00\x00" | , | ||
"\x7f\x80\x0F\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
32 | , | ||
lea | , | ||
"\x8d\x00\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00\x00" | , | ||
true | |||
) |
go_asm_pattern_define | ( | x86 | , |
32 | , | ||
mov_imm0 | , | ||
"\xc7\x00\x00\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
32 | , | ||
mov_imm1 | , | ||
"\xc7\x00\x00\x00\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
32 | , | ||
mov_reg0 | , | ||
"\x89\x00\x00" | , | ||
"\xff\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
32 | , | ||
mov_reg1 | , | ||
"\x89\x00\x00\x00" | , | ||
"\xff\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
lea | , | ||
"\x48\x00\x00\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00\x00\x00" | , | ||
true | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
mov_imm0 | , | ||
"\xb9\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
mov_imm1 | , | ||
"\x48\xc7\x00\x00\x00\x00\x00\x00" | , | ||
"\xff\xff\x00\x00\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
mov_imm2 | , | ||
"\x41\x00\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
mov_imm3 | , | ||
"\xbb\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
mov_imm4 | , | ||
"\xbf\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
mov_reg0 | , | ||
"\x48\x00\x00\x00" | , | ||
"\xff\x00\x00\x00" | , | ||
false | |||
) |
go_asm_pattern_define | ( | x86 | , |
64 | , | ||
mov_reg1 | , | ||
"\x48\x00\x00\x00\x00" | , | ||
"\xff\x00\x00\x00\x00" | , | ||
false | |||
) |
Definition at line 95 of file golang.c.
References go_offset(), ut64(), UT64_MAX, and go_pc_line_table_t::vaddr.
Referenced by core_recover_golang_functions_go_1_16(), and core_recover_golang_functions_go_1_18().
Definition at line 72 of file golang.c.
References GO_1_18, go_pc_line_table_t::ptrsize, and go_pc_line_table_t::version.
Referenced by core_recover_golang_functions_go_1_16(), core_recover_golang_functions_go_1_18(), and core_recover_golang_functions_go_1_2().
|
static |
Definition at line 599 of file golang.c.
References bytes, go_signature_t::decode, i, info(), go_asm_pattern_t::mask, memcpy(), memset(), go_signature_t::pasm, go_asm_pattern_t::pattern, go_asm_pattern_t::size, and go_asm_pattern_t::xrefs.
Definition at line 86 of file golang.c.
References bytes, go_uintptr(), go_pc_line_table_t::io, go_pc_line_table_t::ptrsize, rz_io_nread_at(), ut64(), UT64_MAX, and go_pc_line_table_t::vaddr.
Referenced by core_recover_golang_functions_go_1_16(), core_recover_golang_functions_go_1_18(), and go_data().
Definition at line 79 of file golang.c.
References go_pc_line_table_t::big_endian, bytes, go_pc_line_table_t::ptrsize, rz_read_ble32(), and rz_read_ble64().
Referenced by core_recover_golang_functions_go_1_16(), core_recover_golang_functions_go_1_18(), core_recover_golang_functions_go_1_2(), and go_offset().
|
static |
Definition at line 1092 of file golang.c.
References go_arm32_ldr_mov_signature, go_arm32_ldr_str_mov_signature, go_arm32_mov_str_ldr_signature, go_arm32_table_signature, go_is_sign_match_autosize, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
|
static |
Definition at line 1013 of file golang.c.
References go_arm64_adrp_add_movz_signature, go_arm64_adrp_add_orr_signature, go_arm64_adrp_add_str_movz_signature, go_arm64_adrp_add_str_orr_signature, go_arm64_movz_str_adrp_add_signature, go_arm64_orr_str_adrp_add_signature, go_arm64_table_signature, go_is_sign_match_autosize, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
|
static |
Definition at line 1213 of file golang.c.
References rz_analysis_t::big_endian, go_is_sign_match_autosize, go_mipsbe32_addiu_sw_lui_addiu_signature, go_mipsbe32_lui_addiu_addiu_signature, go_mipsbe32_lui_addiu_sw_addiu_signature, go_mipsbe32_table_signature, go_mipsle32_addiu_sw_lui_addiu_signature, go_mipsle32_lui_addiu_addiu_signature, go_mipsle32_lui_addiu_sw_addiu_signature, go_mipsle32_table_signature, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
|
static |
Definition at line 1348 of file golang.c.
References rz_analysis_t::big_endian, go_is_sign_match_autosize, go_mipsbe64_daddiu_sd_lui_daddu_daddiu_signature, go_mipsbe64_lui_daddu_daddiu_daddiu_signature, go_mipsbe64_lui_daddu_daddiu_sd_daddiu_signature, go_mipsbe64_table_signature, go_mipsle64_daddiu_sd_lui_daddu_daddiu_signature, go_mipsle64_lui_daddu_daddiu_daddiu_signature, go_mipsle64_lui_daddu_daddiu_sd_daddiu_signature, go_mipsle64_table_signature, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
|
static |
Definition at line 1465 of file golang.c.
References rz_analysis_t::big_endian, go_is_sign_match_autosize, go_ppcbe64_li_std_lis_addi_signature, go_ppcbe64_lis_addi_li_signature, go_ppcbe64_lis_addi_std_li_signature, go_ppcbe64_table_signature, go_ppcle64_li_std_lis_addi_signature, go_ppcle64_lis_addi_li_signature, go_ppcle64_lis_addi_std_li_signature, go_ppcle64_table_signature, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
|
static |
Definition at line 1585 of file golang.c.
References go_is_sign_match_autosize, go_riscv64_addiw_sd_auipc_add_signature, go_riscv64_auipc_add_addiw_signature, go_riscv64_auipc_add_li_signature, go_riscv64_auipc_add_sd_addiw_signature, go_riscv64_auipc_add_sd_li_signature, go_riscv64_li_sd_auipc_add_signature, go_riscv64_table_signature, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
|
static |
Definition at line 832 of file golang.c.
References decode_one_opcode_size(), go_is_sign_match_autosize, go_x64_lea_mov0_mov_signature, go_x64_lea_mov0_signature, go_x64_lea_mov1_mov_signature, go_x64_lea_mov1_signature, go_x64_lea_mov2_signature, go_x64_lea_mov3_signature, go_x64_mov0_lea_signature, go_x64_mov1_lea_signature, go_x64_mov2_lea_signature, go_x64_mov3_lea_signature, go_x64_table0_signature, go_x64_table1_signature, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
|
static |
Definition at line 913 of file golang.c.
References decode_one_opcode_size(), go_is_sign_match_autosize, go_x86_lea_mov0_mov_signature, go_x86_lea_mov0_signature, go_x86_lea_mov1_mov_signature, go_x86_lea_mov1_signature, go_x86_mov_lea_signature, go_x86_table_signature, info(), recover_string_at(), RZ_ANALYSIS_XREF_TYPE_STRING, and rz_analysis_xrefs_set().
Referenced by rz_core_analysis_resolve_golang_strings().
Definition at line 104 of file golang.c.
References go_pc_line_table_t::cutab, test_evm::end, go_pc_line_table_t::filetab, go_pc_line_table_t::funcdata, go_pc_line_table_t::funcnametab, go_pc_line_table_t::functab, go_pc_line_table_t::functabsize, GO_1_18, GO_1_2, is_addr_outside, go_pc_line_table_t::pctab, go_pc_line_table_t::size, go_pc_line_table_t::text_start, ut64(), go_pc_line_table_t::vaddr, and go_pc_line_table_t::version.
Referenced by core_recover_golang_functions_go_1_16(), core_recover_golang_functions_go_1_18(), and core_recover_golang_functions_go_1_2().
|
static |
Definition at line 527 of file golang.c.
References add_new_bin_string(), free(), GO_MAX_STRING_SIZE, malloc(), memcpy(), PFMT64x, rz_bin_cur_object(), rz_bin_get_section_at(), rz_flag_set(), rz_flag_unset_all_off(), RZ_FLAGS_FS_STRINGS, rz_io_nread_at(), RZ_LOG_ERROR, rz_name_filter(), rz_str_len_utf8_ansi(), and UT64_MAX.
Referenced by golang_recover_string_arm32(), golang_recover_string_arm64(), golang_recover_string_mips32(), golang_recover_string_mips64(), golang_recover_string_ppc64(), golang_recover_string_riscv64(), golang_recover_string_x64(), and golang_recover_string_x86().
reads pclntab table in go binaries and recovers functions. Follows the code https://github.com/golang/go/blob/master/src/debug/gosym/pclntab.go#L188
core | The RzCore to use |
Definition at line 405 of file golang.c.
References go_pc_line_table_t::big_endian, rz_core_t::bin, core_recover_golang_functions_go_1_16(), core_recover_golang_functions_go_1_18(), core_recover_golang_functions_go_1_2(), GO_1_16, GO_1_18, GO_1_2, header, go_pc_line_table_t::io, rz_core_t::io, IS_GOPCLNTAB_1_16_BE, IS_GOPCLNTAB_1_16_LE, IS_GOPCLNTAB_1_18_BE, IS_GOPCLNTAB_1_18_LE, IS_GOPCLNTAB_1_2_BE, IS_GOPCLNTAB_1_2_LE, rz_bin_symbol_t::name, PFMT64x, go_pc_line_table_t::ptrsize, go_pc_line_table_t::quantum, rz_bin_get_sections(), rz_bin_get_symbols(), rz_core_cmd0(), rz_core_notify_begin(), rz_core_notify_done(), rz_core_notify_error(), rz_io_nread_at(), RZ_LOG_ERROR, rz_read_be32(), rz_return_val_if_fail, go_pc_line_table_t::size, rz_bin_symbol_t::size, go_pc_line_table_t::text_start, go_pc_line_table_t::vaddr, rz_bin_symbol_t::vaddr, and go_pc_line_table_t::version.
Referenced by rz_core_analysis_everything(), and rz_recover_all_golang_functions_strings_handler().
Attempts to recover all golang string.
core | The RzCore struct to use |
Definition at line 1613 of file golang.c.
References rz_analysis_bb_t::addr, rz_core_t::analysis, rz_analysis_function_t::bbs, bytes, rz_core_t::config, rz_analysis_t::fcns, free(), golang_recover_string_arm32(), golang_recover_string_arm64(), golang_recover_string_mips32(), golang_recover_string_mips64(), golang_recover_string_ppc64(), golang_recover_string_riscv64(), golang_recover_string_x64(), golang_recover_string_x86(), i, rz_core_t::io, malloc(), NULL, PFMT64x, rz_analysis_archinfo(), RZ_ANALYSIS_ARCHINFO_MIN_OP_SIZE, rz_config_get(), rz_config_get_i(), rz_cons_is_breaked(), rz_core_notify_begin(), rz_core_notify_done(), rz_core_notify_error(), rz_io_nread_at(), RZ_LOG_ERROR, RZ_MAX, rz_return_if_fail, and rz_analysis_bb_t::size.
Referenced by rz_core_analysis_everything(), and rz_recover_all_golang_functions_strings_handler().
|
static |
Definition at line 1078 of file golang.c.
Referenced by golang_recover_string_arm32().
|
static |
Definition at line 1060 of file golang.c.
Referenced by golang_recover_string_arm32().
|
static |
Definition at line 1069 of file golang.c.
Referenced by golang_recover_string_arm32().
|
static |
Definition at line 1085 of file golang.c.
Referenced by golang_recover_string_arm32().
|
static |
Definition at line 995 of file golang.c.
Referenced by golang_recover_string_arm64().
|
static |
Definition at line 986 of file golang.c.
Referenced by golang_recover_string_arm64().
|
static |
Definition at line 953 of file golang.c.
Referenced by golang_recover_string_arm64().
|
static |
Definition at line 942 of file golang.c.
Referenced by golang_recover_string_arm64().
|
static |
Definition at line 975 of file golang.c.
Referenced by golang_recover_string_arm64().
|
static |
Definition at line 964 of file golang.c.
Referenced by golang_recover_string_arm64().
|
static |
Definition at line 1004 of file golang.c.
Referenced by golang_recover_string_arm64().
|
static |
Definition at line 1184 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1195 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1173 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1204 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1313 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1326 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1300 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1337 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1143 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1154 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1132 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1163 of file golang.c.
Referenced by golang_recover_string_mips32().
|
static |
Definition at line 1264 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1277 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1251 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1288 of file golang.c.
Referenced by golang_recover_string_mips64().
|
static |
Definition at line 1436 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1447 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1425 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1456 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1395 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1406 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1384 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1415 of file golang.c.
Referenced by golang_recover_string_ppc64().
|
static |
Definition at line 1547 of file golang.c.
Referenced by golang_recover_string_riscv64().
|
static |
Definition at line 1558 of file golang.c.
Referenced by golang_recover_string_riscv64().
|
static |
Definition at line 1567 of file golang.c.
Referenced by golang_recover_string_riscv64().
|
static |
Definition at line 1514 of file golang.c.
Referenced by golang_recover_string_riscv64().
|
static |
Definition at line 1525 of file golang.c.
Referenced by golang_recover_string_riscv64().
|
static |
Definition at line 1536 of file golang.c.
Referenced by golang_recover_string_riscv64().
|
static |
Definition at line 1576 of file golang.c.
Referenced by golang_recover_string_riscv64().
|
static |
Definition at line 744 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 762 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 753 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 769 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 776 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 783 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 790 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 797 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 804 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 811 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 818 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 825 of file golang.c.
Referenced by golang_recover_string_x64().
|
static |
Definition at line 867 of file golang.c.
Referenced by golang_recover_string_x86().
|
static |
Definition at line 885 of file golang.c.
Referenced by golang_recover_string_x86().
|
static |
Definition at line 876 of file golang.c.
Referenced by golang_recover_string_x86().
|
static |
Definition at line 892 of file golang.c.
Referenced by golang_recover_string_x86().
|
static |
Definition at line 899 of file golang.c.
Referenced by golang_recover_string_x86().
|
static |
Definition at line 906 of file golang.c.
Referenced by golang_recover_string_x86().