Trait BinaryViewExt
pub trait BinaryViewExt: BinaryViewBase {
Show 180 methods
// Provided methods
fn file(&self) -> Ref<FileMetadata> { ... }
fn parent_view(&self) -> Option<Ref<BinaryView>> { ... }
fn raw_view(&self) -> Option<Ref<BinaryView>> { ... }
fn view_type(&self) -> String { ... }
fn read_vec(&self, offset: u64, len: usize) -> Vec<u8> ⓘ { ... }
fn read_into_vec(
&self,
dest: &mut Vec<u8>,
offset: u64,
len: usize,
) -> usize { ... }
fn search<C: FnMut(u64, &DataBuffer) -> bool>(
&self,
query: &SearchQuery,
on_match: C,
) -> bool { ... }
fn search_with_progress<P: ProgressCallback, C: FnMut(u64, &DataBuffer) -> bool>(
&self,
query: &SearchQuery,
on_match: C,
progress: P,
) -> bool { ... }
fn find_next_data(
&self,
start: u64,
end: u64,
data: &DataBuffer,
) -> Option<u64> { ... }
fn find_next_data_with_opts<P: ProgressCallback>(
&self,
start: u64,
end: u64,
data: &DataBuffer,
flag: FindFlag,
progress: P,
) -> Option<u64> { ... }
fn find_next_constant(
&self,
start: u64,
end: u64,
constant: u64,
view_type: FunctionViewType,
) -> Option<u64> { ... }
fn find_next_constant_with_opts<P: ProgressCallback>(
&self,
start: u64,
end: u64,
constant: u64,
disasm_settings: &DisassemblySettings,
view_type: FunctionViewType,
progress: P,
) -> Option<u64> { ... }
fn find_next_text(
&self,
start: u64,
end: u64,
text: &str,
view_type: FunctionViewType,
) -> Option<u64> { ... }
fn find_next_text_with_opts<P: ProgressCallback>(
&self,
start: u64,
end: u64,
text: &str,
disasm_settings: &DisassemblySettings,
flag: FindFlag,
view_type: FunctionViewType,
progress: P,
) -> Option<u64> { ... }
fn notify_data_written(&self, offset: u64, len: usize) { ... }
fn notify_data_inserted(&self, offset: u64, len: usize) { ... }
fn notify_data_removed(&self, offset: u64, len: usize) { ... }
fn offset_has_code_semantics(&self, offset: u64) -> bool { ... }
fn offset_has_extern_semantics(&self, offset: u64) -> bool { ... }
fn offset_has_writable_semantics(&self, offset: u64) -> bool { ... }
fn offset_has_read_only_semantics(&self, offset: u64) -> bool { ... }
fn image_base(&self) -> u64 { ... }
fn original_image_base(&self) -> u64 { ... }
fn set_original_image_base(&self, image_base: u64) { ... }
fn end(&self) -> u64 { ... }
fn add_analysis_option(&self, name: &str) { ... }
fn has_initial_analysis(&self) -> bool { ... }
fn set_analysis_hold(&self, enable: bool) { ... }
fn update_analysis(&self) { ... }
fn update_analysis_and_wait(&self) { ... }
fn reanalyze(&self) { ... }
fn abort_analysis(&self) { ... }
fn analysis_is_aborted(&self) -> bool { ... }
fn workflow(&self) -> Ref<Workflow> { ... }
fn analysis_info(&self) -> Result<AnalysisInfo> { ... }
fn analysis_progress(&self) -> AnalysisProgress { ... }
fn default_arch(&self) -> Option<CoreArchitecture> { ... }
fn set_default_arch<A: Architecture>(&self, arch: &A) { ... }
fn default_platform(&self) -> Option<Ref<Platform>> { ... }
fn set_default_platform(&self, plat: &Platform) { ... }
fn base_address_detection(&self) -> Option<BaseAddressDetection> { ... }
fn instruction_len<A: Architecture>(
&self,
arch: &A,
addr: u64,
) -> Option<usize> { ... }
fn symbol_by_address(&self, addr: u64) -> Option<Ref<Symbol>> { ... }
fn symbol_by_raw_name(&self, raw_name: impl IntoCStr) -> Option<Ref<Symbol>> { ... }
fn symbols(&self) -> Array<Symbol> { ... }
fn symbols_by_name(&self, name: impl IntoCStr) -> Array<Symbol> { ... }
fn symbols_in_range(&self, range: Range<u64>) -> Array<Symbol> { ... }
fn symbols_of_type(&self, ty: SymbolType) -> Array<Symbol> { ... }
fn symbols_of_type_in_range(
&self,
ty: SymbolType,
range: Range<u64>,
) -> Array<Symbol> { ... }
fn define_auto_symbol(&self, sym: &Symbol) { ... }
fn define_auto_symbol_with_type<'a, T: Into<Option<&'a Type>>>(
&self,
sym: &Symbol,
plat: &Platform,
ty: T,
) -> Result<Ref<Symbol>> { ... }
fn undefine_auto_symbol(&self, sym: &Symbol) { ... }
fn define_user_symbol(&self, sym: &Symbol) { ... }
fn undefine_user_symbol(&self, sym: &Symbol) { ... }
fn data_variables(&self) -> Array<DataVariable> { ... }
fn data_variable_at_address(&self, addr: u64) -> Option<DataVariable> { ... }
fn define_auto_data_var<'a, T: Into<Conf<&'a Type>>>(
&self,
addr: u64,
ty: T,
) { ... }
fn define_user_data_var<'a, T: Into<Conf<&'a Type>>>(
&self,
addr: u64,
ty: T,
) { ... }
fn undefine_auto_data_var(&self, addr: u64, blacklist: Option<bool>) { ... }
fn undefine_user_data_var(&self, addr: u64) { ... }
fn define_auto_type<T: Into<QualifiedName>>(
&self,
name: T,
source: &str,
type_obj: &Type,
) -> QualifiedName { ... }
fn define_auto_type_with_id<T: Into<QualifiedName>>(
&self,
name: T,
id: &str,
type_obj: &Type,
) -> QualifiedName { ... }
fn define_user_type<T: Into<QualifiedName>>(&self, name: T, type_obj: &Type) { ... }
fn define_auto_types<T, I>(
&self,
names_sources_and_types: T,
) -> HashMap<String, QualifiedName>
where T: Iterator<Item = I>,
I: Into<QualifiedNameTypeAndId> { ... }
fn define_auto_types_with_progress<T, I, P>(
&self,
names_sources_and_types: T,
progress: P,
) -> HashMap<String, QualifiedName>
where T: Iterator<Item = I>,
I: Into<QualifiedNameTypeAndId>,
P: ProgressCallback { ... }
fn define_user_types<T, I>(&self, names_and_types: T)
where T: Iterator<Item = I>,
I: Into<QualifiedNameAndType> { ... }
fn define_user_types_with_progress<T, I, P>(
&self,
names_and_types: T,
progress: P,
)
where T: Iterator<Item = I>,
I: Into<QualifiedNameAndType>,
P: ProgressCallback { ... }
fn undefine_auto_type(&self, id: &str) { ... }
fn undefine_user_type<T: Into<QualifiedName>>(&self, name: T) { ... }
fn types(&self) -> Array<QualifiedNameAndType> { ... }
fn dependency_sorted_types(&self) -> Array<QualifiedNameAndType> { ... }
fn type_by_name<T: Into<QualifiedName>>(&self, name: T) -> Option<Ref<Type>> { ... }
fn type_by_ref(&self, ref_: &NamedTypeReference) -> Option<Ref<Type>> { ... }
fn type_by_id(&self, id: &str) -> Option<Ref<Type>> { ... }
fn type_name_by_id(&self, id: &str) -> Option<QualifiedName> { ... }
fn type_id_by_name<T: Into<QualifiedName>>(&self, name: T) -> Option<String> { ... }
fn is_type_auto_defined<T: Into<QualifiedName>>(&self, name: T) -> bool { ... }
fn segments(&self) -> Array<Segment> { ... }
fn segment_at(&self, addr: u64) -> Option<Ref<Segment>> { ... }
fn add_segment(&self, segment: SegmentBuilder) { ... }
fn begin_bulk_add_segments(&self) { ... }
fn end_bulk_add_segments(&self) { ... }
fn cancel_bulk_add_segments(&self) { ... }
fn add_section(&self, section: SectionBuilder) { ... }
fn remove_auto_section(&self, name: impl IntoCStr) { ... }
fn remove_user_section(&self, name: impl IntoCStr) { ... }
fn section_by_name(&self, name: impl IntoCStr) -> Option<Ref<Section>> { ... }
fn sections(&self) -> Array<Section> { ... }
fn sections_at(&self, addr: u64) -> Array<Section> { ... }
fn memory_map(&self) -> MemoryMap { ... }
fn add_auto_function(&self, address: u64) -> Option<Ref<Function>> { ... }
fn add_auto_function_with_platform(
&self,
address: u64,
platform: &Platform,
) -> Option<Ref<Function>> { ... }
fn add_auto_function_ext(
&self,
address: u64,
platform: &Platform,
func_type: Option<&Type>,
) -> Option<Ref<Function>> { ... }
fn remove_auto_function(&self, func: &Function, update_refs: bool) { ... }
fn add_user_function(&self, addr: u64) -> Option<Ref<Function>> { ... }
fn add_user_function_with_platform(
&self,
addr: u64,
platform: &Platform,
) -> Option<Ref<Function>> { ... }
fn remove_user_function(&self, func: &Function) { ... }
fn has_functions(&self) -> bool { ... }
fn add_entry_point(&self, addr: u64) { ... }
fn add_entry_point_with_platform(&self, addr: u64, platform: &Platform) { ... }
fn entry_point_function(&self) -> Option<Ref<Function>> { ... }
fn entry_point_functions(&self) -> Array<Function> { ... }
fn functions(&self) -> Array<Function> { ... }
fn functions_at(&self, addr: u64) -> Array<Function> { ... }
fn functions_containing(&self, addr: u64) -> Array<Function> { ... }
fn functions_by_name(
&self,
name: impl IntoCStr,
plat: Option<&Platform>,
) -> Vec<Ref<Function>> { ... }
fn function_at(
&self,
platform: &Platform,
addr: u64,
) -> Option<Ref<Function>> { ... }
fn function_start_before(&self, addr: u64) -> u64 { ... }
fn function_start_after(&self, addr: u64) -> u64 { ... }
fn basic_blocks_containing(
&self,
addr: u64,
) -> Array<BasicBlock<NativeBlock>> { ... }
fn basic_blocks_starting_at(
&self,
addr: u64,
) -> Array<BasicBlock<NativeBlock>> { ... }
fn is_new_auto_function_analysis_suppressed(&self) -> bool { ... }
fn set_new_auto_function_analysis_suppressed(&self, suppress: bool) { ... }
fn should_skip_target_analysis(
&self,
source: &ArchAndAddr,
srcfunc: &Function,
srcend: u64,
target: &ArchAndAddr,
) -> bool { ... }
fn read_buffer(&self, offset: u64, len: usize) -> Result<DataBuffer> { ... }
fn debug_info(&self) -> Ref<DebugInfo> { ... }
fn set_debug_info(&self, debug_info: &DebugInfo) { ... }
fn apply_debug_info(&self, debug_info: &DebugInfo) { ... }
fn show_plaintext_report(&self, title: &str, plaintext: &str) { ... }
fn show_markdown_report(&self, title: &str, contents: &str, plaintext: &str) { ... }
fn show_html_report(&self, title: &str, contents: &str, plaintext: &str) { ... }
fn show_graph_report(&self, raw_name: &str, graph: &FlowGraph) { ... }
fn load_settings(&self, view_type_name: &str) -> Result<Ref<Settings>> { ... }
fn set_load_settings(&self, view_type_name: &str, settings: &Settings) { ... }
fn create_tag_type(&self, name: &str, icon: &str) -> Ref<TagType> { ... }
fn remove_tag_type(&self, tag_type: &TagType) { ... }
fn tag_type_by_name(&self, name: &str) -> Option<Ref<TagType>> { ... }
fn tag_by_id(&self, id: &str) -> Option<Ref<Tag>> { ... }
fn add_tag(&self, addr: u64, t: &TagType, data: &str, user: bool) { ... }
fn remove_auto_data_tag(&self, addr: u64, tag: &Tag) { ... }
fn remove_user_data_tag(&self, addr: u64, tag: &Tag) { ... }
fn comment_at(&self, addr: u64) -> Option<String> { ... }
fn set_comment_at(&self, addr: u64, comment: &str) { ... }
fn get_next_linear_disassembly_lines(
&self,
pos: &mut LinearViewCursor,
) -> Array<LinearDisassemblyLine> { ... }
fn get_previous_linear_disassembly_lines(
&self,
pos: &mut LinearViewCursor,
) -> Array<LinearDisassemblyLine> { ... }
fn query_metadata(&self, key: &str) -> Option<Ref<Metadata>> { ... }
fn get_metadata<T>(&self, key: &str) -> Option<Result<T>>
where T: for<'a> TryFrom<&'a Metadata> { ... }
fn store_metadata<V>(&self, key: &str, value: V, is_auto: bool)
where V: Into<Ref<Metadata>> { ... }
fn remove_metadata(&self, key: &str) { ... }
fn code_refs_to_addr(&self, addr: u64) -> Array<CodeReference> { ... }
fn code_refs_into_range(&self, range: Range<u64>) -> Array<CodeReference> { ... }
fn code_refs_from_addr(
&self,
addr: u64,
func: Option<&Function>,
) -> Vec<u64> { ... }
fn data_refs_to_addr(&self, addr: u64) -> Array<DataReference> { ... }
fn data_refs_into_range(&self, range: Range<u64>) -> Array<DataReference> { ... }
fn data_refs_from_addr(&self, addr: u64) -> Array<DataReference> { ... }
fn code_refs_using_type_name<T: Into<QualifiedName>>(
&self,
name: T,
) -> Array<CodeReference> { ... }
fn data_refs_using_type_name<T: Into<QualifiedName>>(
&self,
name: T,
) -> Array<DataReference> { ... }
fn relocations_at(&self, addr: u64) -> Array<Relocation> { ... }
fn relocation_ranges(&self) -> Vec<Range<u64>> { ... }
fn component_by_guid(&self, guid: &str) -> Option<Ref<Component>> { ... }
fn root_component(&self) -> Option<Ref<Component>> { ... }
fn component_by_path(&self, path: &str) -> Option<Ref<Component>> { ... }
fn remove_component(&self, component: &Component) -> bool { ... }
fn remove_component_by_guid(&self, guid: &str) -> bool { ... }
fn data_variable_parent_components(
&self,
data_variable: &DataVariable,
) -> Array<Component> { ... }
fn external_libraries(&self) -> Array<ExternalLibrary> { ... }
fn external_library(&self, name: &str) -> Option<Ref<ExternalLibrary>> { ... }
fn remove_external_library(&self, name: &str) { ... }
fn add_external_library(
&self,
name: &str,
backing_file: Option<&ProjectFile>,
auto: bool,
) -> Option<Ref<ExternalLibrary>> { ... }
fn external_locations(&self) -> Array<ExternalLocation> { ... }
fn external_location_from_symbol(
&self,
symbol: &Symbol,
) -> Option<Ref<ExternalLocation>> { ... }
fn remove_external_location(&self, location: &ExternalLocation) { ... }
fn remove_external_location_from_symbol(&self, symbol: &Symbol) { ... }
fn add_external_location(
&self,
symbol: &Symbol,
library: &ExternalLibrary,
target_symbol_name: &str,
target_address: Option<u64>,
target_is_auto: bool,
) -> Option<Ref<ExternalLocation>> { ... }
fn type_container(&self) -> TypeContainer { ... }
fn user_type_container(&self) -> TypeContainer { ... }
fn auto_type_container(&self) -> TypeContainer { ... }
fn add_type_library(&self, library: &TypeLibrary) { ... }
fn type_library_by_name(&self, name: &str) -> Option<Ref<TypeLibrary>> { ... }
fn record_imported_object_library<T: Into<QualifiedName>>(
&self,
lib: &TypeLibrary,
name: T,
addr: u64,
platform: &Platform,
) { ... }
fn import_type_library<T: Into<QualifiedName>>(
&self,
name: T,
lib: Option<TypeLibrary>,
) -> Option<Ref<Type>> { ... }
fn import_type_object<T: Into<QualifiedName>>(
&self,
name: T,
lib: Option<TypeLibrary>,
) -> Option<Ref<Type>> { ... }
fn import_type_by_guid(&self, guid: &str) -> Option<Ref<Type>> { ... }
fn export_type_to_library<T: Into<QualifiedName>>(
&self,
lib: &TypeLibrary,
name: T,
type_obj: &Type,
) { ... }
fn export_object_to_library<T: Into<QualifiedName>>(
&self,
lib: &TypeLibrary,
name: T,
type_obj: &Type,
) { ... }
fn lookup_imported_object_library(
&self,
addr: u64,
platform: &Platform,
) -> Option<(Ref<TypeLibrary>, QualifiedName)> { ... }
fn lookup_imported_type_library<T: Into<QualifiedName>>(
&self,
name: T,
) -> Option<(Ref<TypeLibrary>, QualifiedName)> { ... }
fn strings(&self) -> Array<StringReference> { ... }
fn string_at(&self, addr: u64) -> Option<BNStringReference> { ... }
fn strings_in_range(&self, range: Range<u64>) -> Array<StringReference> { ... }
}Source
Reads up to len bytes from address offset
Source
Appends up to len bytes from address offset into dest
Source
Search the view using the query options.
In the on_match callback return false to stop searching.
Source
Search the view using the query options.
In the on_match callback return false to stop searching.
Source
§Warning
This function is likely to be changed to take in a “query” structure. Or deprecated entirely.
Source
Add an auto function at the given address with the platform.
Use BinaryViewExt::add_auto_function_ext if you wish to specify a function type.
NOTE: If the view’s default platform is not set, this will set it to platform.
Source
Add an auto function at the given address with the platform and function type.
NOTE: If the view’s default platform is not set, this will set it to platform.
Source
Add an auto function at the given address with the platform.
NOTE: If the view’s default platform is not set, this will set it to platform.
Source
Removes the function from the view and blacklists it from being created automatically.
NOTE: If you call BinaryViewExt::add_user_function, it will override the blacklist.
Source
Add an entry point at the given address with the view’s default platform.
NOTE: The default platform must be set for this view!
Source
Add an entry point at the given address with the platform.
NOTE: If the view’s default platform is not set, this will set it to platform.
Source
List of functions starting at addr
Source
List of functions with the given name.
There is one special case where if you pass a string of the form sub_[0-9a-f]+ then it will lookup all
functions defined at the address matched by the regular expression if that symbol is not defined in the
database.
§Params
name: Name that the function should haveplat: Optional platform that the function should be defined for. Defaults to all platforms ifNonepassed.
Source
Get a tag type by its name.
Source
Get a tag by its id.
Note this does not tell you anything about where it is used.
Source
Creates and adds a tag to an address
User tag creations will be added to the undo buffer
Source
removes a Tag object at a data address.
Source
removes a Tag object at a data address. Since this removes a user tag, it will be added to the current undo buffer.
Sets a comment for the BinaryView at the address specified.
NOTE: This is different from setting a comment at the function-level. To set a comment in a
function use Function::set_comment_at
Source
Retrieves a list of the next disassembly lines.
Retrieves an Array over LinearDisassemblyLine objects for the
next disassembly lines, and updates the LinearViewCursor passed in. This function can be called
repeatedly to get more lines of linear disassembly.
§Arguments
pos- Position to retrieve linear disassembly lines from
Source
Retrieves a list of the previous disassembly lines.
get_previous_linear_disassembly_lines retrieves an Array over LinearDisassemblyLine objects for the
previous disassembly lines, and updates the LinearViewCursor passed in. This function can be called
repeatedly to get more lines of linear disassembly.
§Arguments
pos- Position to retrieve linear disassembly lines relative to
Source
Retrieves a list of CodeReferences pointing to a given address.
Source
Retrieves a list of addresses pointed to by a given address.
Source
Retrieves a list of DataReferences pointing to a given address.
Source
Retrieves a list of DataReferences originating from a given address.
Source
Retrieves a list of CodeReferences for locations in code that use a given named type.
Source
Retrieves a list of DataReferences for locations in data that use a given named type.
Source
Type container for all types (user and auto) in the Binary View.
NOTE: Modifying an auto type will promote it to a user type.
Source
Type container for user types in the Binary View.
Source
Type container for auto types in the Binary View.
NOTE: Unlike Self::type_container modification of auto types will NOT promote it to a user type.
Source
Make the contents of a type library available for type/import resolution
Source
Should be called by custom py:py:class:BinaryView implementations
when they have successfully imported an object from a type library (eg a symbol’s type).
Values recorded with this function will then be queryable via BinaryViewExt::lookup_imported_object_library.
lib- Type Library containing the imported typename- Name of the object in the type libraryaddr- address of symbol at import siteplatform- Platform of symbol at import site
Source
Recursively imports a type from the specified type library, or, if no library was explicitly provided, the first type library associated with the current BinaryView that provides the name requested.
This may have the impact of loading other type libraries as dependencies on other type libraries are lazily resolved when references to types provided by them are first encountered.
Note that the name actually inserted into the view may not match the name as it exists in the type library in
the event of a name conflict. To aid in this, the Type object returned is a NamedTypeReference to
the deconflicted name used.
Source
Recursively imports an object from the specified type library, or, if no library was explicitly provided, the first type library associated with the current BinaryView that provides the name requested.
This may have the impact of loading other type libraries as dependencies on other type libraries are lazily resolved when references to types provided by them are first encountered.
.. note:: If you are implementing a custom BinaryView and use this method to import object types, you should then call BinaryViewExt::record_imported_object_library with the details of where the object is located.
Source
Recursively imports a type interface given its GUID.
Source
Recursively exports type_obj into lib as a type with name name
As other referenced types are encountered, they are either copied into the destination type library or else the type library that provided the referenced type is added as a dependency for the destination library.
Source
Recursively exports type_obj into lib as a type with name name
As other referenced types are encountered, they are either copied into the destination type library or else the type library that provided the referenced type is added as a dependency for the destination library.
Source
Gives you details of which type library and name was used to determine the type of a symbol at a given address
addr- address of symbol at import siteplatform- Platform of symbol at import site
Source
Gives you details of from which type library and name a given type in the analysis was imported.
name- Name of type in analysis
Source
Retrieve all known strings in the binary.
NOTE: This returns a list of StringReference as strings may not be representable
as a String or even a BnString. It is the caller’s responsibility to read the underlying
data and convert it to a representable form.
Source
Retrieve all known strings within the provided range.
NOTE: This returns a list of StringReference as strings may not be representable
as a String or even a BnString. It is the caller’s responsibility to read the underlying
data and convert it to a representable form.
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.