B2R2


FileInfo Type

FileInfo describes a binary file in a format-agnostic way.

Constructors

Constructor Description

FileInfo()

Full Usage: FileInfo()

Returns: FileInfo
Returns: FileInfo

Instance members

Instance member Description

this.AddSymbol(arg1) (arg2)

Full Usage: this.AddSymbol(arg1) (arg2)

Parameters:
Modifiers: abstract

Add a symbol for the address. This function is useful when we can obtain extra symbol information from outside of B2R2.

arg0 : Addr
arg1 : Symbol

this.BaseAddress

Full Usage: this.BaseAddress

Returns: Addr
Modifiers: abstract

The base address of this binary at which this binary is prefered to be loaded in memory.

Returns: Addr

this.BinReader

Full Usage: this.BinReader

Returns: BinReader
Modifiers: abstract

The corresponding binary reader.

Returns: BinReader

this.EntryPoint

Full Usage: this.EntryPoint

Returns: Addr option
Modifiers: abstract

The entry point of this binary (the start address that this binary runs at). Note that some binaries (e.g., PE DLL files) do not have a specific entry point, and EntryPoint will return None in such a case.

Returns: Addr option

this.ExceptionTable

Full Usage: this.ExceptionTable

Returns: ARMap<ARMap<Addr>>
Modifiers: abstract

An exception table, which is a mapping from a function address to a set of landing pads. The landing pads are mappings from a range of instruction addresses to a landing pad address.

Returns: ARMap<ARMap<Addr>>

this.FileFormat

Full Usage: this.FileFormat

Returns: FileFormat
Modifiers: abstract

The format of this file: ELF, PE, Mach-O, or etc.

Returns: FileFormat

this.FilePath

Full Usage: this.FilePath

Returns: string
Modifiers: abstract

The file path where this file is located.

Returns: string

this.FileType

Full Usage: this.FileType

Returns: FileType
Modifiers: abstract

What kind of binary is this?

Returns: FileType

this.GetDynamicSymbols(?excludeImported)

Full Usage: this.GetDynamicSymbols(?excludeImported)

Parameters:
    ?excludeImported : bool

Returns: seq<Symbol> A sequence of dynamic symbols.
Modifiers: abstract

Return a list of all the dynamic symbols from the binary. Dynamic symbols are the ones that are required to run the binary. The "excludeImported" argument indicates whether to exclude external symbols that are imported from other files. However, even if "excludeImported" is true, returned symbols may include a forwarding entry that redirects to another function in an external file (cf. SymbolKind.ForwardType). When "excludeImported" argument is not given, this function will simply return all possible dynamic symbols.

?excludeImported : bool
Returns: seq<Symbol>

A sequence of dynamic symbols.

this.GetExecutableSections()

Full Usage: this.GetExecutableSections()

Returns: seq<Section> A sequence of executable sections.

Get a sequence of executable sections including linkage table code sections such as PLT.

Returns: seq<Section>

A sequence of executable sections.

this.GetFunctionAddresses(arg1)

Full Usage: this.GetFunctionAddresses(arg1)

Parameters:
    arg0 : bool

Returns: seq<Addr> A sequence of function addresses.
Modifiers: abstract

Returns a sequence of local function addresses (excluding external functions) from a given FileInfo. If the argument is true, then this funciton utilizes exception information of the binary to infer function entries. Note that the inference process is not necessarily precise, so this is really just an experimental feature, and will be removed in the future.

arg0 : bool
Returns: seq<Addr>

A sequence of function addresses.

this.GetFunctionAddresses()

Full Usage: this.GetFunctionAddresses()

Returns: seq<Addr> A sequence of function addresses.
Modifiers: abstract

Returns a sequence of local function addresses (excluding external functions) from a given FileInfo. This function only considers addresses that are certain.

Returns: seq<Addr>

A sequence of function addresses.

this.GetFunctionSymbols()

Full Usage: this.GetFunctionSymbols()

Returns: seq<Symbol> A sequence of function symbols.

Returns a sequence of local function symbols (excluding external functions) from a given FileInfo.

Returns: seq<Symbol>

A sequence of function symbols.

this.GetLinkageTableEntries()

Full Usage: this.GetLinkageTableEntries()

Returns: seq<LinkageTableEntry> A sequence of linkage table entries, e.g., PLT entries for ELF files.
Modifiers: abstract

Return a list of all the linkage table entries from the binary.

Returns: seq<LinkageTableEntry>

A sequence of linkage table entries, e.g., PLT entries for ELF files.

this.GetNotInFileIntervals(arg1)

Full Usage: this.GetNotInFileIntervals(arg1)

Parameters:
Returns: seq<AddrRange> Returns an empty list when the given range r is valid, i.e., `IsInFileRange r = true`.
Modifiers: abstract

Given a range r, return a list of address ranges (intervals) that are within r, and that are not in-file.

arg0 : AddrRange
Returns: seq<AddrRange>

Returns an empty list when the given range r is valid, i.e., `IsInFileRange r = true`.

this.GetRelocationSymbols()

Full Usage: this.GetRelocationSymbols()

Returns: seq<Symbol> A sequence of relocation symbols.
Modifiers: abstract

Return a list of all relocation symbols from the binary.

Returns: seq<Symbol>

A sequence of relocation symbols.

this.GetSections(name)

Full Usage: this.GetSections(name)

Parameters:
    name : string - The name of the section.

Returns: seq<Section> A sequence of sections that have the specified name. This function returns an empty sequence if there is no section of the given name.
Modifiers: abstract

Return a section that has the specified name.

name : string

The name of the section.

Returns: seq<Section>

A sequence of sections that have the specified name. This function returns an empty sequence if there is no section of the given name.

this.GetSections(addr)

Full Usage: this.GetSections(addr)

Parameters:
    addr : Addr - The address that belongs to a section.

Returns: seq<Section> A sequence of sections. This function returns a singleton if there exists a corresponding section. Otherwise, it returns an empty sequence.
Modifiers: abstract

Return a section that contains the given address.

addr : Addr

The address that belongs to a section.

Returns: seq<Section>

A sequence of sections. This function returns a singleton if there exists a corresponding section. Otherwise, it returns an empty sequence.

this.GetSections()

Full Usage: this.GetSections()

Returns: seq<Section> A sequence of sections.
Modifiers: abstract

Return a list of all the sections from the binary.

Returns: seq<Section>

A sequence of sections.

this.GetSegments(perm)

Full Usage: this.GetSegments(perm)

Parameters:
Returns: seq<Segment> A sequence of segments.

For a given permission, return a list of segments that satisfy the permission. For a given "READ-only" permission, this function may return a segment whose permission is "READABLE and WRITABLE", as an instance.

perm : Permission
Returns: seq<Segment>

A sequence of segments.

this.GetSegments(addr)

Full Usage: this.GetSegments(addr)

Parameters:
    addr : Addr - The address that belongs to segments.

Returns: seq<Segment> A sequence of segments.

Return a list of the segments from the binary, which contain the given address.

addr : Addr

The address that belongs to segments.

Returns: seq<Segment>

A sequence of segments.

this.GetSegments(?isLoadable)

Full Usage: this.GetSegments(?isLoadable)

Parameters:
    ?isLoadable : bool

Returns: seq<Segment> A sequence of segments.
Modifiers: abstract

Return a list of segments from the binary. If the isLoadable parameter is true, it will only return a list of "loadable" segments. Otherwise, it will return all possible segments. By default, this function returns only loadable segments, e.g., PT_LOAD segment of ELF.

?isLoadable : bool
Returns: seq<Segment>

A sequence of segments.

this.GetStaticSymbols()

Full Usage: this.GetStaticSymbols()

Returns: seq<Symbol> A sequence of static symbols.
Modifiers: abstract

Return a list of all the static symbols from the binary. Static symbols can be removed when we strip the binary. Unlike dynamic symbols, static symbols are not required to run the binary, thus they can be safely removed before releasing it.

Returns: seq<Symbol>

A sequence of static symbols.

this.GetSymbols()

Full Usage: this.GetSymbols()

Returns: seq<Symbol> A sequence of symbols.
Modifiers: abstract

Return a list of all the symbols from the binary.

Returns: seq<Symbol>

A sequence of symbols.

this.GetTextSections()

Full Usage: this.GetTextSections()

Returns: seq<Section> A sequence of text sections.
Modifiers: abstract

Return a sequence text sections.

Returns: seq<Section>

A sequence of text sections.

this.ISA

Full Usage: this.ISA

Returns: ISA
Modifiers: abstract

The ISA that this file expects to run on.

Returns: ISA

this.IsExecutableAddr(arg1)

Full Usage: this.IsExecutableAddr(arg1)

Parameters:
Returns: bool Returns true if the address is executable, false otherwise.
Modifiers: abstract

Check if the given address is executable address for this binary. We say a given address is executable if the address is within an executable section.

arg0 : Addr
Returns: bool

Returns true if the address is executable, false otherwise.

this.IsInFileAddr(arg1)

Full Usage: this.IsInFileAddr(arg1)

Parameters:
Returns: bool Returns true if the address is within a mapped address range, false otherwise.
Modifiers: abstract

Check if the given address is valid and there is an actual mapping from the binary file to the corresponding memory. Unlike IsValidAddr, this function checks if we can decide the actual value of the given address from the binary. For example, a program header of an ELF file may contain 100 bytes in size, but when it is mapped to a segment in memory, the size of the segment can be larger than the size of the program header. This function checks if the given address is in the range of the segment that has a direct mapping to the file's program header.

arg0 : Addr
Returns: bool

Returns true if the address is within a mapped address range, false otherwise.

this.IsInFileRange(arg1)

Full Usage: this.IsInFileRange(arg1)

Parameters:
Returns: bool Returns true if the whole range of addresses is within a valid range, false otherwise.
Modifiers: abstract

Check if the given address range is valid and there exists a corresponding region in the actual binary file. This function returns true only if the whole range of the addressess are valid (for every address in the range, IsInFileAddr should return true).

arg0 : AddrRange
Returns: bool

Returns true if the whole range of addresses is within a valid range, false otherwise.

this.IsLinkageTable(arg1)

Full Usage: this.IsLinkageTable(arg1)

Parameters:
Returns: bool True if the address is a linkage table address, false otherwise.
Modifiers: abstract

Return if a given address is an address of a linkage table entry.

arg0 : Addr
Returns: bool

True if the address is a linkage table address, false otherwise.

this.IsNXEnabled

Full Usage: this.IsNXEnabled

Returns: bool
Modifiers: abstract

Is NX enabled for this binary? (DEP enabled or not)

Returns: bool

this.IsRelocatable

Full Usage: this.IsRelocatable

Returns: bool
Modifiers: abstract

Is this binary relocatable (position-independent)?

Returns: bool

this.IsStripped

Full Usage: this.IsStripped

Returns: bool
Modifiers: abstract

Is this binary stripped?

Returns: bool

this.IsValidAddr(arg1)

Full Usage: this.IsValidAddr(arg1)

Parameters:
Returns: bool Returns true if the address is within a valid range, false otherwise.
Modifiers: abstract

Check if the given address is valid for this binary. We say a given address is valid for the binary if the address is within the range of statically computable segment ranges.

arg0 : Addr
Returns: bool

Returns true if the address is within a valid range, false otherwise.

this.IsValidRange(arg1)

Full Usage: this.IsValidRange(arg1)

Parameters:
Returns: bool Returns true if the whole range of addresses is within a valid range, false otherwise.
Modifiers: abstract

Check if the given address range is valid. This function returns true only if the whole range of the addressess are valid (for every address in the range, IsValidAddr should return true).

arg0 : AddrRange
Returns: bool

Returns true if the whole range of addresses is within a valid range, false otherwise.

this.TextStartAddr

Full Usage: this.TextStartAddr

Returns: Addr
Modifiers: abstract

The beginning of the text section of this binary.

Returns: Addr

this.ToBinaryPointer(arg1)

Full Usage: this.ToBinaryPointer(arg1)

Parameters:
    arg0 : string

Returns: BinaryPointer
Modifiers: abstract

Convert the section of the name (string) into a binary pointer, which can exclusively point to binary contents of the section.

arg0 : string
Returns: BinaryPointer

this.ToBinaryPointer(arg1)

Full Usage: this.ToBinaryPointer(arg1)

Parameters:
Returns: BinaryPointer
Modifiers: abstract

Convert the section at the address (Addr) into a binary pointer, which can exclusively point to binary contents of the section.

arg0 : Addr
Returns: BinaryPointer

this.TranslateAddress(addr)

Full Usage: this.TranslateAddress(addr)

Parameters:
    addr : Addr - Virtual address.

Returns: int Returns an offset to this binary for a given virtual address.
Modifiers: abstract

Translate a virtual address into a relative offset to this binary.

addr : Addr

Virtual address.

Returns: int

Returns an offset to this binary for a given virtual address.

InvalidAddrReadException Thrown when the given address is out of a valid address range.

this.TryFindFunctionSymbolName(arg1)

Full Usage: this.TryFindFunctionSymbolName(arg1)

Parameters:
Returns: Result<string, ErrorCase> Returns a symbol as an Ok value if a symbol exists, otherwise returns an Error value.
Modifiers: abstract

Find the symbol name for a given address.

arg0 : Addr
Returns: Result<string, ErrorCase>

Returns a symbol as an Ok value if a symbol exists, otherwise returns an Error value.

this.WordSize

Full Usage: this.WordSize

Returns: WordSize
Modifiers: abstract

Word size of the CPU that this binary can run on.

Returns: WordSize

Static members

Static member Description

FileInfo.EntryPointToString(entryPoint)

Full Usage: FileInfo.EntryPointToString(entryPoint)

Parameters:
    entryPoint : Addr option - Entry point of a given binary.

Returns: string A converted string.

Convert from entrypoint information to string.

entryPoint : Addr option

Entry point of a given binary.

Returns: string

A converted string.

FileInfo.FileTypeToString(ty)

Full Usage: FileInfo.FileTypeToString(ty)

Parameters:
    ty : FileType - A FileType to convert.

Returns: string A converted string.

Convert FileType to string.

ty : FileType

A FileType to convert.

Returns: string

A converted string.

FileInfo.PermissionToString(p)

Full Usage: FileInfo.PermissionToString(p)

Parameters:
Returns: string A converted string.

Convert from permission to string.

p : Permission

A permission to convert.

Returns: string

A converted string.