pub struct BinaryView { /* private fields */ }
Implementations§
source§impl BinaryView
impl BinaryView
pub fn from_path( meta: &mut FileMetadata, file_path: impl AsRef<Path>, ) -> Result<Ref<Self>>
pub fn from_accessor( meta: &FileMetadata, file: &mut FileAccessor<'_>, ) -> Result<Ref<Self>>
pub fn from_data(meta: &FileMetadata, data: &[u8]) -> Result<Ref<Self>>
sourcepub fn save_to_path(&self, file_path: impl AsRef<Path>) -> bool
pub fn save_to_path(&self, file_path: impl AsRef<Path>) -> bool
Save the original binary file to the provided file_path
along with any modifications.
WARNING: Currently there is a possibility to deadlock if the analysis has queued up a main thread action
that tries to take the FileMetadata
lock of the current view, and is executed while we
are executing in this function.
To avoid the above issue use crate::main_thread::execute_on_main_thread_and_wait
to verify there
are no queued up main thread actions.
sourcepub fn save_to_accessor(&self, file: &mut FileAccessor<'_>) -> bool
pub fn save_to_accessor(&self, file: &mut FileAccessor<'_>) -> bool
Save the original binary file to the provided FileAccessor
along with any modifications.
WARNING: Currently there is a possibility to deadlock if the analysis has queued up a main thread action
that tries to take the FileMetadata
lock of the current view, and is executed while we
are executing in this function.
To avoid the above issue use crate::main_thread::execute_on_main_thread_and_wait
to verify there
are no queued up main thread actions.
Trait Implementations§
source§impl AsRef<BinaryView> for BinaryView
impl AsRef<BinaryView> for BinaryView
source§impl BinaryViewBase for BinaryView
impl BinaryViewBase for BinaryView
fn read(&self, buf: &mut [u8], offset: u64) -> usize
fn write(&self, offset: u64, data: &[u8]) -> usize
fn insert(&self, offset: u64, data: &[u8]) -> usize
fn remove(&self, offset: u64, len: usize) -> usize
fn offset_valid(&self, offset: u64) -> bool
fn offset_readable(&self, offset: u64) -> bool
fn offset_writable(&self, offset: u64) -> bool
fn offset_executable(&self, offset: u64) -> bool
fn offset_backed_by_file(&self, offset: u64) -> bool
fn next_valid_offset_after(&self, offset: u64) -> u64
fn modification_status(&self, offset: u64) -> ModificationStatus
fn start(&self) -> u64
fn len(&self) -> u64
fn executable(&self) -> bool
fn relocatable(&self) -> bool
fn entry_point(&self) -> u64
fn default_endianness(&self) -> Endianness
fn address_size(&self) -> usize
fn save(&self) -> bool
source§impl Debug for BinaryView
impl Debug for BinaryView
source§impl Hash for BinaryView
impl Hash for BinaryView
source§impl PartialEq for BinaryView
impl PartialEq for BinaryView
source§impl ToOwned for BinaryView
impl ToOwned for BinaryView
source§type Owned = Ref<BinaryView>
type Owned = Ref<BinaryView>
source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
1.63.0 · source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
impl Eq for BinaryView
impl Send for BinaryView
impl StructuralPartialEq for BinaryView
impl Sync for BinaryView
Auto Trait Implementations§
impl Freeze for BinaryView
impl RefUnwindSafe for BinaryView
impl Unpin for BinaryView
impl UnwindSafe for BinaryView
Blanket Implementations§
source§impl<T> BinaryViewExt for Twhere
T: BinaryViewBase,
impl<T> BinaryViewExt for Twhere
T: BinaryViewBase,
fn file(&self) -> Ref<FileMetadata>
fn type_name(&self) -> BnString
fn parent_view(&self) -> Option<Ref<BinaryView>>
fn raw_view(&self) -> Option<Ref<BinaryView>>
fn view_type(&self) -> BnString
source§fn read_vec(&self, offset: u64, len: usize) -> Vec<u8>
fn read_vec(&self, offset: u64, len: usize) -> Vec<u8>
len
bytes from address offset
source§fn read_into_vec(&self, dest: &mut Vec<u8>, offset: u64, len: usize) -> usize
fn read_into_vec(&self, dest: &mut Vec<u8>, offset: u64, len: usize) -> usize
len
bytes from address offset
into dest
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_writable_semantics(&self, offset: u64) -> bool
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: impl BnStrCompatible)
fn has_initial_analysis(&self) -> bool
fn set_analysis_hold(&self, enable: bool)
fn update_analysis(&self)
fn update_analysis_and_wait(&self)
fn abort_analysis(&self)
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<S: BnStrCompatible>( &self, raw_name: S, ) -> Option<Ref<Symbol>>
fn symbols(&self) -> Array<Symbol>
fn symbols_by_name<S: BnStrCompatible>(&self, name: S) -> 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)
source§fn define_user_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)
Self::define_user_symbol
to bind this data variable with a namefn 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>, S: BnStrCompatible>( &self, name: T, source: S, type_obj: &Type, ) -> QualifiedName
fn define_auto_type_with_id<T: Into<QualifiedName>, S: BnStrCompatible>( &self, name: T, id: S, 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>
fn define_auto_types_with_progress<T, I, P>( &self, names_sources_and_types: T, progress: P, ) -> HashMap<String, QualifiedName>
fn define_user_types<T, I>(&self, names_and_types: T)
fn define_user_types_with_progress<T, I, P>( &self, names_and_types: T, progress: P, )
fn undefine_auto_type<S: BnStrCompatible>(&self, id: S)
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<S: BnStrCompatible>(&self, id: S) -> Option<Ref<Type>>
fn type_name_by_id<S: BnStrCompatible>(&self, id: S) -> Option<QualifiedName>
fn type_id_by_name<T: Into<QualifiedName>>(&self, name: T) -> Option<BnString>
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>>
source§fn add_segment(&self, segment: SegmentBuilder)
fn add_segment(&self, segment: SegmentBuilder)
source§fn begin_bulk_add_segments(&self)
fn begin_bulk_add_segments(&self)
source§fn end_bulk_add_segments(&self)
fn end_bulk_add_segments(&self)
source§fn cancel_bulk_add_segments(&self)
fn cancel_bulk_add_segments(&self)
fn add_section(&self, section: SectionBuilder)
fn remove_auto_section<S: BnStrCompatible>(&self, name: S)
fn remove_user_section<S: BnStrCompatible>(&self, name: S)
fn section_by_name<S: BnStrCompatible>(&self, name: S) -> 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, plat: &Platform, addr: u64) -> Option<Ref<Function>>
fn add_function_with_type( &self, plat: &Platform, addr: u64, auto_discovered: bool, func_type: Option<&Type>, ) -> Option<Ref<Function>>
fn add_entry_point(&self, plat: &Platform, addr: u64)
fn create_user_function( &self, plat: &Platform, addr: u64, ) -> Result<Ref<Function>>
fn has_functions(&self) -> bool
fn entry_point_function(&self) -> Option<Ref<Function>>
fn entry_point_functions(&self) -> Array<Function>
fn functions(&self) -> Array<Function>
fn functions_containing(&self, addr: u64) -> Array<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 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_graph_report<S: BnStrCompatible>(&self, raw_name: S, graph: &FlowGraph)
fn load_settings<S: BnStrCompatible>( &self, view_type_name: S, ) -> Result<Ref<Settings>>
fn set_load_settings<S: BnStrCompatible>( &self, view_type_name: S, settings: &Settings, )
source§fn create_tag_type<N: BnStrCompatible, I: BnStrCompatible>(
&self,
name: N,
icon: I,
) -> Ref<TagType>
fn create_tag_type<N: BnStrCompatible, I: BnStrCompatible>( &self, name: N, icon: I, ) -> Ref<TagType>
source§fn remove_tag_type(&self, tag_type: &TagType)
fn remove_tag_type(&self, tag_type: &TagType)
source§fn tag_type_by_name<S: BnStrCompatible>(&self, name: S) -> Option<Ref<TagType>>
fn tag_type_by_name<S: BnStrCompatible>(&self, name: S) -> Option<Ref<TagType>>
source§fn tag_by_id<S: BnStrCompatible>(&self, id: S) -> Option<Ref<Tag>>
fn tag_by_id<S: BnStrCompatible>(&self, id: S) -> Option<Ref<Tag>>
source§fn add_tag<S: BnStrCompatible>(
&self,
addr: u64,
t: &TagType,
data: S,
user: bool,
)
fn add_tag<S: BnStrCompatible>( &self, addr: u64, t: &TagType, data: S, user: bool, )
source§fn remove_auto_data_tag(&self, addr: u64, tag: &Tag)
fn remove_auto_data_tag(&self, addr: u64, tag: &Tag)
source§fn remove_user_data_tag(&self, addr: u64, tag: &Tag)
fn remove_user_data_tag(&self, addr: u64, tag: &Tag)
fn comment_at(&self, addr: u64) -> Option<BnString>
source§fn set_comment_at(&self, addr: u64, comment: impl BnStrCompatible)
fn set_comment_at(&self, addr: u64, comment: impl BnStrCompatible)
BinaryView
at the address specified. Read moresource§fn get_next_linear_disassembly_lines(
&self,
pos: &mut LinearViewCursor,
) -> Array<LinearDisassemblyLine>
fn get_next_linear_disassembly_lines( &self, pos: &mut LinearViewCursor, ) -> Array<LinearDisassemblyLine>
source§fn get_previous_linear_disassembly_lines(
&self,
pos: &mut LinearViewCursor,
) -> Array<LinearDisassemblyLine>
fn get_previous_linear_disassembly_lines( &self, pos: &mut LinearViewCursor, ) -> Array<LinearDisassemblyLine>
fn query_metadata<S: BnStrCompatible>(&self, key: S) -> Option<Ref<Metadata>>
fn get_metadata<T, S: BnStrCompatible>(&self, key: S) -> Option<Result<T>>
fn store_metadata<V, S: BnStrCompatible>(&self, key: S, value: V, is_auto: bool)
fn remove_metadata<S: BnStrCompatible>(&self, key: S)
source§fn code_refs_to_addr(&self, addr: u64) -> Array<CodeReference>
fn code_refs_to_addr(&self, addr: u64) -> Array<CodeReference>
source§fn code_refs_into_range(&self, range: Range<u64>) -> Array<CodeReference>
fn code_refs_into_range(&self, range: Range<u64>) -> Array<CodeReference>
source§fn code_refs_from_addr(&self, addr: u64, func: Option<&Function>) -> Vec<u64>
fn code_refs_from_addr(&self, addr: u64, func: Option<&Function>) -> Vec<u64>
source§fn data_refs_to_addr(&self, addr: u64) -> Array<DataReference>
fn data_refs_to_addr(&self, addr: u64) -> Array<DataReference>
source§fn data_refs_into_range(&self, range: Range<u64>) -> Array<DataReference>
fn data_refs_into_range(&self, range: Range<u64>) -> Array<DataReference>
source§fn data_refs_from_addr(&self, addr: u64) -> Array<DataReference>
fn data_refs_from_addr(&self, addr: u64) -> Array<DataReference>
source§fn code_refs_using_type_name<T: Into<QualifiedName>>(
&self,
name: T,
) -> Array<CodeReference>
fn code_refs_using_type_name<T: Into<QualifiedName>>( &self, name: T, ) -> Array<CodeReference>
source§fn data_refs_using_type_name<T: Into<QualifiedName>>(
&self,
name: T,
) -> Array<DataReference>
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<S: BnStrCompatible>( &self, guid: S, ) -> Option<Ref<Component>>
fn root_component(&self) -> Option<Ref<Component>>
fn component_by_path<P: BnStrCompatible>( &self, path: P, ) -> Option<Ref<Component>>
fn remove_component(&self, component: &Component) -> bool
fn remove_component_by_guid<P: IntoComponentGuid>(&self, guid: P) -> bool
fn data_variable_parent_components( &self, data_variable: &DataVariable, ) -> Array<Component>
fn external_libraries(&self) -> Array<ExternalLibrary>
fn external_library<S: BnStrCompatible>( &self, name: S, ) -> Option<Ref<ExternalLibrary>>
fn remove_external_library<S: BnStrCompatible>(&self, name: S)
fn add_external_library<S: BnStrCompatible>( &self, name: S, 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<S: BnStrCompatible>( &self, symbol: &Symbol, library: &ExternalLibrary, target_symbol_name: S, target_address: Option<u64>, target_is_auto: bool, ) -> Option<Ref<ExternalLocation>>
source§fn type_container(&self) -> TypeContainer
fn type_container(&self) -> TypeContainer
source§fn user_type_container(&self) -> TypeContainer
fn user_type_container(&self) -> TypeContainer
source§fn auto_type_container(&self) -> TypeContainer
fn auto_type_container(&self) -> TypeContainer
source§fn add_type_library(&self, library: &TypeLibrary)
fn add_type_library(&self, library: &TypeLibrary)
fn type_library_by_name<S: BnStrCompatible>( &self, name: S, ) -> Option<TypeLibrary>
source§fn record_imported_object_library<T: Into<QualifiedName>>(
&self,
lib: &TypeLibrary,
name: T,
addr: u64,
platform: &Platform,
)
fn record_imported_object_library<T: Into<QualifiedName>>( &self, lib: &TypeLibrary, name: T, addr: u64, platform: &Platform, )
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. Read more