Skip to main content

hybridanalysis

hybridanalysis

Python library and CLI for the Hybrid Analysis (Falcon Sandbox) API v2

Python Versions License Coverage Typed Async

GitHub Stars GitHub Issues Buy Me a Coffee


Overview

hybridanalysis is a Python toolkit to submit samples to and query the Hybrid Analysis service through its stable API v2 and experimental API Labs. It ships both a synchronous and an asynchronous client with identical surfaces, a CLI, and a typed exception hierarchy — covering every current (non-deprecated) v2 endpoint and every documented Labs operation.

Key Features

Feature Description
Full API coverage Every current v2 endpoint plus all documented API Labs operations
Sync + Async HybridAnalysisClient (httpx) and AsyncHybridAnalysisClient (httpx async) with the same methods
CLI + Library Use as the hybridanalysis command-line tool or as a Python package
Rich search Query by domain, host/IP, URL, malware family, tag, MITRE ATT&CK technique, hash-similarity and more
File submission Full sandbox and quick-scan multipart uploads
Multiple output formats JSON, token-efficient TOON, and SARIF 2.1.0 for analysis results (--format)
Flexible config Environment variables or a local TOML file

Supported Surface

Clients      HybridAnalysisClient (sync), AsyncHybridAnalysisClient (async)
Tags         feed · key · overview · quick-scan · submit · report
             search · file-collection · abuse-reports · system · labs
Downloads    sample, pcap, certificate, dropped files, memory strings (bytes/text)
Config       HYBRIDANALYSIS env var · ~/.config/hybridanalysis/config.toml
Errors       AuthenticationError · NotFoundError · RateLimitError · APIError
             NetworkError · ConfigError (all subclass HybridAnalysisError)

Installation

From PyPI

pip install hybridanalysis            # core
pip install 'hybridanalysis[toon]'    # + TOON output (`--format toon`)

From Source

git clone https://github.com/seifreed/hybridanalysis.git
cd hybridanalysis
python3.14 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt  # runtime + dev tooling; use `pip install -e .` for runtime only

Requires Python 3.14+. Runtime dependencies are httpx and click; --format toon needs the optional toon extra (toon-format).


Configuration

The API key is resolved from, in order:

  1. The HYBRIDANALYSIS environment variable.

  2. A local TOML file — ./.hybridanalysis.toml or ~/.config/hybridanalysis/config.toml:

    [hybridanalysis]
    api_key = "your-api-key"
    # base_url   = "https://hybrid-analysis.com/api/v2"  # optional
    # user_agent = "Falcon Sandbox"                      # optional
    # timeout    = 60                                    # optional, seconds
    

Every field also has an environment variable that takes precedence over the file: HYBRIDANALYSIS_URL, HYBRIDANALYSIS_USER_AGENT, and HYBRIDANALYSIS_TIMEOUT.


Quick Start

export HYBRIDANALYSIS="your-api-key"

# System / key info
hybridanalysis system version
hybridanalysis key current

# Submit a sample and poll its report
hybridanalysis submit file sample.exe environment_id=160
hybridanalysis report summary <job-id>

# Query the experimental API Labs search
hybridanalysis labs search query 'verdict:malicious AND score:80+'

Usage

Command Line Interface

# Look up a hash (any format -> SHA256) and its reports
hybridanalysis search hash <md5|sha1|sha256>

# Search by behaviour / infrastructure
hybridanalysis search terms host=8.8.8.8
hybridanalysis search terms vx_family=nemucod verdict=5
hybridanalysis search terms uses_technique=T1055

# Submit for analysis
hybridanalysis submit file sample.exe environment_id=160
hybridanalysis quick-scan file sample.exe --scan-type all

# Download binary artifacts (to a file, or stdout when --out is omitted)
hybridanalysis report pcap <job-id> --out capture.pcap
hybridanalysis overview sample <sha256> --out sample.gz

--api-key, --base-url, and --config override the resolved configuration. python -m hybridanalysis works as an alternative to the hybridanalysis command.

Output Formats

Every JSON-returning command accepts -f / --format:

hybridanalysis overview get <sha256> --format toon    # token-efficient JSON
hybridanalysis report summary <job-id> --format sarif # SARIF 2.1.0 findings
Format Available on Description
json all commands (default) Indented JSON.
toon all commands TOON — a compact, lossless JSON encoding that uses fewer tokens. Needs the toon extra: pip install 'hybridanalysis[toon]'.
sarif analysis commands (feed, overview, search, quick-scan, report) SARIF 2.1.0: the verdict and each signatures[] entry become results, with levels derived from the verdict / threat level. The artifact location is taken from the command's SHA256 / report-id argument.

Command Groups

Command Description
hybridanalysis system Instance version, environments, action scripts, stats, config, queue
hybridanalysis key API key info and submission quota
hybridanalysis feed Recent detonation and quick-scan feeds
hybridanalysis overview Aggregated report for a SHA256 (+ sample download)
hybridanalysis search Hash lookup and multi-field term search
hybridanalysis quick-scan Quick scans of files/URLs and result retrieval
hybridanalysis submit Sandbox submission of files, URLs and dropped files
hybridanalysis report Report state/summary and artifact downloads
hybridanalysis file-collection Create, search, and manage file collections
hybridanalysis abuse-reports Request report deletion; removed-hash feed
hybridanalysis labs Experimental query search, sample overview, YARA hunting rules and recent matches

API Labs Commands

API Labs is experimental and may change independently of API v2. labs hunting recent marks returned matches as delivered, so later calls omit them. See the Labs API reference.

Command API operation Options
labs overview SHA256 GET /sample/{sha256}/overview --format json|toon|sarif
labs search query QUERY POST /search/query/run --page, --size, --date-from, --date-to
labs search results ID GET /search/query/{id}/results --format json|toon
labs hunting recent GET /hunting/matches/recent --items-count, --search-after
labs hunting rules list GET /hunting/yara-rules --search, repeatable --threat-category, --status active|paused
labs hunting rules create IDENTIFIER RULE POST /hunting/yara-rules repeatable required --threat-category, --active|--paused, --daily-notifications-limit
labs hunting rules get ID GET /hunting/yara-rules/{id} --format json|toon
labs hunting rules update ID POST /hunting/yara-rules/{id} --identifier, repeatable --threat-category, --active|--paused, --daily-notifications-limit, --rule, --reset-counter|--keep-counter
labs hunting rules delete ID DELETE /hunting/yara-rules/{id} --format json|toon

file-collection remains available for compatibility, but API v2 deprecated those endpoints and stopped supporting them after August 21, 2026; the service returns 410 Gone.


Python Library

Synchronous

from hybridanalysis import HybridAnalysisClient

with HybridAnalysisClient.from_env() as client:
    print(client.system.version())

    # Submit a file and poll its report
    submitted = client.submit.file("sample.exe", environment_id="160")
    job_id = submitted["job_id"]
    print(client.report.state(job_id))
    print(client.report.summary(job_id))

    # Download binary artifacts (returned as bytes)
    pcap = client.report.pcap(job_id)

    # Search (verdict is numeric 1-5, 5 = malicious)
    client.search.terms(filetype="peexe", verdict="5")

Asynchronous

import asyncio
from hybridanalysis import AsyncHybridAnalysisClient

async def main():
    async with AsyncHybridAnalysisClient.from_env() as client:
        print(await client.system.version())
        results = await asyncio.gather(*(client.overview.get(h) for h in hashes))

asyncio.run(main())

Errors raise subclasses of HybridAnalysisError: AuthenticationError, NotFoundError, RateLimitError, APIError, NetworkError, and ConfigError.


Requirements


Support the Project

If this project is useful in your workflows, you can support development:

Buy Me A Coffee

License

This project is licensed under the MIT license. See LICENSE.

Attribution


Built for practical malware analysis and security automation

Metadata

Release files for hybridanalysis 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hybridanalysis 0.2.0
File Size Uploaded Provenance Actions
hybridanalysis-0.2.0.tar.gz 32.7 kB With provenance Details for hybridanalysis-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hybridanalysis 0.2.0
File Interpreter ABI Platform Actions
hybridanalysis-0.2.0-py3-none-any.whl Python 3 none any Details for hybridanalysis-0.2.0-py3-none-any.whl

Total release size: 63.5 kB

Release files / hybridanalysis-0.2.0.tar.gz

Download URL hybridanalysis-0.2.0.tar.gz
Size 32.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3aef8df49aab24a2bd22c1068443a17eaedbf8777df6887ff0c63564c54b542c
BLAKE2b-256 checksum
How to use checksums
54cd56e867e6776a926d8741152c031711c89a6a655c2916081291b4d201b333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / hybridanalysis-0.2.0-py3-none-any.whl

Download URL hybridanalysis-0.2.0-py3-none-any.whl
Size 30.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e995067e46af79c65ce6f8bb1381efe45522ee5d35b9f80b6ae50def9c0f6610
BLAKE2b-256 checksum
How to use checksums
e436fba6a9fc80098f24bf307c7f7b27deca1ab4fa3702a47df5e35d65eb0141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Security for hybridanalysis 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hybridanalysis-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page