Skip to main content

MalSearch Tweet

Search for samples from various malware databases.

PyPi Read The Docs Build Status Security Coverage Status Python Versions License

This library communicates with the APIs of the following malware databases to download samples by hash and, for some of them, to get feeds of recent sample hashes:

Service Name in config Download by Feed Notes
ANY.RUN anyrun MD5, SHA1, SHA256 requires a TI Lookup license
AndroZoo androzoo SHA256 Android apps only ; API key granted on request
Hybrid Analysis hybridanalysis SHA256 ✓ downloading requires a vetted account
Joe Sandbox joesandbox MD5, SHA1, SHA256 downloading may require a Cloud Pro account
Koodous koodous SHA256 Android apps only ; no downloads with the free plan
Maldatabase maldatabase ✓
Malpedia malpedia MD5, SHA256
MalShare malshare MD5, SHA1, SHA256 ✓
Malware Bazaar malwarebazaar MD5, SHA1, SHA256 ✓ at most 2000 downloads per day
Malware-Feed malwarefeed SHA256 ✓ uses a GitHub token instead of an API key
MetaDefender metadefender MD5, SHA1, SHA256 ✓ downloads for malware exchange partners only
PolySwarm polyswarm MD5, SHA1, SHA256
SOREL-20M sorel20m SHA256 no API key ; Windows PE only (static dataset, 2020)
theZoo thezoo MD5, SHA1, SHA256 ✓ no API key ; first use indexes ~420 MB of archives
Triage triage MD5, SHA1, SHA256, SHA512
UnpacMe unpacme SHA256 ✓ paid plan ; monthly download limit ; supports -u
URLhaus urlhaus SHA256 ✓ same Auth-Key as the other abuse.ch services
VirusShare virusshare MD5, SHA1, SHA224, SHA256, SHA384, SHA512
VirusTotal virustotal MD5, SHA1, SHA256 downloading requires a premium API key ; supports -u

A service is only asked for the hash types it supports.

pip install malsearch

Usage

Configuration

MalSearch reads the API keys from an INI configuration file, by default ~/.malsearch.conf. Each key is set in the API keys section under the client's name from the table above; only the clients listed there are used, except a client named with --select, which gets a warning if its key is missing. SOREL-20M and theZoo need no key: list them with an empty value (sorel20m =, thezoo =) to use them.

theZoo only publishes the hashes of its archives, not of the samples inside. On first use, MalSearch downloads every archive listed in theZoo's maldb.db (about 420 MB, which takes several minutes) and builds an index of the sample hashes in the user cache directory (~/.cache/malsearch/thezoo.json on Linux). Later runs only download the archives that changed.

[API keys]
androzoo = YOUR-KEY
anyrun = YOUR-KEY
hybridanalysis = YOUR-KEY
joesandbox = YOUR-KEY
koodous = YOUR-TOKEN
maldatabase = YOUR-KEY
malpedia = YOUR-KEY
malshare = YOUR-KEY
malwarebazaar = YOUR-KEY
malwarefeed = YOUR-GITHUB-TOKEN
metadefender = YOUR-KEY
polyswarm = YOUR-KEY
sorel20m = 
thezoo = 
triage = YOUR-KEY
unpacme = YOUR-KEY
urlhaus = YOUR-KEY
virusshare = YOUR-KEY
virustotal = YOUR-KEY

When a service hits its rate limit or rejects its API key, MalSearch disables that client for a while. It records this in a Disabled section of the same file, with an expiration date (DD/MM/YYYY HH:MM:SS), and re-enables the client automatically once that date has passed. You can also add an entry yourself to disable a client temporarily. An entry whose value is not a date disables the client until you remove it.

Command line

# download a sample (MD5, SHA1, SHA224, SHA256, SHA384 or SHA512) to the current directory
malsearch 2037f9b7dd268eef7d2e950b27c6cf80e3ba692d262c785ab67b04dc71c99bf9

# only query some clients (or exclude some with --skip) ; put the hashes first, as --select and --skip take all
#  the names that follow them
malsearch 094fd325049b8a9cf6d3e5ef2a6d4cc6a567d7d49c35f8bb8dd9e3c6acf3d78d --select malwarebazaar virustotal

# download every hash from a newline-separated list into the "samples" folder, without the requests cache
malsearch -f hashes.txt -o samples --disable-cache

# download the latest samples published by the hash feeds
malsearch -m -o samples
Option Description
-f, --from-file FILE read hashes from a file (one per line)
-m, --from-malware-feed get hashes from the malware feeds
-c, --config FILE INI configuration file (default: ~/.malsearch.conf)
-o, --output-dir DIR output directory for downloaded samples (default: .)
--select NAME [NAME ...] only use the given clients
--skip NAME [NAME ...] do not use the given clients
-u, --unpacked also download the unpacked versions of a packed sample (VirusTotal, UnpacMe)
--disable-cache disable the requests cache (responses are otherwise cached for one day)
-v, --verbose display debug information

Each sample is saved under its hash as the filename, and samples that already exist in the output directory are skipped. For each hash, the clients are tried in turn until one returns the sample. Several hashes are downloaded in parallel, with a progress bar if tqdm is installed.

Python

The same features are available from Python. Unlike the command line, the functions below do not create the output directory, so make sure it exists first:

from malsearch import download_samples, get_samples_feed

# download samples, using the same options as on the command line
download_samples("2037f9b7dd268eef7d2e950b27c6cf80e3ba692d262c785ab67b04dc71c99bf9",
                 config="~/.malsearch.conf", output_dir="samples", select=["malwarebazaar", "virustotal"])

# iterate over the hashes from the malware feeds
for h in get_samples_feed(config="~/.malsearch.conf"):
    print(h)

You can also use a single client directly:

from malsearch import MalwareBazaar

MalwareBazaar(api_key="YOUR-KEY", output_dir="samples").get_file_by_hash("2037f9b7dd268eef7d2e950b27c6cf80e3ba692d262c785ab67b04dc71c99bf9")

Back to top

Metadata

Release files for malsearch 1.0.1

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

Source distribution (sdist)

Source distribution for malsearch 1.0.1
File Size Uploaded Provenance Actions
malsearch-1.0.1.tar.gz 146.6 kB With provenance Details for malsearch-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 204.4 kB

Release files / malsearch-1.0.1.tar.gz

Download URL malsearch-1.0.1.tar.gz
Size 146.6 kB
Tags Source
SHA-256 checksum
How to use checksums
51f1245de0af4061ec174290efe6da0f78d87060afe517a5bef1ba5453a1db1f
BLAKE2b-256 checksum
How to use checksums
3efd17dbeacabe96025f3aef46b156cae1b0257ab773b90302d588f5e27bf1e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 27, 2026.

Transparency log

Release files / malsearch-1.0.1-py3-none-any.whl

Download URL malsearch-1.0.1-py3-none-any.whl
Size 57.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4cbffb59a38e1e32641cd9ddffd1a69551b1ad973f3b5a9ad3143ca80cc5340
BLAKE2b-256 checksum
How to use checksums
099cfc67a7191b0c7808555ef6da2eb5b08150acfa8c56f5563d174b58953b38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 27, 2026.

Transparency log

Security for malsearch 1.0.1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for malsearch-1.0.1.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 27, 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