binaryai.binaryai_file

Module Contents

Classes

BinaryAIFile

BinaryAIFile represent the file already analyzed by BinaryAI.

class binaryai.binaryai_file.BinaryAIFile(bai: binaryai.client.BinaryAI, sha256: str = None, md5: str = None)[source]

Bases: object

BinaryAIFile represent the file already analyzed by BinaryAI. Users can receive the detailed results by using this conveniently. Note: This is not thread safe!!!

get_filenames() List[str][source]

Get all uploaded filenames.

Returns:

A list of filenames.

Return type:

List[str]

get_mime_type() str[source]

Get MIME type

Returns:

MIME type string.

Return type:

str

get_size() int[source]

Get size in bytes.

Returns:

File size in bytes.

Return type:

int

get_compressed_files() List[binaryai.compressed_file.CompressedFile][source]

Get a list of files inside a compressed file identified.

Returns:

A list of compressed files.

Return type:

List[CompressedFile]

get_all_cves() List[binaryai.cve.CVE][source]

Get all CVEs.

Returns:

A list of CVE objects.

Return type:

List[str]

get_all_cve_names() List[str][source]

Get all CVE names.

Returns:

A list of CVE names.

Return type:

List[str]

get_all_licenses() List[binaryai.license.License][source]

Get all licenses.

Returns:

A list of license objects.

Return type:

List[str]

get_all_license_short_names() List[str][source]

Get all license short names.

Returns:

A list of license short names.

Return type:

List[str]

get_all_ascii_strings() List[str][source]

Get all ASCII strings.

Returns:

A list of ASCII strings.

Return type:

List[str]

get_sca_result() List[binaryai.component.Component][source]

Get SCA result.

Returns:

A list of sortware components.

Return type:

List[Component]

get_overview() Dict[str, str][source]

Fetch analysis overview.

Returns:

A key-value pair containing overview of the file

Return type:

Dict[str, str]

list_func_offset() List[int][source]

Fetch offsets of functions.

Returns:

A list of function offsets

Return type:

List[int]

list_funcs() Iterator[binaryai.function.Function][source]

Parses the list of functions and returns a Function instance containing the given function’s name, fileoffset, bytes, pseudocode and returns the list with a generator.

Returns:

A Function iterator

Return type:

Iterator[Function]

get_func_info(offset: int, with_embedding: bool = False) binaryai.function.Function[source]

Fetch detailed information about the given function identified by its offset address.

Params:

offset: Offset address of desired function with_embedding: if True, try get the embedding representation of each function.

Returns:

A Function instance containing the given function’s name, fileoffset, bytes, pseudocode

Return type:

Function

get_funcs_info(offset: List[int], with_embedding: bool = False) Iterator[binaryai.function.Function][source]

Fetch detailed information about the given functions identified by its offset address.

Params:

offset: List of offset address of desired function with_embedding: if True, try get the embedding representation of each function.

Returns:

A iterator Functions instance containing the given function’s name, fileoffset, bytes, pseudocode.

Return type:

Iterator[Function]

get_func_match(offset: int) List[binaryai.function.MatchedFunction][source]

Match functions about the given function identified by its offset address.

Params:

offset: Offset address of desired function

Returns:

a List containing 10 match results, every result is a Dict the contains score and pseudocode. The List is sorted by score from high to low.

Return type:

List[MatchedFunction]