### Use Local Rust Repository with `rbi` CLI Source: https://context7.com/n0fix/rustbininfo/llms.txt Specifies a local clone of the rust-lang/rust repository using the `--repo` flag to avoid GitHub API rate limits. Requires `pip install rustbininfo[gitpython]`. ```bash # Use a local rust-lang/rust git repo to avoid GitHub rate limits # Requires: pip install rustbininfo[gitpython] rbi --repo /path/to/rust challenge.exe ``` -------------------------------- ### Run Tests with Git LFS Source: https://github.com/n0fix/rustbininfo/blob/master/README.md To run tests, you need to fetch and pull large files using Git LFS. After setup, execute pytest to run the test suite. ```bash git lfs fetch git lfs pull pytest -s ``` -------------------------------- ### Get Rust Executable Info Source: https://github.com/n0fix/rustbininfo/blob/master/README.md Use this command to get detailed information about a stripped Rust executable. It outputs Rust compiler version, commit hash, dependencies, and guessed toolchain. ```bash > rbi ~/Downloads/crackme.exe TargetRustInfo( rustc_version='1.65.0', rustc_commit_hash='9c20b2a8cc7588decb6de25ac6a7912dcef24d65', dependencies=[ Crate(name='crc-any', version='2.4.3', features=[], repository=None), Crate(name='rand', version='0.8.5', features=[], repository=None), Crate(name='rand_chacha', version='0.3.1', features=[], repository=None), Crate(name='short-crypt', version='1.0.26', features=[], repository=None) ], rust_dependencies_imphash='cd7358d2cd75458edda70d567f1555fa', guessed_toolchain='windows-msvc' ) ``` -------------------------------- ### Get Nightly Toolchain Date with `rbi` CLI Source: https://context7.com/n0fix/rustbininfo/llms.txt Maps the compiler version to its nightly toolchain date using the `rbi --nightly` flag. ```bash # Get the nightly toolchain identifier for the compiler version rbi --nightly challenge.exe # Output: Nightly version: nightly-2022-11-03- (e.g nightly-2022-11-03-x86_64-unknown-linux-gnu) ``` -------------------------------- ### Get Compiler Release Date with `rbi` CLI Source: https://context7.com/n0fix/rustbininfo/llms.txt Retrieves the release date of the Rust compiler used in the executable via the `rbi --version` command. ```bash # Print the compiler release date rbi --version challenge.exe # Output: 2022-11-03 ``` -------------------------------- ### Resolve Rustc Version using GitRepoProvider (Local Git Repo) Source: https://context7.com/n0fix/rustbininfo/llms.txt Extend BasicProvider to use a local rust-lang/rust repository for version resolution, avoiding GitHub API rate limits. Requires the 'gitpython' extra. Falls back to date-based commit search. ```python import pathlib from rustbininfo.info.rust_repo_handler import GitRepoProvider from rustbininfo import TargetRustInfo # Point to a local clone of https://github.com/rust-lang/rust repo_path = pathlib.Path("/opt/rust-lang/rust") provider = GitRepoProvider(repo_path, update=False) # update=True pulls latest target = pathlib.Path("archiver.exe") # Resolve version from local repo (no GitHub API calls) commit, version = provider.get_rustc_version(target) print(commit) # '3c85e56249b0b1942339a6a989a971bf6f1c9e0f' print(version) # '1.67.0' (or a nightly date like 'nightly-2023-01-12') # Use the provider with the high-level API info = TargetRustInfo.from_target(target, fast_load=True, provider=provider) print(info.rustc_version) print(info.guessed_toolchain) # 'Mingw-w64 (Mingw8-GCC_10.3.0)' # Get the date of the latest tag in the local repo latest = provider.get_latest_rustc_version() print(latest) # e.g. '1.75.0' ``` -------------------------------- ### get_dependencies() Source: https://context7.com/n0fix/rustbininfo/llms.txt Scans a binary file to extract a set of Crate objects representing its raw dependencies. Can optionally enrich these with metadata from crates.io. ```APIDOC ## get_dependencies() ### Description Extracts a set of unique crate dependencies from a binary file. ### Parameters - `target: pathlib.Path` - The path to the binary file. - `fast_load: bool = True` - If `False`, triggers crates.io metadata enrichment for each discovered crate. ### Returns - `set[Crate]` - A set of Crate objects representing the dependencies found in the binary. ### Example Usage ```python import pathlib from rustbininfo.info.dependencies import get_dependencies target = pathlib.Path("challenge.exe") deps = get_dependencies(target, fast_load=True) for crate in sorted(deps, key=lambda c: c.name): print(f"{crate.name} {crate.version}") ``` ``` -------------------------------- ### Python API: Extract Basic Binary Metadata Source: https://context7.com/n0fix/rustbininfo/llms.txt Uses `TargetRustInfo.from_target()` in fast mode to extract basic metadata like rustc version, commit hash, dependency imphash, and guessed toolchain without fetching full crate metadata. ```python import pathlib from rustbininfo import TargetRustInfo, BasicProvider target = pathlib.Path("challenge.exe") # Fast mode: dependency names/versions extracted, no crates.io API calls info = TargetRustInfo.from_target(target, fast_load=True) print(info.rustc_version) # '1.65.0' print(info.rustc_commit_hash) # '9c20b2a8cc7588decb6de25ac6a7912dcef24d65' print(info.rust_dependencies_imphash) # 'cd7358d2cd75458edda70d567f1555fa' print(info.guessed_toolchain) # 'windows-msvc' for crate in info.dependencies: print(f" {crate.name} == {crate.version}") # crc-any == 2.4.3 # rand == 0.8.5 # rand_chacha == 0.3.1 # short-crypt == 1.0.26 ``` -------------------------------- ### CLI Usage: `rbi` Source: https://context7.com/n0fix/rustbininfo/llms.txt The `rbi` command-line interface accepts a path to a Rust binary and prints a structured summary. Various flags allow for detailed information retrieval. ```APIDOC ## `rbi` — Command-line interface The `rbi` (and `rustbininfo`) CLI entry point accepts a path to a Rust binary and prints a structured summary. The `-f`/`--full` flag disables fast-load mode (fetching full crate metadata from crates.io). The `-d`/`--project-date` flag estimates the date range of the latest dependency update. The `--version` flag prints the compiler release date. The `--nightly` / `-n` flag maps the compiler version to its nightly toolchain date. The `--repo` / `-r` flag points to a local clone of the rust-lang/rust repository to avoid GitHub API rate limits. ### Basic Usage ```bash rbi challenge.exe ``` ### Full Mode ```bash rbi -f challenge.exe ``` ### Estimate Dependency Update Date ```bash rbi -d challenge.exe ``` ### Print Compiler Release Date ```bash rbi --version challenge.exe ``` ### Get Nightly Toolchain Date ```bash rbi --nightly challenge.exe ``` ### Use Local Git Repository ```bash rbi --repo /path/to/rust challenge.exe ``` ``` -------------------------------- ### BasicProvider Source: https://context7.com/n0fix/rustbininfo/llms.txt The BasicProvider is the default resolver for rustc versions. It can extract the rustc commit hash from a binary, resolve the version using the GitHub API, or read it directly from the .comment ELF/PE section. It also supports date-based commit guessing as a fallback. ```APIDOC ## BasicProvider ### Description Provides methods to resolve the rustc version from a binary. ### Methods - `get_rustc_commit(target: pathlib.Path) -> str` Extracts the raw commit hash from the binary. - `get_version_from_comment(target: pathlib.Path) -> str | None` Reads the version directly from the .comment section of the binary. - `rustc_version_from_commit(commit: str) -> str` Resolves the rustc version from a given commit hash using the GitHub API. - `get_rustc_version_date(version: str) -> str` Retrieves the release date for a specific rustc version. - `get_rustc_version(target: pathlib.Path) -> tuple[str, str]` Orchestrates the extraction and resolution process to get the commit hash and rustc version from a binary. ### Example Usage ```python import pathlib from rustbininfo.info.compiler import BasicProvider provider = BasicProvider() target = pathlib.Path("challenge.exe") commit = provider.get_rustc_commit(target) version_str = provider.get_version_from_comment(target) version = provider.rustc_version_from_commit(commit) date = provider.get_rustc_version_date("1.65.0") commit, version = provider.get_rustc_version(target) ``` ``` -------------------------------- ### guess_toolchain() Source: https://context7.com/n0fix/rustbininfo/llms.txt Identifies the Windows build toolchain (Mingw-w64/GCC, windows-msvc, linux-musl) of a binary using YARA rules and byte-pattern heuristics. ```APIDOC ## guess_toolchain() ### Description Identifies the Windows build toolchain (Mingw-w64/GCC, windows-msvc, linux-musl) of a binary using YARA rules and byte-pattern heuristics. ### Method `guess_toolchain(binary_content: bytes) -> str | None` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import pathlib from rustbininfo.info.models.info import guess_toolchain with open("archiver.exe", "rb") as f: content = f.read() toolchain = guess_toolchain(content) print(toolchain) # 'Mingw-w64 (Mingw8-GCC_10.3.0)' # Returns None if no known toolchain pattern matched with open("unknown_binary", "rb") as f: content = f.read() result = guess_toolchain(content) print(result) # None ``` ### Response #### Success Response (str | None) - **toolchain** (str | None) - A string identifying the toolchain, or None if no known pattern matched. #### Response Example ``` 'Mingw-w64 (Mingw8-GCC_10.3.0)' ``` ``` -------------------------------- ### Full Mode `rbi` CLI Usage Source: https://context7.com/n0fix/rustbininfo/llms.txt Enables full mode for the `rbi` CLI, which fetches complete crate metadata from crates.io. This process is slower but provides more detailed information. ```bash # Full mode — fetches crate metadata from crates.io (slower) rbi -f challenge.exe ``` -------------------------------- ### Fetch Full Dependency Information Source: https://context7.com/n0fix/rustbininfo/llms.txt Fetches comprehensive dependency data including repository URLs and features from crates.io. Requires fast_load=False. ```python deps_full = get_dependencies(target, fast_load=False) for crate in sorted(deps_full, key=lambda c: c.name): print(f"{crate.name} {crate.version} {crate.repository}") ``` -------------------------------- ### Resolve Rustc Version using BasicProvider (GitHub API) Source: https://context7.com/n0fix/rustbininfo/llms.txt Use BasicProvider to extract the rustc commit hash from a binary, then resolve the version using the GitHub API. It can also read the version from the .comment section or guess based on date. ```python import pathlib from rustbininfo.info.compiler import BasicProvider provider = BasicProvider() target = pathlib.Path("challenge.exe") # Extract the raw commit hash from the binary commit = provider.get_rustc_commit(target) print(commit) # '9c20b2a8cc7588decb6de25ac6a7912dcef24d65' # Read version from .comment section (faster, no network) version_str = provider.get_version_from_comment(target) print(version_str) # '1.65.0' or None if not present # Resolve version from commit via GitHub API version = provider.rustc_version_from_commit(commit) print(version) # '1.65.0' # Get the release date of a specific rustc version date = provider.get_rustc_version_date("1.65.0") print(date) # '2022-11-03' # Get full (commit, version) tuple — orchestrates the above steps commit, version = provider.get_rustc_version(target) print(commit, version) # '9c20b2a8cc7588decb6de25ac6a7912dcef24d65' '1.65.0' ``` -------------------------------- ### Extract Raw Dependencies from Binary using get_dependencies() Source: https://context7.com/n0fix/rustbininfo/llms.txt Scans a binary's raw bytes for embedded Rust source paths to identify unique dependencies. Use fast_load=False to enrich discovered crates with metadata from crates.io. ```python import pathlib from rustbininfo.info.dependencies import get_dependencies target = pathlib.Path("challenge.exe") # Fast: name/version only, no network calls deps = get_dependencies(target, fast_load=True) for crate in sorted(deps, key=lambda c: c.name): print(f"{crate.name} {crate.version}") # crc-any 2.4.3 # rand 0.8.5 # rand_chacha 0.3.1 # short-crypt 1.0.26 ``` -------------------------------- ### NightlyGetter.get_nightly_toolchain_for_rustc_version() Source: https://context7.com/n0fix/rustbininfo/llms.txt Maps a stable Rust version to its corresponding nightly toolchain date string by querying the GitHub Tags API for the rust-lang/rust repository. ```APIDOC ## NightlyGetter.get_nightly_toolchain_for_rustc_version() ### Description Maps a stable Rust version to its corresponding nightly toolchain date string by querying the GitHub Tags API for the rust-lang/rust repository. ### Method `NightlyGetter().get_nightly_toolchain_for_rustc_version(stable_version: str) -> str` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from rustbininfo.info.nightly.nightly import NightlyGetter getter = NightlyGetter() # Map a stable rustc version to its nightly toolchain date date = getter.get_nightly_toolchain_for_rustc_version("1.65.0") print(date) # '2022-11-03' toolchain = f"nightly-{date}-x86_64-unknown-linux-gnu" print(toolchain) # nightly-2022-11-03-x86_64-unknown-linux-gnu # Use with rustup to install the matching nightly toolchain import subprocess subprocess.run(["rustup", "toolchain", "install", f"nightly-{date}"]) ``` ### Response #### Success Response (str) - **date** (str) - The date string representing the nightly toolchain. #### Response Example ``` '2022-11-03' ``` ``` -------------------------------- ### Python API: Extract Full Crate Metadata Source: https://context7.com/n0fix/rustbininfo/llms.txt Uses `TargetRustInfo.from_target()` with `fast_load=False` to fetch full crate metadata, including repository URLs and feature flags, from crates.io. ```python # Full mode: fetches repository URL and feature flags from crates.io info_full = TargetRustInfo.from_target(target, fast_load=False) for crate in info_full.dependencies: print(f"{crate.name} {crate.version} — repo: {crate.repository}") ``` -------------------------------- ### Rust Bin Info CLI Usage Source: https://github.com/n0fix/rustbininfo/blob/master/README.md The rbi command-line tool can be used with various options to analyze Rust executables. Use -f for full output and -d to guess the latest dependency addition date. ```bash rbi usage: rbi [-h] [-f] [-d] target Get information about stripped rust executable, and download its dependencies. positional arguments: target options: -h, --help show this help message and exit -f, --full -d, --project-date Tries to guess date latest depdnency got added to the project, based on dependencies version Usage examples: rbi 'challenge.exe' rbi -f 'challenge.exe' rbi -d 'challenge.exe' ``` -------------------------------- ### GitRepoProvider Source: https://context7.com/n0fix/rustbininfo/llms.txt GitRepoProvider extends BasicProvider to resolve rustc versions using a local clone of the rust-lang/rust repository, avoiding GitHub API rate limits. It finds tags containing the commit or falls back to date-based searching. ```APIDOC ## GitRepoProvider ### Description Resolves rustc versions by querying a local git repository of the rust-lang/rust project. ### Initialization - `GitRepoProvider(repo_path: pathlib.Path, update: bool = False)` Initializes the provider with the path to the local git repository. `update=True` will pull the latest changes. ### Methods - `get_rustc_version(target: pathlib.Path) -> tuple[str, str]` Resolves the rustc commit and version from the binary using the local repository. - `get_latest_rustc_version() -> str` Retrieves the latest rustc version tag available in the local repository. ### Example Usage ```python import pathlib from rustbininfo.info.rust_repo_handler import GitRepoProvider from rustbininfo import TargetRustInfo repo_path = pathlib.Path("/opt/rust-lang/rust") provider = GitRepoProvider(repo_path, update=False) target = pathlib.Path("archiver.exe") commit, version = provider.get_rustc_version(target) info = TargetRustInfo.from_target(target, fast_load=True, provider=provider) print(info.rustc_version) print(info.guessed_toolchain) latest = provider.get_latest_rustc_version() ``` ``` -------------------------------- ### Basic `rbi` CLI Usage Source: https://context7.com/n0fix/rustbininfo/llms.txt Extracts basic information from a Rust executable in fast mode. This mode does not fetch full crate metadata from crates.io. ```bash # Basic info (fast mode — no crates.io metadata fetched) rbi challenge.exe # Output: # TargetRustInfo( # rustc_version='1.65.0', # rustc_commit_hash='9c20b2a8cc7588decb6de25ac6a7912dcef24d65', # dependencies=[ # Crate(name='crc-any', version='2.4.3', features=[], repository=None), # Crate(name='rand', version='0.8.5', features=[], repository=None), # Crate(name='rand_chacha', version='0.3.1', features=[], repository=None), # Crate(name='short-crypt', version='1.0.26', features=[], repository=None) # ], # rust_dependencies_imphash='cd7358d2cd75458edda70d567f1555fa', # guessed_toolchain='windows-msvc' # ) ``` -------------------------------- ### Guess Toolchain from Binary Bytes using YARA Source: https://context7.com/n0fix/rustbininfo/llms.txt Identifies the Windows build toolchain (Mingw-w64, MSVC, or musl) by running YARA rules and byte-pattern heuristics on raw binary data. Returns None if no known pattern matches. ```python import pathlib from rustbininfo.info.models.info import guess_toolchain with open("archiver.exe", "rb") as f: content = f.read() toolchain = guess_toolchain(content) print(toolchain) # 'Mingw-w64 (Mingw8-GCC_10.3.0)' # Returns None if no known toolchain pattern matched with open("unknown_binary", "rb") as f: content = f.read() result = guess_toolchain(content) print(result) # None ``` -------------------------------- ### Crate Model: Dependency Parsing, Metadata Fetching, and Downloading Source: https://context7.com/n0fix/rustbininfo/llms.txt Represents a crate dependency, parsable from a string. In non-fast-load mode, it fetches metadata from crates.io. Supports downloading the source tarball and extracting it. ```python import pathlib from rustbininfo import Crate # Parse from embedded dep string crate = Crate.from_depstring("rand-0.8.5", fast_load=True) print(crate.name) # 'rand' print(crate.version) # '0.8.5' print(str(crate)) # 'rand-0.8.5' # Fetch metadata from crates.io (sets repository and features) crate_full = Crate.from_depstring("rand-0.8.5", fast_load=False) print(crate_full.repository) # 'https://github.com/rust-random/rand' print(crate_full.features) # ['small_rng', 'std', ...] # Download the source tarball to a temp directory downloaded_path = crate_full.download() print(downloaded_path) # PosixPath('/tmp/rustbininfo/rand-0.8.5.tar.gz') # Download and extract in one step dest = pathlib.Path("/tmp/crates") dest.mkdir(exist_ok=True) extracted_path = crate_full.download_untar(destination_directory=dest, remove_tar=True) print(extracted_path) # PosixPath('/tmp/crates/rand-0.8.5') ``` -------------------------------- ### Estimate Project Build Date Range Source: https://context7.com/n0fix/rustbininfo/llms.txt Estimates the project's creation date range by cross-referencing dependency versions with crates.io publication timestamps. Requires fast_load=False dependencies. ```python import pathlib from rustbininfo import TargetRustInfo, get_min_max_update_time target = pathlib.Path("challenge.exe") # Must use fast_load=False so crate metadata (timestamps) are populated info = TargetRustInfo.from_target(target, fast_load=False) min_date, max_date = get_min_max_update_time(info.dependencies) print(f"Project likely created between {min_date.date()} and {max_date.date()}") # Project likely created between 2022-10-01 and 2022-11-14 ``` -------------------------------- ### Python API: `TargetRustInfo.from_target()` Source: https://context7.com/n0fix/rustbininfo/llms.txt The `TargetRustInfo.from_target()` classmethod is the primary way to extract binary metadata using the Python API. It supports fast-load mode and configurable providers for compiler version resolution. ```APIDOC ## `TargetRustInfo.from_target()` — Extract all binary metadata `TargetRustInfo` is the primary Pydantic model. `from_target()` is its factory classmethod: it reads the binary, extracts the rustc commit hash and version, scans for embedded dependency strings, computes the dependency imphash, and runs YARA toolchain detection. `fast_load=True` (default) skips fetching full crate metadata from crates.io. Pass a `BasicProvider` or `GitRepoProvider` instance to control how the compiler version is resolved. ### Basic Extraction (Fast Mode) ```python import pathlib from rustbininfo import TargetRustInfo target = pathlib.Path("challenge.exe") # Fast mode: dependency names/versions extracted, no crates.io API calls info = TargetRustInfo.from_target(target, fast_load=True) print(info.rustc_version) print(info.rustc_commit_hash) print(info.rust_dependencies_imphash) print(info.guessed_toolchain) for crate in info.dependencies: print(f" {crate.name} == {crate.version}") ``` ### Full Extraction (With Crates.io Metadata) ```python import pathlib from rustbininfo import TargetRustInfo target = pathlib.Path("challenge.exe") # Full mode: fetches repository URL and feature flags from crates.io info_full = TargetRustInfo.from_target(target, fast_load=False) for crate in info_full.dependencies: print(f"{crate.name} {crate.version} — repo: {crate.repository}") ``` ``` -------------------------------- ### Compute Dependency Import Hash (Imphash) Source: https://context7.com/n0fix/rustbininfo/llms.txt Generates an MD5 fingerprint of sorted dependency strings for binary similarity comparison. Identical hashes indicate the same Cargo.lock dependency set. ```python from rustbininfo.info.models.info import imphash from rustbininfo import Crate deps = [ Crate(name="rand", version="0.8.5", fast_load=True), Crate(name="crc-any", version="2.4.3", fast_load=True), Crate(name="short-crypt", version="1.0.26", fast_load=True), Crate(name="rand_chacha", version="0.3.1", fast_load=True), ] h = imphash(deps) print(h) # 'cd7358d2cd75458edda70d567f1555fa' # Compare two binaries for shared dependency fingerprint from rustbininfo import TargetRustInfo info_a = TargetRustInfo.from_target("binary_a.exe") info_b = TargetRustInfo.from_target("binary_b.exe") if info_a.rust_dependencies_imphash == info_b.rust_dependencies_imphash: print("Same Cargo.lock dependency set!") ``` -------------------------------- ### Crate Source: https://context7.com/n0fix/rustbininfo/llms.txt The Crate model represents a Rust crate dependency. It can be instantiated from a dependency string, fetch metadata from crates.io, and download or extract source tarballs. ```APIDOC ## Crate ### Description A Pydantic model representing a Rust crate dependency, with support for fetching metadata and downloading source code. ### Class Methods - `from_depstring(depstring: str, fast_load: bool = True) -> Crate` Parses a dependency string (e.g., "rand-0.8.5") into a Crate object. If `fast_load` is `False`, it fetches metadata from crates.io. ### Instance Methods - `download() -> pathlib.Path` Downloads the crate's source tarball to a temporary directory and returns the path. - `download_untar(destination_directory: pathlib.Path, remove_tar: bool = False) -> pathlib.Path` Downloads and extracts the crate's source tarball to the specified directory. If `remove_tar` is `True`, the tarball is deleted after extraction. ### Example Usage ```python import pathlib from rustbininfo import Crate crate = Crate.from_depstring("rand-0.8.5", fast_load=True) print(crate.name) print(crate.version) crate_full = Crate.from_depstring("rand-0.8.5", fast_load=False) print(crate_full.repository) print(crate_full.features) downloaded_path = crate_full.download() dest = pathlib.Path("/tmp/crates") dest.mkdir(exist_ok=True) extracted_path = crate_full.download_untar(destination_directory=dest, remove_tar=True) ``` ``` -------------------------------- ### Map Stable Rust Version to Nightly Toolchain Date Source: https://context7.com/n0fix/rustbininfo/llms.txt Queries the GitHub Tags API to find the commit date for a given stable rustc version, returning a nightly toolchain date string compatible with rustup. ```python from rustbininfo.info.nightly.nightly import NightlyGetter getter = NightlyGetter() # Map a stable rustc version to its nightly toolchain date date = getter.get_nightly_toolchain_for_rustc_version("1.65.0") print(date) # '2022-11-03' toolchain = f"nightly-{date}-x86_64-unknown-linux-gnu" print(toolchain) # nightly-2022-11-03-x86_64-unknown-linux-gnu # Use with rustup to install the matching nightly toolchain import subprocess subprocess.run(["rustup", "toolchain", "install", f"nightly-{date}"]) ``` -------------------------------- ### get_min_max_update_time() Source: https://context7.com/n0fix/rustbininfo/llms.txt Estimates the project build date range by cross-referencing dependency versions with crates.io publication timestamps. Requires dependencies to be loaded with fast_load=False. ```APIDOC ## get_min_max_update_time() ### Description Estimates the project build date range by cross-referencing dependency versions with crates.io publication timestamps. Requires dependencies to be loaded with fast_load=False. ### Method `get_min_max_update_time(dependencies: list[Crate]) -> tuple[datetime, datetime]` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import pathlib from rustbininfo import TargetRustInfo, get_min_max_update_time target = pathlib.Path("challenge.exe") # Must use fast_load=False so crate metadata (timestamps) are populated info = TargetRustInfo.from_target(target, fast_load=False) min_date, max_date = get_min_max_update_time(info.dependencies) print(f"Project likely created between {min_date.date()} and {max_date.date()}") # Project likely created between 2022-10-01 and 2022-11-14 ``` ### Response #### Success Response (tuple[datetime, datetime]) - **min_date** (datetime) - The earliest possible publication date for all dependencies. - **max_date** (datetime) - The latest possible publication date for any dependency before the next version. #### Response Example ``` (datetime.datetime(2022, 10, 1, 0, 0), datetime.datetime(2022, 11, 14, 0, 0)) ``` ``` -------------------------------- ### imphash() Source: https://context7.com/n0fix/rustbininfo/llms.txt Computes an MD5 fingerprint of the sorted dependency strings, useful for binary similarity comparison based on the Cargo.lock file. ```APIDOC ## imphash() ### Description Computes an MD5 fingerprint of the sorted dependency strings, useful for binary similarity comparison based on the Cargo.lock file. ### Method `imphash(dependencies: list[Crate]) -> str` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python from rustbininfo.info.models.info import imphash from rustbininfo import Crate deps = [ Crate(name="rand", version="0.8.5", fast_load=True), Crate(name="crc-any", version="2.4.3", fast_load=True), Crate(name="short-crypt", version="1.0.26", fast_load=True), Crate(name="rand_chacha", version="0.3.1", fast_load=True), ] h = imphash(deps) print(h) # 'cd7358d2cd75458edda70d567f1555fa' # Compare two binaries for shared dependency fingerprint from rustbininfo import TargetRustInfo info_a = TargetRustInfo.from_target("binary_a.exe") info_b = TargetRustInfo.from_target("binary_b.exe") if info_a.rust_dependencies_imphash == info_b.rust_dependencies_imphash: print("Same Cargo.lock dependency set!") ``` ### Response #### Success Response (str) - **imphash** (str) - The MD5 hash of the dependency list. #### Response Example ``` 'cd7358d2cd75458edda70d567f1555fa' ``` ``` -------------------------------- ### Estimate Dependency Update Date with `rbi` CLI Source: https://context7.com/n0fix/rustbininfo/llms.txt Uses the `rbi` CLI with the `-d` flag to estimate the date range when the latest dependency was last updated. ```bash # Estimate date range when dependencies were last updated rbi -d challenge.exe # Output: Latest dependency was added between 2022-10-01 12:00:00+00:00 and 2022-11-14 09:22:00+00:00 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.