RzBin#
- class RzBin#
-
- property binxtrs: RzList[RzBinXtrPlugin]#
- property cb_printf: PrintfCallback#
- property consb: RzConsBind#
- property constpool: RzStrConstPool#
- property debase64: int#
- property demangler: RzDemangler#
- property event: RzEvent#
- property file: str#
- property filter: int#
- property filter_rules: int#
- property force: str#
- property ids: RzIDStorage#
- property iob: RzIOBind#
- property is_debugger: int#
- property is_reloc_patched: bool#
- property loadany: int#
- property maxstrbuf: int#
- property maxstrlen: int#
- property minstrlen: int#
- property narch: int#
- property plugins: RzList[RzBinPlugin]#
- property prefix: str#
- property rawstr: int#
- property srcdir: str#
- property strenc: str#
- property strfilter: int#
- property _strpurge: str#
- property strseach_check_ascii_freq: bool#
- property use_xtr: bool#
- property user: Any#
- property verbose: bool#
- property want_dbginfo: bool#
- static arch_options_init(arch: str, bits: int) None #
Calls function
rz_bin_arch_options_init
(defined in bin.c)
- static demangle(language: str, symbol: str, vaddr: int, libs: bool) str #
Calls function
rz_bin_demangle
(defined in bin.c)Demangles a symbol based on the language or the RzBinFile data.
This function demangles a symbol based on the language or the RzBinFile data When C++ or rust is selected as the language, it will add methods into the RzBinFile structure based on the demangled symbol. When libs is set to true, the demangled symbol will be appended to the library name <libname>_<demangled symbol>.
- Parameters:
bf – RzBinFile data to be used for demangling
language – Language to be used for demanglind
symbol – Symbol to be demangled
vaddr – vaddr of the
symbol
to be demangledlibs – Append the library name to the demangled symbol, if set to true
- Returns:
char* Demangled name of the
symbol
- static field_new(vaddr: int, size: int, name: str, comment: str, format: str, format_named: bool) RzBinField #
Calls function
rz_bin_field_new
(defined in bin.c)
- static filter_name(db: HtPU, addr: int, name: str) str #
Calls function
rz_bin_filter_name
(defined in filter.c)
- static filter_sections(list: RzList[RzBinSection]) None #
Calls function
rz_bin_filter_sections
(defined in filter.c)
- static filter_sym(ht: HtPP, vaddr: int, sym: RzBinSymbol) None #
Calls function
rz_bin_filter_sym
(defined in filter.c)
- static filter_symbols(list: RzList[RzBinSymbol]) None #
Calls function
rz_bin_filter_symbols
(defined in filter.c)
- static get_meth_flag_string(compact: bool) str #
Calls function
rz_bin_get_meth_flag_string
(defined in bin.c)
- static get_section_at(off: int, va: int) RzBinSection #
Calls function
rz_bin_get_section_at
(defined in bin.c)Find the binary section at offset
off
.- Parameters:
o – Reference to the
RzBinObject
instanceoff – Address to search
va – When 0 the offset
off
is considered a physical address, otherwise a virtual address
- Returns:
Pointer to a
RzBinSection
containing the address
- static language_detect() RzBinLanguage #
Calls function
rz_bin_language_detect
(defined in bin_language.c)Tries to detect which language is used in the binary based on symbols and libraries.
Currently this method can detect the language only from bins that are either ELF, PE, Mach-O, Java Class and Dex.
The current supported languages are: c, cxx, dart, dlang, go, groovy, java, kotlin, msvc, objc, rust, swift.
- static language_to_id() RzBinLanguage #
Calls function
rz_bin_language_to_id
(defined in bin_language.c)returns the language identifier based on the given lang name
- static language_to_string() str #
Calls function
rz_bin_language_to_string
(defined in bin_language.c)returns the language name based on the given language identifier
- static maps_of_file_sections() RzList[RzBinMap] #
Calls function
rz_bin_maps_of_file_sections
(defined in bin.c)Create a list of RzBinMap from RzBinSections queried from the given file.
Some binary formats have a 1:1 correspondence of mapping and their RzBinSections. This is not always the case (e.g. ELF) but if it is, plugins can use this function as their maps callback, which will generate mappings for sections.
- static object_addr_with_base(addr: int) int #
Calls function
rz_bin_object_addr_with_base
(defined in bobj.c)Put the given address on top of o’s base address.
- static object_get_classes() RzList[RzBinClass] #
Calls function
rz_bin_object_get_classes
(defined in bobj.c)Get list of
RzBinClass
representing the classes (e.g. C++ classes) defined in the binary object.
- static object_get_entries() RzList[RzBinAddr] #
Calls function
rz_bin_object_get_entries
(defined in bobj.c)Get list of
RzBinAddr
representing the entry points of the binary object.
- static object_get_fields() RzList[RzBinField] #
Calls function
rz_bin_object_get_fields
(defined in bobj.c)Get list of
RzBinField
representing the fields of the binary object.
- static object_get_imports() RzList[RzBinImport] #
Calls function
rz_bin_object_get_imports
(defined in bobj.c)Get list of
RzBinImport
representing the imports of the binary object.
- static object_get_info() RzBinInfo #
Calls function
rz_bin_object_get_info
(defined in bobj.c)Get the
RzBinInfo
of the binary object.
- static object_get_libs() RzList[char] #
Calls function
rz_bin_object_get_libs
(defined in bobj.c)Get list of
char*
representing the libraries used by the binary object.
- static object_get_map_at(off: int, va: bool) RzBinMap #
Calls function
rz_bin_object_get_map_at
(defined in bin.c)Find the last binary map at offset
off
.This function returns the last binary map that contains offset
off
, because it assumes that maps are sorted by priority, thus the last one will be the most important one.- Parameters:
o – Reference to the
RzBinObject
instanceoff – Address to search
va – When false the offset
off
is considered a physical address, otherwise a virtual address
- Returns:
Pointer to a
RzBinMap
containing the address
- static object_get_maps_at(off: int, va: bool) RzPVector[RzBinMap] #
Calls function
rz_bin_object_get_maps_at
(defined in bin.c)Find all binary maps at offset
off
.- Parameters:
o – Reference to the
RzBinObject
instanceoff – Address to search
va – When false the offset
off
is considered a physical address, otherwise a virtual address
- Returns:
Vector of
RzBinMap
pointers
- static object_get_mem() RzList[RzBinMem] #
Calls function
rz_bin_object_get_mem
(defined in bobj.c)Get list of
RzBinMem
representing the memory regions identified in the binary object.
- static object_get_resources() RzList[RzBinResource] #
Calls function
rz_bin_object_get_resources
(defined in bobj.c)Get a list of
RzBinResource
representing the resources in the binary object.
- static object_get_sections() RzList[RzBinSection] #
Calls function
rz_bin_object_get_sections
(defined in bobj.c)Get list of
RzBinSection
representing only the sections of the binary object.
- static object_get_sections_all() RzList[RzBinSection] #
Calls function
rz_bin_object_get_sections_all
(defined in bobj.c)Get list of
RzBinSection
representing both the sections and the segments of the binary object.
- static object_get_segments() RzList[RzBinSection] #
Calls function
rz_bin_object_get_segments
(defined in bobj.c)Get list of
RzBinSection
representing only the segments of the binary object.
- static object_get_special_symbol(sym: RzBinSpecialSymbol) RzBinAddr #
Calls function
rz_bin_object_get_special_symbol
(defined in bobj.c)Return the
RzBinAddr
structure representing the special symbolsym
.
- static object_get_string_at(address: int, is_va: bool) RzBinString #
Calls function
rz_bin_object_get_string_at
(defined in bobj.c)Return RzBinString if at
address
there
is an entry in the RzBinObject string database.
- static object_get_strings() RzList[RzBinString] #
Calls function
rz_bin_object_get_strings
(defined in bobj.c)Get list of
RzBinString
representing the strings identified in the binary object.
- static object_get_symbol_of_import(imp: RzBinImport) RzBinSymbol #
Calls function
rz_bin_object_get_symbol_of_import
(defined in bobj.c)Find the symbol that represents the given import This is necessary for example to determine the address of an import.
- static object_get_symbols() RzList[RzBinSymbol] #
Calls function
rz_bin_object_get_symbols
(defined in bobj.c)Get list of
RzBinSymbol
representing the symbols in the binary object.
- static object_get_vaddr(paddr: int, vaddr: int) int #
Calls function
rz_bin_object_get_vaddr
(defined in bobj.c)
- static object_get_virtual_file(name: str) RzBinVirtualFile #
Calls function
rz_bin_object_get_virtual_file
(defined in bobj.c)
- static object_is_big_endian() bool #
Calls function
rz_bin_object_is_big_endian
(defined in bobj.c)Return true if the binary object
obj
is big endian.
- static object_is_static() bool #
Calls function
rz_bin_object_is_static
(defined in bobj.c)Return true if the binary object
obj
is detected as statically compiled.
- static object_p2v(paddr: int) int #
Calls function
rz_bin_object_p2v
(defined in bobj.c)Convert offset in the file to virtual address according to binary mappings.
- Parameters:
obj – Reference to
RzBinObject
paddr – Offset in the file
- Returns:
Converted offset to virtual address or UT64_MAX if the conversion cannot be done
- static object_p2v_all(paddr: int) RzVector[ut64] #
Calls function
rz_bin_object_p2v_all
(defined in bobj.c)Convert offset in the file to all possible virtual addresses according to binary mappings.
- Parameters:
obj – Reference to
RzBinObject
paddr – Offset in the file
- Returns:
Vector containing
ut64
values of all possible virtual addresses
- static object_patch_relocs(o: RzBinObject) RzBinRelocStorage #
Calls function
rz_bin_object_patch_relocs
(defined in bobj.c)
- static object_sections_mapping_list() RzVector[RzBinSectionMap] #
Calls function
rz_bin_object_sections_mapping_list
(defined in bobj.c)Get the mapping between segments and sections in the binary.
- Returns:
A RzVector* with RzBinSectionMap structure inside.
- static object_set_items(o: RzBinObject) int #
Calls function
rz_bin_object_set_items
(defined in bobj.c)
- static object_v2p(vaddr: int) int #
Calls function
rz_bin_object_v2p
(defined in bobj.c)Convert virtual address to offset in the file according to binary mappings.
- Parameters:
obj – Reference to
RzBinObject
paddr – Virtual address
- Returns:
Converted virtual address to offset in the file or UT64_MAX if the conversion cannot be done
- static options_init(fd: int, baseaddr: int, loadaddr: int, patch_relocs: bool) None #
Calls function
rz_bin_options_init
(defined in bin.c)
- static reloc_size() int #
Calls function
rz_bin_reloc_size
(defined in bobj.c)size of the reloc (where it is supposed to be patched) in bits
- static reloc_storage_get_reloc_in(vaddr: int, size: int) RzBinReloc #
Calls function
rz_bin_reloc_storage_get_reloc_in
(defined in bobj.c)Get the reloc with the lowest vaddr that starts inside the given interval.
- static reloc_storage_get_reloc_to(vaddr: int) RzBinReloc #
Calls function
rz_bin_reloc_storage_get_reloc_to
(defined in bobj.c)Get a reloc that points exactly to vaddr or NULL.
- static reloc_storage_new() RzBinRelocStorage #
Calls function
rz_bin_reloc_storage_new
(defined in bobj.c)
- static reloc_target_builder_free() None #
Calls function
rz_bin_reloc_target_builder_free
(defined in relocs_patch.c)
- static reloc_target_builder_get_target(sym: int) int #
Calls function
rz_bin_reloc_target_builder_get_target
(defined in relocs_patch.c)obtain the address of the target for a given symbol
When patchin a reloc that points to some symbol that itself is not part of the file (e.g. an import), this function is used to obtain an address in the reloc target map that the reloc can be patched to. On the first call with a new symbol, the builder will allocate a new address, which will be returned on all following calls with the same sym value.
- Parameters:
sym – some (uninterpreted) unique identifier for a symbol. This function will always return the same value for a single symbol.
- static reloc_target_builder_new(target_base: int) RzBinRelocTargetBuilder #
Calls function
rz_bin_reloc_target_builder_new
(defined in relocs_patch.c)- Parameters:
target_size – size of a single reloc target in the vfile
target_base – base address where the target vfile will be mapped, generated targets will start at this address.
- static relocs_patch_find_targets_map_base(target_sz: int) int #
Calls function
rz_bin_relocs_patch_find_targets_map_base
(defined in relocs_patch.c)Finm a suitable location for putting the artificial reloc targets map.
- static relocs_patch_maps(buf_patched: RzBuffer, buf_patched_offset: int, target_vfile_base: int, target_vfile_size: int, vfile_name_patched: str, vfile_name_reloc_targets: str) None #
Calls function
rz_bin_relocs_patch_maps
(defined in relocs_patch.c)Change file-mapped maps to the patched vfile if covered by the buffer and add the reloc target map.
- Parameters:
buf_patched_offset – the offset of the data in buf_patched inside the real file. This is especially relevant for fatmach0 where the buf starts further into the fat file.
- static section_new() RzBinSection #
Calls function
rz_bin_section_new
(defined in bin.c)
- static sections_of_maps() RzList[RzBinSection] #
Calls function
rz_bin_sections_of_maps
(defined in bin.c)Create a list of RzBinSection from RzBinMaps.
Some binary formats have a 1:1 correspondence of mapping and some of their RzBinSections, but also want to add some unmapped sections. In this case, they can implement their mapped sections in their maps callback, then in their sections callback use this function to create sections from them and add some additional ones. See also rz_bin_maps_of_file_sections() for the inverse, when no additional sections should be added.
- static source_line_info_builder_build_and_fini() RzBinSourceLineInfo #
Calls function
rz_bin_source_line_info_builder_build_and_fini
(defined in dbginfo.c)
- static source_line_info_builder_fini() None #
Calls function
rz_bin_source_line_info_builder_fini
(defined in dbginfo.c)
- static source_line_info_builder_init() None #
Calls function
rz_bin_source_line_info_builder_init
(defined in dbginfo.c)
- static source_line_info_builder_push_sample(address: int, line: int, column: int, file: str) None #
Calls function
rz_bin_source_line_info_builder_push_sample
(defined in dbginfo.c)Push a new sample into the builder.
This function is used to continuously fill the builder with concrete samples of line info for a specific address, usually during parsing of debug info from a file. The samples may be pushed in any order and the builder will later take care of generating a valid RzBinSourceLineInfo from it.
- Parameters:
line – may be 0 or a positive line number, where 0 means that this entry closes the one before it. see also RzBinSourceLine.
- static source_line_info_free() None #
Calls function
rz_bin_source_line_info_free
(defined in dbginfo.c)
- static source_line_info_get_first_at(addr: int) RzBinSourceLineSample #
Calls function
rz_bin_source_line_info_get_first_at
(defined in dbginfo.c)Find the first sample that affects the given address. i.e. find the first sample with the highest address less or equal to addr. There may be more which can be retrieved by repeatedly calling rz_bin_source_line_info_get_next() until it returns NULL.
- static source_line_info_get_next(cur: RzBinSourceLineSample) RzBinSourceLineSample #
Calls function
rz_bin_source_line_info_get_next
(defined in dbginfo.c)- Parameters:
cur – MUST be a pointer returned by either rz_bin_source_line_info_get_first_at() or rz_bin_source_line_info_get_next().
- Returns:
The next sample at the same address as cur or NULL if there is none.
- static string_database_add(bstr: RzBinString) bool #
Calls function
rz_bin_string_database_add
(defined in bobj.c){ function_description }
- Parameters:
db – The database
bstr – The bstr
- Returns:
{ description_of_the_return_value }
- static string_database_free() None #
Calls function
rz_bin_string_database_free
(defined in bobj.c)Frees a RzBinStrDb structure.
- Parameters:
db – The string database to free
- static string_database_new() RzBinStrDb #
Calls function
rz_bin_string_database_new
(defined in bobj.c)Allocates and initializes the RzBinStrDb structure with the given list of strings.
- Parameters:
list – The list of strings to initialize the database with
- Returns:
On success returns a valid pointer, otherwise NULL
- static string_database_remove(address: int, is_va: bool) bool #
Calls function
rz_bin_string_database_remove
(defined in bobj.c)Return true if the given
address
has
been removed to the RzBinObject string database.
- static string_decode_base64() None #
Calls function
rz_bin_string_decode_base64
(defined in bobj.c)Tries to decode the base64 string hold by RzBinString and overwrites it.
- Parameters:
bstr – The RzBinString to decode
- static symbol_new(paddr: int, vaddr: int) RzBinSymbol #
Calls function
rz_bin_symbol_new
(defined in bin.c)
- static trycatch_new(from: int, to: int, handler: int, filter: int) RzBinTrycatch #
Calls function
rz_bin_trycatch_new
(defined in bin.c)
- static xtrdata_new(offset: int, size: int, file_count: int, metadata: RzBinXtrMetadata) RzBinXtrData #
Calls function
rz_bin_xtrdata_new
(defined in bin.c)
- addr2line(addr: int, file: str, len: int, line: int) bool #
Warning
Calls deprecated function
rz_bin_addr2line
Calls function
rz_bin_addr2line
(defined in dbginfo.c)
- addr2text(addr: int, origin: int) str #
Warning
Calls deprecated function
rz_bin_addr2text
Calls function
rz_bin_addr2text
(defined in dbginfo.c)
- create(plugin_name: str, code: int, codelen: int, data: int, datalen: int, opt: RzBinArchOptions) RzBuffer #
Calls function
rz_bin_create
(defined in bin.c)
- file_compute_hashes(bf: RzBinFile, limit: int) RzList[RzBinFileHash] #
Calls function
rz_bin_file_compute_hashes
(defined in bfile.c)Return a list of RzBinFileHash structures with the hashes md5, sha1, sha256, crc32 and entropy computed over the whole
bf
.
- file_find_by_arch_bits(arch: str, bits: int) RzBinFile #
Calls function
rz_bin_file_find_by_arch_bits
(defined in bfile.c)
- file_find_by_name(name: str) RzBinFile #
Calls function
rz_bin_file_find_by_name
(defined in bfile.c)
- file_object_new_from_xtr_data(bf: RzBinFile, opts: RzBinObjectLoadOptions, data: RzBinXtrData) bool #
Calls function
rz_bin_file_object_new_from_xtr_data
(defined in bfile.c)
- file_set_cur_binfile(bf: RzBinFile) bool #
Calls function
rz_bin_file_set_cur_binfile
(defined in bfile.c)
- file_set_cur_by_fd(bin_fd: int) bool #
Calls function
rz_bin_file_set_cur_by_fd
(defined in bfile.c)
- file_set_cur_by_id(bin_id: int) bool #
Calls function
rz_bin_file_set_cur_by_id
(defined in bfile.c)
- file_set_cur_by_name(name: str) bool #
Calls function
rz_bin_file_set_cur_by_name
(defined in bfile.c)
- file_set_hashes(new_hashes: RzList[RzBinFileHash]) RzList[RzBinFileHash] #
Calls function
rz_bin_file_set_hashes
(defined in bfile.c)Set
file_hashes
on current RzBinInfo.- Returns:
RzList of previous file_hashes
- get_binplugin_by_buffer(buf: RzBuffer) RzBinPlugin #
Calls function
rz_bin_get_binplugin_by_buffer
(defined in bin.c)
- get_classes() RzList[RzBinClass] #
Warning
Calls deprecated function
rz_bin_get_classes
Calls function
rz_bin_get_classes
(defined in bin.c)
- get_entries() RzList[RzBinAddr] #
Warning
Calls deprecated function
rz_bin_get_entries
Calls function
rz_bin_get_entries
(defined in bin.c)
- get_fields() RzList[RzBinField] #
Warning
Calls deprecated function
rz_bin_get_fields
Calls function
rz_bin_get_fields
(defined in bin.c)
- get_imports() RzList[RzBinImport] #
Warning
Calls deprecated function
rz_bin_get_imports
Calls function
rz_bin_get_imports
(defined in bin.c)
- get_info() RzBinInfo #
Warning
Calls deprecated function
rz_bin_get_info
Calls function
rz_bin_get_info
(defined in bin.c)
- get_libs() RzList[char] #
Warning
Calls deprecated function
rz_bin_get_libs
Calls function
rz_bin_get_libs
(defined in bin.c)
- get_mem() RzList[RzBinMem] #
Warning
Calls deprecated function
rz_bin_get_mem
Calls function
rz_bin_get_mem
(defined in bin.c)
- get_sections() RzList[RzBinSection] #
Warning
Calls deprecated function
rz_bin_get_sections
Calls function
rz_bin_get_sections
(defined in bin.c)
- get_strings() RzList[RzBinString] #
Warning
Calls deprecated function
rz_bin_get_strings
Calls function
rz_bin_get_strings
(defined in bin.c)
- get_symbols() RzList[RzBinSymbol] #
Warning
Calls deprecated function
rz_bin_get_symbols
Calls function
rz_bin_get_symbols
(defined in bin.c)
- is_static() int #
Warning
Calls deprecated function
rz_bin_is_static
Calls function
rz_bin_is_static
(defined in bin.c)
- list_plugin(name: str, pj: PJ, json: int) bool #
Calls function
rz_bin_list_plugin
(defined in bin.c)
- object_reset_strings(bf: RzBinFile, obj: RzBinObject) bool #
Calls function
rz_bin_object_reset_strings
(defined in bobj.c)Remove all previously identified strings in the binary object and scan it again for strings.
- open(file: str, opt: RzBinOptions) RzBinFile #
Calls function
rz_bin_open
(defined in bin.c)
- open_buf(buf: RzBuffer, opt: RzBinOptions) RzBinFile #
Calls function
rz_bin_open_buf
(defined in bin.c)
- open_io(opt: RzBinOptions) RzBinFile #
Calls function
rz_bin_open_io
(defined in bin.c)
- plugin_add(foo: RzBinPlugin) bool #
Calls function
rz_bin_plugin_add
(defined in bin.c)
- plugin_get(name: str) RzBinPlugin #
Calls function
rz_bin_plugin_get
(defined in bin.c)Get a RzBinPlugin by name.
- section_flag_to_list(flag: int) RzList[char] #
Calls function
rz_bin_section_flag_to_list
(defined in bin.c)Converts the RzBinSection flags to a list of string representations.
Some binary formats have a function interface called “section_flag_to_rzlist” The returned string flag names are different between formats
- Parameters:
bin – RzBin instance
flag – A flag field of the RzBinSection (differs between formats)
- section_type_to_string(type: int) str #
Calls function
rz_bin_section_type_to_string
(defined in bin.c)Converts the RzBinSection type to the string representation.
Some binary formats have a function interface called “section_type_to_string” The returned string type name is different between formats
- Parameters:
bin – RzBin instance
type – A type field of the RzBinSection (differs between formats)
- string_filter(str: str, len: int, addr: int) bool #
Calls function
rz_bin_string_filter
(defined in filter.c)Filter the given string, respecting bin->strpurge, bin->strfilter, and if len >= 0, also bin->minstrlen and bin->maxstrlen.
- xtr_add(foo: RzBinXtrPlugin) bool #
Calls function
rz_bin_xtr_add
(defined in bin.c)
- xtrplugin_get(name: str) RzBinXtrPlugin #
Calls function
rz_bin_xtrplugin_get
(defined in bin.c)Get a RzBinXtrPlugin by name.