Skip to main content

cached-virustotal-api

A cached extension of the official Python client for VirusTotal.

Usage

Create the CachedClient like so:

from kfinny.cachedvt import CachedClient

client = CachedClient(<apikey>, cache_dir=<some folder>)

The folder does not need to exist, but if it does, it should be empty or a prior cache from this library. The cache is sqlite database created by DiskCache.

The client may be used just as it is documented by the vt-py project. The codebase "adds" a single function to the client API, yield_file_report and can take a list of hashes.

# yield_file_report
hashes = [<list of md5,sha1,sha256 hashes>]

for obj in client.yield_file_report(hashes):
    assert(obj.type == 'file')
    print(f'{obj.md5} : {obj.sha1} : {obj.sha256}')

Files not found on VirusTotal are not returned, but they are cached, since the whole point of this library is to conserve quota.

>>> hits, misses = client.cache.stats()
>>> reports = list(client.yield_file_report('abcd'*16))
>>> reports
[]
>>> _hits, _misses = client.cache.stats()
>>> assert(_misses - misses == 1)
>>>

Prior Versions

A previous version of this code worked with the virustotal-api last tested using this commit 551b87a.

Metadata

Release files for kfinny.cachedvt 3.1.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 kfinny.cachedvt 3.1.0
File Size Uploaded Provenance Actions
kfinny.cachedvt-3.1.0.tar.gz 3.2 kB Without provenance Details for kfinny.cachedvt-3.1.0.tar.gz

Release files / kfinny.cachedvt-3.1.0.tar.gz

Download URL kfinny.cachedvt-3.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
79d5163428c7fc84e23f0a0493d4ff649493a3b95aef53cc373d74f0dcd9b067
BLAKE2b-256 checksum
How to use checksums
afdd84096bdc14ea5f0a3a30a3141ca1f0f48a48ad56c17fc2e93b960c2673f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Security for kfinny.cachedvt 3.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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