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)[源代码]

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][源代码]

Get all uploaded filenames.

返回:

A list of filenames.

返回类型:

List[str]

get_mime_type() str[源代码]

Get MIME type

返回:

MIME type string.

返回类型:

str

get_size() int[源代码]

Get size in bytes.

返回:

File size in bytes.

返回类型:

int

get_compressed_files() List[binaryai.compressed_file.CompressedFile][源代码]

Get a list of files inside a compressed file identified.

返回:

A list of compressed files.

返回类型:

List[CompressedFile]

get_all_cves() List[binaryai.cve.CVE][源代码]

Get all CVEs.

返回:

A list of CVE objects.

返回类型:

List[str]

get_all_cve_names() List[str][源代码]

Get all CVE names.

返回:

A list of CVE names.

返回类型:

List[str]

get_all_licenses() List[binaryai.license.License][源代码]

Get all licenses.

返回:

A list of license objects.

返回类型:

List[str]

get_all_license_short_names() List[str][源代码]

Get all license short names.

返回:

A list of license short names.

返回类型:

List[str]

get_all_ascii_strings() List[str][源代码]

Get all ASCII strings.

返回:

A list of ASCII strings.

返回类型:

List[str]

get_sca_result() List[binaryai.component.Component][源代码]

Get SCA result.

返回:

A list of sortware components.

返回类型:

List[Component]

get_overview() Dict[str, str][源代码]

Fetch analysis overview.

返回:

A key-value pair containing overview of the file

返回类型:

Dict[str, str]

list_func_offset() List[int][源代码]

Fetch offsets of functions.

返回:

A list of function offsets

返回类型:

List[int]

list_funcs() Iterator[binaryai.function.Function][源代码]

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.

返回:

A Function iterator

返回类型:

Iterator[Function]

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

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.

返回:

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

返回类型:

Function

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

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.

返回:

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

返回类型:

Iterator[Function]

get_func_match(offset: int) List[binaryai.function.MatchedFunction][源代码]

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

Params:

offset: Offset address of desired function

返回:

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.

返回类型:

List[MatchedFunction]

get_khash_info() tuple[bytes, str][源代码]

Return the KHash of this file. See website for detailed introduction on KHash.

返回:

KHash’s value and version. Only compare if version is same.

返回类型:

Tuple[bytes, str]

get_malware_probability()[源代码]

Return the malware probability of this file. 0 usually mean a white file, while 1 mean the file is risky.

This is a experimental feature. This might be changed without noticed.

返回:

Probability of the file. None means no result is available.

返回类型:

Optional[float]