:py:mod:`binaryai.binaryai_file` ================================ .. py:module:: binaryai.binaryai_file Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: binaryai.binaryai_file.BinaryAIFile .. py:class:: BinaryAIFile(bai: binaryai.client.BinaryAI, sha256: str = None, md5: str = None) Bases: :py:obj:`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!!! .. py:method:: get_filenames() -> List[str] Get all uploaded filenames. :returns: A list of filenames. :rtype: List[str] .. py:method:: get_mime_type() -> str Get MIME type :returns: MIME type string. :rtype: str .. py:method:: get_size() -> int Get size in bytes. :returns: File size in bytes. :rtype: int .. py:method:: get_compressed_files() -> List[binaryai.compressed_file.CompressedFile] Get a list of files inside a compressed file identified. :returns: A list of compressed files. :rtype: List[CompressedFile] .. py:method:: get_all_cves() -> List[binaryai.cve.CVE] Get all CVEs. :returns: A list of CVE objects. :rtype: List[str] .. py:method:: get_all_cve_names() -> List[str] Get all CVE names. :returns: A list of CVE names. :rtype: List[str] .. py:method:: get_all_licenses() -> List[binaryai.license.License] Get all licenses. :returns: A list of license objects. :rtype: List[str] .. py:method:: get_all_license_short_names() -> List[str] Get all license short names. :returns: A list of license short names. :rtype: List[str] .. py:method:: get_all_ascii_strings() -> List[str] Get all ASCII strings. :returns: A list of ASCII strings. :rtype: List[str] .. py:method:: get_sca_result() -> List[binaryai.component.Component] Get SCA result. :returns: A list of sortware components. :rtype: List[Component] .. py:method:: get_overview() -> Dict[str, str] Fetch analysis overview. :returns: A key-value pair containing overview of the file :rtype: Dict[str, str] .. py:method:: list_func_offset() -> List[int] Fetch offsets of functions. :returns: A list of function offsets :rtype: List[int] .. py:method:: 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. :returns: A Function iterator :rtype: Iterator[Function] .. py:method:: 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. :returns: A Function instance containing the given function's name, fileoffset, bytes, pseudocode :rtype: Function .. py:method:: 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. :returns: A iterator Functions instance containing the given function's name, fileoffset, bytes, pseudocode. :rtype: Iterator[Function] .. py:method:: 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 :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. :rtype: List[MatchedFunction] .. py:method:: get_khash_info() -> tuple[bytes, str] Return the KHash of this file. See website for detailed introduction on KHash. :returns: KHash's value and version. Only compare if version is same. :rtype: Tuple[bytes, str] .. py:method:: 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. :returns: Probability of the file. None means no result is available. :rtype: Optional[float]