Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
RZ_API void rz_core_arch_bits_at | ( | RzCore * | core, |
ut64 | addr, | ||
RZ_OUT RZ_NULLABLE int * | bits, | ||
RZ_OUT RZ_BORROW RZ_NULLABLE const char ** | arch | ||
) |
Definition at line 97 of file cio.c.
References addr, rz_core_t::analysis, arch, rz_core_t::bin, bits(), rz_core_t::fixedarch, rz_core_t::fixedbits, rz_core_t::io, NULL, rz_analysis_hint_arch_at(), rz_analysis_hint_bits_at(), rz_bin_cur_object(), rz_bin_get_section_at(), RZ_SYS_BITS_16, RZ_SYS_BITS_32, RZ_SYS_BITS_64, s, and rz_io_t::va.
Referenced by bp_bits_at(), and rz_core_seek_arch_bits().
Definition at line 243 of file cio.c.
References rz_core_t::block, rz_core_t::blocksize, rz_core_t::io, rz_core_t::offset, and rz_io_read_at().
Referenced by __direction_disassembly_cb(), __print_hexdump_cb(), cb_iova(), cmd_print_bars(), file_resize(), handle_tmp_desc(), ioMemcpy(), open_nobin_file(), perform_mapped_file_yank(), prioritize_file(), rz_cmd_disassembly_all_possible_opcodes_handler(), rz_cmd_disassembly_all_possible_opcodes_treeview_handler(), rz_cmd_disassembly_n_instrs_as_text_json_handler(), rz_cmd_print(), rz_cmd_sizes_of_n_instructions_handler(), rz_core_bin_raise(), rz_core_binfiles_delete(), rz_core_cmd_subst_i(), rz_core_extend_at(), rz_core_file_open_load(), rz_core_file_reopen(), rz_core_file_reopen_remote_debug(), rz_core_handle_backwards_disasm(), rz_core_io_file_open(), rz_core_seek(), rz_core_serve(), rz_core_visual_cmd(), rz_core_visual_jump(), rz_core_write_at(), rz_main_rizin(), rz_open_binary_reload_handler(), rz_open_exchange_handler(), rz_open_maps_deprioritize_handler(), rz_open_maps_prioritize_handler(), rz_open_use_handler(), rz_write_cache_commit_all_handler(), rz_write_cache_remove_handler(), rz_write_from_file_handler(), and rz_write_from_io_xchg_handler().
Definition at line 50 of file cio.c.
References addr, append, rz_core_t::blocksize, eprintf, fd, benchmark::FILE, free(), i, rz_core_t::io, malloc(), NULL, rz_cons_break_pop(), rz_cons_break_push(), rz_cons_is_breaked(), rz_io_read_at(), rz_sys_fopen(), rz_sys_truncate(), and ut64().
Referenced by rz_cmd_debug_dmi(), and rz_core_visual_cmd().
Extend the file at current offset by inserting size
0 bytes at addr
.
addr
is an physical/virtual address based on the value of eval "io.va". When virtual it is translated to a physical address according to the IO map at the current offset
core | Reference to RzCore instance |
addr | Address where to insert new 0 bytes. |
size | Number of 0 bytes to insert |
Definition at line 172 of file cio.c.
References addr, rz_core_t::config, rz_core_t::io, map(), rz_core_t::offset, rz_config_get_i(), rz_core_block_read(), rz_io_extend_at(), rz_io_map_get(), and rz_return_val_if_fail.
Referenced by rz_write_extend_hexbytes_handler(), and rz_write_extend_zero_handler().
RZ_API RzCmdStatus rz_core_io_cache_print | ( | RzCore * | core, |
RzCmdStateOutput * | state | ||
) |
Definition at line 797 of file cio.c.
References c, rz_io_t::cache, free(), hex, i, rz_core_t::io, PFMT64u, PFMT64x, PFMTSZu, pj_end(), pj_kb(), pj_kn(), pj_ks(), pj_o(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_printf(), rz_hex_bin2strdup(), rz_itv_begin(), rz_itv_size(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_RIZIN, RZ_OUTPUT_MODE_STANDARD, rz_pvector_foreach, rz_return_val_if_fail, rz_warn_if_reached, and ut64().
Referenced by rz_write_cache_list_handler().
RZ_API RzCmdStatus rz_core_io_pcache_print | ( | RzCore * | core, |
RzIODesc * | desc, | ||
RzCmdStateOutput * | state | ||
) |
Definition at line 854 of file cio.c.
References c, desc, i, rz_core_t::io, PFMT64x, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_printf(), rz_io_desc_cache_list(), rz_itv_begin(), rz_itv_size(), rz_list_free(), RZ_OUTPUT_MODE_RIZIN, RZ_OUTPUT_MODE_STANDARD, rz_return_val_if_fail, and rz_warn_if_reached.
Referenced by rz_write_pcache_list_handler().
RZ_API RzCmdStatus rz_core_io_plugin_print | ( | RzIOPlugin * | plugin, |
RzCmdStateOutput * | state | ||
) |
Print an IO plugin according to state
.
plugin | Reference to RzIOPlugin |
state | Specify how the plugin shall be printed |
Definition at line 408 of file cio.c.
References rz_io_plugin_t::author, rz_io_plugin_t::desc, free(), rz_io_plugin_t::isdbg, rz_io_plugin_t::license, rz_io_plugin_t::name, pj_a(), pj_end(), pj_k(), pj_ks(), pj_o(), pj_s(), RZ_CMD_STATUS_NONEXISTINGCMD, RZ_CMD_STATUS_OK, rz_cons_printf(), rz_list_free(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_QUIET, RZ_OUTPUT_MODE_STANDARD, RZ_OUTPUT_MODE_TABLE, rz_str_split_list(), rz_table_add_rowf(), rz_table_set_columnsf(), rz_warn_if_reached, cmd_descs_generate::str, strdup(), rz_io_plugin_t::uris, rz_io_plugin_t::version, and rz_io_plugin_t::write.
Referenced by rz_core_io_plugins_print().
RZ_API RzCmdStatus rz_core_io_plugins_print | ( | RzIO * | io, |
RzCmdStateOutput * | state | ||
) |
Print the registered IO plugins according to state
.
io | Reference to RzIO instance |
state | Specify how plugins shall be printed |
Definition at line 481 of file cio.c.
References rz_io_t::plugins, rz_cmd_state_output_array_end(), rz_cmd_state_output_array_start(), rz_cmd_state_output_set_columnsf(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, and rz_core_io_plugin_print().
Referenced by rz_main_rizin(), and rz_plugins_io_print_handler().
Definition at line 250 of file cio.c.
References eprintf, rz_core_t::io, rz_io_is_valid_offset(), and rz_sys_backtrace().
Definition at line 132 of file cio.c.
References addr, arch, bits(), rz_core_t::config, NULL, rz_config_set(), rz_config_set_i(), and rz_core_arch_bits_at().
Referenced by archbits(), rz_core_analysis_esil(), rz_core_analysis_fcn(), rz_core_disasm_pde(), rz_core_print_disasm(), and rz_core_print_disasm_instructions_with_buf().
Definition at line 7 of file cio.c.
References eprintf, fd, NULL, p, pid, r, rz_config_get(), rz_config_set(), rz_config_set_i(), rz_core_debug_attach(), rz_core_debug_continue_until(), rz_core_reg_update_flags(), rz_core_seek_to_register(), rz_debug_select(), rz_io_desc_get(), rz_io_desc_get_pid(), rz_num_math(), and ut64().
Referenced by rz_core_file_reopen(), and rz_main_rizin().
Shift a block of data from addr
of size b_size
left or right based on dist
.
core | Reference to RzCore instance |
addr | Address of the block of data to move |
b_size | Size of the block of data to move |
dist | Where to shift the data, whether backward or forward and how distant from the original position |
Definition at line 197 of file cio.c.
References addr, calloc(), eprintf, rz_core_file_t::fd, rz_core_t::file, free(), rz_core_t::io, NULL, rz_core_seek(), rz_io_read_at(), rz_io_size(), rz_io_use_fd(), rz_io_write_at(), st64, ut64(), and UT64_MAX.
Referenced by rz_write_extend_shift_handler().
RZ_API RZ_OWN ut8* rz_core_transform_op | ( | RzCore * | core, |
ut64 | addr, | ||
RzCoreWriteOp | op, | ||
ut8 * | hex, | ||
int | hexlen, | ||
int * | buflen | ||
) |
Transform a block of data at addr
according to the operation op
and the hexvalue hex
.
core | Reference to RzCore instance |
addr | Where the block of data to modify starts |
op | Operation to perform on the block of data |
hex | Optional hex string that may be required by the specific operation |
hexlen | Optional length of the hex string. Must be present if hex is specified. |
buflen | Used to return the length of the returned buffer |
Definition at line 934 of file cio.c.
References addr, rz_core_t::blocksize, buflen, free(), hex, i, rz_core_t::io, len, NULL, RZ_CORE_WRITE_OP_ADD, RZ_CORE_WRITE_OP_AND, RZ_CORE_WRITE_OP_BYTESWAP2, RZ_CORE_WRITE_OP_BYTESWAP4, RZ_CORE_WRITE_OP_BYTESWAP8, RZ_CORE_WRITE_OP_DIV, RZ_CORE_WRITE_OP_MUL, RZ_CORE_WRITE_OP_OR, RZ_CORE_WRITE_OP_SHIFT_LEFT, RZ_CORE_WRITE_OP_SHIFT_RIGHT, RZ_CORE_WRITE_OP_SUB, RZ_CORE_WRITE_OP_XOR, rz_io_nread_at(), RZ_NEWS, rz_read_le16(), rz_read_le32(), rz_read_le64(), rz_return_val_if_fail, rz_warn_if_reached, rz_write_be16(), rz_write_be32(), rz_write_be64(), and ut64().
Referenced by old_transform_op(), and rz_core_write_block_op_at().
RZ_API int rz_core_write_assembly | ( | RzCore * | core, |
ut64 | addr, | ||
RZ_NONNULL const char * | instructions | ||
) |
Assembles instructions and writes the resulting data at the given offset.
core | RzCore reference |
addr | Address to where to write |
instructions | List of instructions to assemble as a string |
Definition at line 327 of file cio.c.
References rz_asm_code_t::bytes, err, instructions, rz_asm_code_t::len, rz_core_t::num, rz_core_t::offset, PFMT64x, rz_core_t::rasm, rz_asm_code_free(), rz_asm_massemble(), rz_asm_set_pc(), rz_core_write_at(), RZ_LOG_ERROR, rz_return_val_if_fail, and rz_num_t::value.
Referenced by rz_core_hack_arm64(), rz_write_assembly_file_handler(), and rz_write_assembly_handler().
RZ_API int rz_core_write_assembly_fill | ( | RzCore * | core, |
ut64 | addr, | ||
RZ_NONNULL const char * | instructions | ||
) |
Assemble instructions and write the resulting data inside the current instruction.
Assemble one or more instructions and write the resulting data inside the current instruction, if the new instructions fit. Fill the rest of the bytes of the old instruction with NOP
core | RzCore reference |
addr | Address to where to write |
instructions | List of instructions to assemble as a string |
Definition at line 365 of file cio.c.
References rz_core_t::analysis, rz_core_t::block, rz_core_t::blocksize, rz_asm_code_t::bytes, err, instructions, rz_asm_code_t::len, rz_core_t::num, rz_core_t::offset, PFMT64x, rz_core_t::rasm, rz_analysis_op(), RZ_ANALYSIS_OP_MASK_BASIC, rz_asm_code_free(), rz_asm_massemble(), rz_asm_set_pc(), rz_core_hack(), rz_core_write_at(), RZ_LOG_ERROR, rz_return_val_if_fail, and rz_num_t::value.
Referenced by rz_write_assembly_inside_handler().
Definition at line 145 of file cio.c.
References addr, rz_core_t::blocksize, rz_core_t::config, rz_core_t::io, rz_core_t::offset, rz_config_get_i(), rz_core_block_read(), rz_core_seek_delta(), rz_io_write_at(), rz_return_val_if_fail, and UT64_MAX.
Referenced by cmd_write_bits(), encrypt_or_decrypt_block(), initialize_stack(), insert_mode_enabled(), rz_core_serve(), rz_core_visual_bit_editor(), rz_core_write_assembly(), rz_core_write_assembly_fill(), rz_core_write_base64_at(), rz_core_write_base64d_at(), rz_core_write_block(), rz_core_write_block_op_at(), rz_core_write_duplicate_at(), rz_core_write_hexpair(), rz_core_write_length_string_at(), rz_core_write_random_at(), rz_core_write_seq_at(), rz_core_write_string_at(), rz_core_write_string_wide_at(), rz_core_write_string_zero_at(), rz_core_write_value_at(), rz_core_write_value_inc_at(), rz_core_yank_paste(), rz_write_extend_hexbytes_handler(), rz_write_unified_patch_handler(), and rz_write_zero_handler().
Write a given string s
at the specified addr
encoded as base64.
core | RzCore reference |
addr | Address where to write the string |
s | String to encode as base64 and then written. |
Definition at line 700 of file cio.c.
References addr, calloc(), err, free(), len, malloc(), PFMT64x, rz_base64_encode(), rz_core_write_at(), rz_hex_str2bin(), RZ_LOG_ERROR, rz_return_val_if_fail, and s.
Referenced by rz_write_base64_encode_handler().
Write a given base64 string s
at the specified addr
, decoded.
core | RzCore reference |
addr | Address where to write the string |
s | String to decode from base64 and then written |
Definition at line 745 of file cio.c.
References addr, err, free(), len, malloc(), PFMT64x, rz_base64_decode(), rz_core_write_at(), RZ_LOG_ERROR, rz_return_val_if_fail, and s.
Referenced by rz_write_base64_decode_handler().
Writes the bytes data
at address addr
cyclically until it fills the whole block
It repeats the data data
with length len
until it fills an entire block starting at addr
.
core | RzCore reference |
addr | Address to where to write |
data | Array of bytes to cyclically write in the block at addr |
len | Length of data |
Definition at line 299 of file cio.c.
References addr, rz_core_t::blocksize, err, free(), len, PFMT64x, rz_core_write_at(), RZ_LOG_ERROR, rz_mem_copyloop(), RZ_NEWS, and rz_return_val_if_fail.
Referenced by rz_write_block_handler().
RZ_API bool rz_core_write_block_op_at | ( | RzCore * | core, |
ut64 | addr, | ||
RzCoreWriteOp | op, | ||
ut8 * | hex, | ||
int | hexlen | ||
) |
Write a full block of data according to the operation op
and the hexvalue hex
.
core | Reference to RzCore instance |
addr | Where the block of data to modify starts |
op | Operation to perform on the block of data |
hex | Optional hex string that may be required by the specific operation |
hexlen | Optional length of the hex string. Must be present if hex is specified. |
Definition at line 1038 of file cio.c.
References addr, buflen, free(), hex, PFMT64x, rz_core_transform_op(), rz_core_write_at(), and RZ_LOG_ERROR.
Referenced by rz_write_op_2byteswap_handler(), rz_write_op_4byteswap_handler(), rz_write_op_8byteswap_handler(), and write_op_val().
Copy len
bytes from from
to addr
.
core | Reference to RzCore instance |
addr | Where the data should be copied to |
from | Where the data should be read from |
len | Number of bytes to copy, expected to not be negative |
Definition at line 1106 of file cio.c.
References addr, err, free(), from, rz_core_t::io, len, n, PFMT64x, rz_core_write_at(), rz_io_nread_at(), RZ_LOG_ERROR, RZ_NEWS, and rz_return_val_if_fail.
Referenced by rz_write_duplicate_handler().
Writes the hexadecimal string at the given offset
Returns the length of the written data.
core | RzCore reference |
addr | Address to where to write |
pairs | Data as the hexadecimal string |
Definition at line 268 of file cio.c.
References addr, err, free(), len, malloc(), PFMT64x, rz_core_write_at(), rz_hex_str2bin(), RZ_LOG_ERROR, and rz_return_val_if_fail.
Referenced by __insert_value(), insert_mode_enabled(), rz_core_hack_arm(), rz_core_hack_arm64(), rz_core_hack_dalvik(), rz_core_hack_x86(), rz_write_hex_from_file_handler(), and rz_write_hex_handler().
Write at the specified addr
the length of the string in one byte, followed by the given string s
.
core | RzCore reference |
addr | Address where to write the string |
s | String to write. The string is unescaped, meaning that if there is \n it becomes 0x0a |
Definition at line 673 of file cio.c.
References addr, free(), len, PFMT64x, rz_core_write_at(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_str_unescape(), s, cmd_descs_generate::str, strdup(), and ut8.
Referenced by rz_write_length_string_handler().
Write len
random bytes at address addr
.
core | RzCore reference |
addr | Address where to write the data |
len | Length of the random data to write |
Definition at line 773 of file cio.c.
References addr, err, free(), i, len, malloc(), PFMT64x, rz_core_write_at(), RZ_LOG_ERROR, rz_num_irand(), rz_num_rand(), and rz_return_val_if_fail.
Referenced by rz_write_random_handler().
RZ_API bool rz_core_write_seq_at | ( | RzCore * | core, |
ut64 | addr, | ||
ut64 | from, | ||
ut64 | to, | ||
ut64 | step, | ||
int | value_size | ||
) |
Write a full block of data with a sequence.
Write a full block of data with a sequence of numbers starting from from
up to to
, with a step of step
. The values are written as numbers of value_size
bytes.
core | Reference to RzCore instance |
addr | Where the block of data to modify starts |
from | From where to start the sequence of numbers |
to | Where to stop in the sequence |
step | Difference between two numbers in the sequence |
value_size | Size of each number of the sequence, in bytes |
Definition at line 1069 of file cio.c.
References addr, rz_core_t::blocksize, rz_core_t::config, free(), from, i, p, PFMT64d, PFMT64x, rz_config_get_b(), rz_core_write_at(), RZ_LOG_ERROR, RZ_NEWS0, rz_return_val_if_fail, rz_write_ble(), step(), to, and ut64().
Referenced by rz_write_op_sequence_handler().
Write a given string s
at the specified addr
.
core | RzCore reference |
addr | Address where to write the string |
s | String to write. The string is unescaped, meaning that if there is \n it becomes 0x0a |
Definition at line 605 of file cio.c.
References addr, free(), len, PFMT64x, rz_core_write_at(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_str_unescape(), s, cmd_descs_generate::str, and strdup().
Referenced by rz_write_debruijn_handler(), and rz_write_handler().
Write a given string s
as a wide string at the specified addr
.
core | RzCore reference |
addr | Address where to write the string |
s | String to write. The string is unescaped, meaning that if there is \n it becomes 0x0a |
Definition at line 630 of file cio.c.
References addr, free(), i, len, PFMT64x, rz_core_write_at(), RZ_LOG_ERROR, RZ_NEWS, rz_return_val_if_fail, rz_str_unescape(), s, cmd_descs_generate::str, strdup(), and autogen_x86imm::tmp.
Referenced by rz_write_wide_string_handler().
Write a given string s
, followed by the zero terminator, at the specified addr
.
core | RzCore reference |
addr | Address where to write the string |
s | String to write. The string is unescaped, meaning that if there is \n it becomes 0x0a |
Definition at line 905 of file cio.c.
References addr, free(), len, PFMT64x, rz_core_write_at(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_str_unescape(), s, cmd_descs_generate::str, and strdup().
Referenced by rz_write_zero_string_handler().
Write a given value
at the specified address
, using sz
bytes.
core | RzCore reference |
addr | Address where to write the value |
value | Value to write |
sz | Number of bytes to write. Can be 1, 2, 4, 8 or the special value 0 if you want the function to choose based on value (4 if value is <4GB, 8 otherwise) |
Definition at line 506 of file cio.c.
References addr, rz_core_t::config, rz_core_t::num, PFMT64x, rz_config_get_i(), rz_core_write_at(), RZ_LOG_ERROR, rz_return_val_if_fail, rz_write_ble16(), rz_write_ble32(), rz_write_ble64(), rz_write_ble8(), UT16_MAX, UT32_MAX, ut64(), UT64_32U, UT8_MAX, value, and rz_num_t::value.
Referenced by common_write_value_handler().
Write at addr
the current value + value
passed as argument.
The values read/written are considered as integers of sz
bytes.
core | RzCore reference |
addr | Address where to overwrite the value |
value | Value to sum to the existing value in addr |
sz | Size of the values, in bytes, to consider. Can be 1, 2, 4, 8. |
Definition at line 551 of file cio.c.
References addr, rz_core_t::config, rz_core_t::io, PFMT64x, rz_config_get_i(), rz_core_write_at(), rz_io_read_at_mapped(), RZ_LOG_ERROR, rz_read_ble16(), rz_read_ble32(), rz_read_ble64(), rz_read_ble8(), rz_return_val_if_fail, rz_warn_if_reached, rz_write_ble16(), rz_write_ble32(), rz_write_ble64(), rz_write_ble8(), ut64(), and value.
Referenced by w_incdec_handler().