Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 60 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝
```
<p align="left">
<a href="https://github.com/lewiswigmore"><img src="https://img.shields.io/badge/GitHub-Follow%20on%20GitHub-inactive.svg?logo=github"></a>
<a href="https://github.com/lewiswigmore/virus.xcheck/releases"><img src="https://img.shields.io/github/v/release/lewiswigmore/virus.xcheck" alt="Version"></a>
<a href="https://github.com/lewiswigmore/virus.xcheck"><img src="https://img.shields.io/badge/python-3.8%2B-blue" alt="Python 3.8+"></a>
<a href="https://github.com/lewiswigmore/virus.xcheck/blob/main/LICENSE"><img src="https://img.shields.io/github/license/lewiswigmore/virus.xcheck" alt="License"></a>
<a href="https://github.com/lewiswigmore/virus.xcheck"><img src="https://img.shields.io/badge/GitHub-Follow%20on%20GitHub-inactive.svg?logo=github"></a>
</p>

## Overview
Expand All @@ -29,10 +32,27 @@ Virus.xcheck is a Python tool designed to check the existence of file hashes in

## Installation

### Using pip
Install the required packages using the provided requirements.txt file:
### From PyPI (Recommended)

```bash
pip install virusxcheck
```

### HTML Reports (Optional)

To generate interactive HTML reports, install with the report extra:

```bash
pip install virusxcheck[report]
```

This installs additional dependencies (plotly, pandas, jinja2) needed for HTML report generation.

### From Source

```bash
git clone https://github.com/lewiswigmore/virus.xcheck.git
cd virus.xcheck
pip install -r requirements.txt
```

Expand All @@ -44,36 +64,48 @@ pip install -r requirements.txt
```
Alternatively, you can use the `--save-config` option to set your keys interactively:
```bash
python virusxcheck.py --save-config
virusxcheck --save-config
```

## Quick Start

```bash
pip install virusxcheck
virusxcheck --save-config # Set up your API key
virusxcheck -s "sha256_hash_value" # Check a single hash
virusxcheck -f hashes.csv -o out.json --html report.html # Batch check with report
```

## Usage

> **Note:** After installing via `pip install virusxcheck`, you can use the `virusxcheck` command directly. If running from source, use `python virusxcheck.py` instead.

Execute the script from the command line with the following options:

### Check a single hash
```bash
python virusxcheck.py -s "hash_value"
virusxcheck -s "hash_value"
```

### Process multiple hashes from a CSV file
```bash
python virusxcheck.py -f /path/to/your/hashes.csv
virusxcheck -f /path/to/your/hashes.csv
```

### Save results to a file
```bash
python virusxcheck.py -f /path/to/hashes.csv -o /path/to/results.csv
python virusxcheck.py -s "hash_value" -o /path/to/results.json
virusxcheck -f /path/to/hashes.csv -o /path/to/results.csv
virusxcheck -s "hash_value" -o /path/to/results.json
```

### Generate HTML report
```bash
python virusxcheck.py -f /path/to/hashes.csv --html report.html
virusxcheck -f /path/to/hashes.csv --html report.html
```

### Disable colored output
```bash
python virusxcheck.py -s "hash_value" --no-color
virusxcheck -s "hash_value" --no-color
```

## Test Examples
Expand All @@ -88,7 +120,7 @@ d00853e592bccd823027e7e685d88c5a1f76a5a36ec5b7073d49ee633b050cc8
### Testing with Sample CSV
Create a file `test_hashes.csv` with the above hashes and run:
```bash
python virusxcheck.py -f test_hashes.csv --html results/report.html -o results/output.csv
virusxcheck -f test_hashes.csv --html results/report.html -o results/output.csv
```

### Sample Output
Expand Down Expand Up @@ -179,5 +211,22 @@ The CSV output includes columns for:
- VT First Seen
- VT Tags

## Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for a list of changes.

## Security

For security concerns, please see [SECURITY.md](SECURITY.md).

## License

This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.

## Disclaimer

This tool is for informational purposes only. Ensure you have the right to access and check the hashes against the database and always comply with the terms of service of the Virus Exchange and VirusTotal APIs.
17 changes: 12 additions & 5 deletions html_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@

import os
import json
import pandas as pd
import plotly.graph_objects as go
import plotly.io as pio
from plotly.subplots import make_subplots
from jinja2 import Environment, FileSystemLoader
from datetime import datetime

try:
import pandas as pd
import plotly.graph_objects as go
import plotly.io as pio
from plotly.subplots import make_subplots
from jinja2 import Environment, FileSystemLoader
except ImportError as e:
raise ImportError(
"HTML report generation requires additional dependencies. "
"Install them with: pip install virusxcheck[report]"
) from e

# Define HTML template
HTML_TEMPLATE = """<!DOCTYPE html>
<html>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ dependencies = [
"requests~=2.31",
"python-dotenv~=1.0",
"colorama~=0.4.6",
"plotly~=5.18",
"tqdm~=4.66",
"ratelimit~=2.2",
"tabulate~=0.9",
]

[project.optional-dependencies]
report = ["plotly~=5.18", "pandas", "jinja2"]
dev = ["pytest~=8.0"]

[project.urls]
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
requests~=2.31
python-dotenv~=1.0
colorama~=0.4.6
plotly~=5.18
tqdm~=4.66
ratelimit~=2.2
tabulate~=0.9
2 changes: 1 addition & 1 deletion virusxcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def main():
if args.html:
if not HTML_REPORTER_AVAILABLE:
print(f"{Fore.RED}Error: HTML report generation requires additional dependencies. Please install them using:")
print(f"pip install jinja2 plotly pandas{Style.RESET_ALL}")
print(f"pip install virusxcheck[report]{Style.RESET_ALL}")
if not args.output:
sys.exit(1)
else:
Expand Down
Loading