Spaces:
Running
Running
Enhance IOC Core API with comprehensive API endpoints for hash, IP, and domain analysis, along with logging and exception handling.
Browse filesFiles changed (31)
- .dockerignore+65-3
- .env.exampleAdded+19
- .gitignore+67-1
- Dockerfile+36-9
- MakefileAdded+44
- README.md+215-1
- main.py+11-5
- pyproject.toml+13-1
- ruff.tomlAdded+26
- src/__init__.pyAdded+7
- src/api/__init__.pyAdded+27
- src/api/domain.pyAdded+151
- src/api/hash.pyAdded+172
- src/api/ip.pyAdded+219
- src/app.pyAdded+97
- src/config/__init__.pyAdded+5
- src/config/settings.pyAdded+46
- src/exceptions.pyAdded+45
- src/logging_config.pyAdded+47
- src/models/__init__.pyAdded+13
- src/models/domain.pyAdded+37
- src/models/hash.pyAdded+34
- src/models/ip.pyAdded+103
- src/services/__init__.pyAdded+6
- src/services/abuseipdb.pyAdded+95
- src/services/base.pyAdded+113
- src/services/virustotal.pyAdded+187
- src/utils/__init__.pyAdded+6
- src/utils/helpers.pyAdded+35
- src/utils/validators.pyAdded+47
- uv.lock+182
1234# Byte-compiled / optimized / DLL files__pycache__/.env123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566# Git.git.gitignore.gitattributes# CI/CD.github# Documentation*.mddocs/# Python__pycache__*.py[cod]*$py.class*.so.Python# Virtual environments.venvvenv/ENV/env/# Testing.pytest_cache/.coveragehtmlcov/.tox/tests/# IDEs.vscode/.idea/*.swp*.swo*~# Environment.env.env.local.env.*.local# Build artifactsbuild/dist/*.egg-info/# Logs*.loglogs/# Data filesinfo_files/ip_list.**.csv# OS.DS_StoreThumbs.db# Development toolsMakefilepytest.iniruff.toml
12345678910111213141516171819# IOC Core API - Environment Configuration# Copy this file to .env and fill in your actual values
# VirusTotal API Key# Get your API key from: https://www.virustotal.com/gui/my-apikeyVIRUS_TOTAL_API_KEY=your_virustotal_api_key_here
# AbuseIPDB API Key# Get your API key from: https://www.abuseipdb.com/account/apiABUSE_IP_DB_API_KEY=your_abuseipdb_api_key_here
# Server ConfigurationHOST=0.0.0.0PORT=8000RELOAD=true
# Logging Configuration# Options: DEBUG, INFO, WARNING, ERROR, CRITICALLOG_LEVEL=INFO1234# Byte-compiled / optimized / DLL files__pycache__/.env12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970# Byte-compiled / optimized / DLL files__pycache__/*.py[cod]*$py.class*.so# Distribution / packaging.Pythonbuild/develop-eggs/dist/downloads/eggs/.eggs/lib/lib64/parts/sdist/var/wheels/*.egg-info/.installed.cfg*.egg# Virtual environments.venv/venv/ENV/env/# Environment variables.env.env.local.env.*.local# IDEs.vscode/.idea/*.swp*.swo*~.DS_Store# Testing.pytest_cache/.coveragehtmlcov/.tox/# Logs*.loglogs/# Data files (keep examples, ignore actual data)info_files/*ip_list.**.csv!example_*.csv# Docker.dockerignore# Temporary files*.tmptemp/tmp/# OS filesThumbs.db.DS_Store
123456789101112131415161718FROM python:3.12-slim-trixieCOPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/RUN useradd -m -u 1000 userUSER userENV PATH="/home/user/.local/bin:$PATH"WORKDIR /appCOPY pyproject.toml pyproject.tomlRUN uv syncCOPY . .EXPOSE 8000CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]123456789101112131415161718192021222324252627282930313233343536373839404142434445# Multi-stage build for IOC Core APIFROM python:3.11-slim as builder# Install uvCOPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv# Set working directoryWORKDIR /app# Copy dependency filesCOPY pyproject.toml uv.lock ./# Install dependenciesRUN uv sync --frozen --no-dev# Production stageFROM python:3.11-slim# Set working directoryWORKDIR /app# Copy uv from builderCOPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv# Copy virtual environment from builderCOPY --from=builder /app/.venv /app/.venv# Copy application codeCOPY src/ ./src/COPY main.py ./# Set environment variablesENV PATH="/app/.venv/bin:$PATH"ENV PYTHONUNBUFFERED=1ENV PYTHONDONTWRITEBYTECODE=1# Expose portEXPOSE 8000# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/')" || exit 1# Run the applicationCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
1234567891011121314151617181920212223242526272829303132333435363738394041424344.PHONY: help install dev run test lint format clean docker-build docker-up docker-down
help: ## Show this help message @echo 'Usage: make [target]' @echo '' @echo 'Available targets:' @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
install: ## Install production dependencies uv sync --frozen
dev: ## Install development dependencies uv sync --frozen --all-extras
run: ## Run the application locally uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000
lint: ## Run linting checks uv run ruff check src/
format: ## Format code uv run ruff format src/
clean: ## Clean up generated files find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true find . -type f -name "*.pyc" -delete find . -type f -name "*.pyo" -delete find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true rm -rf build/ dist/ .coverage htmlcov/
docker-build: ## Build Docker image docker-compose build
docker-up: ## Start services with Docker Compose docker-compose up -d
docker-down: ## Stop services with Docker Compose docker-compose down
docker-logs: ## Show Docker logs docker-compose logs -f
check: lint ## Run all checks (lint)7 unmodified lines891011127 unmodified lineslicense: apache-2.0app_port: 8000---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference7 unmodified lines891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252267 unmodified lineslicense: apache-2.0app_port: 8000---# IOC Core API> Threat Intelligence API for analyzing Indicators of Compromise (IOCs) including file hashes, IP addresses, and domains.[](LICENSE)[](https://www.python.org/downloads/)[](https://fastapi.tiangolo.com)## 🚀 Features- **Multi-Provider Analysis**: Integrates with VirusTotal and AbuseIPDB for comprehensive threat intelligence- **Batch Processing**: Analyze multiple IOCs via CSV file upload- **RESTful API**: Clean, well-documented API endpoints with OpenAPI/Swagger support- **Export Capabilities**: Download analysis results as CSV files- **Production-Ready**: Includes Docker support, logging, error handling, and health checks- **Scalable Architecture**: Modular design with service layer, proper separation of concerns### Supported IOC Types- **File Hashes**: MD5, SHA1, SHA256- **IP Addresses**: IPv4 and IPv6- **Domains**: Full domain reputation analysis## 📋 Prerequisites- Python 3.10 or higher- [uv](https://github.com/astral-sh/uv) package manager- API Keys:- [VirusTotal API Key](https://www.virustotal.com/gui/my-apikey)- [AbuseIPDB API Key](https://www.abuseipdb.com/account/api)## 🛠️ Installation### Using uv (Recommended)```bash# Install uv if you haven't alreadycurl -LsSf https://astral.sh/uv/install.sh | sh# Clone the repositorygit clone <repository-url>cd ioc-core# Install dependenciesuv sync# Copy environment template and configurecp .env.example .env# Edit .env with your API keys```### Using Docker```bash# Copy environment templatecp .env.example .env# Edit .env with your API keys# Build and run with Docker Composedocker-compose up -d```## ⚙️ ConfigurationCreate a `.env` file in the project root with your API keys:```envVIRUS_TOTAL_API_KEY=your_virustotal_api_keyABUSE_IP_DB_API_KEY=your_abuseipdb_api_keyHOST=0.0.0.0PORT=8000LOG_LEVEL=INFO```## 🚦 Usage### Start the Server```bash# Using uvmake run# Or directlyuv run uvicorn main:app --reload --host 0.0.0.0 --port 8000# Using Dockerdocker-compose up -d```The API will be available at `http://localhost:8000`### API Documentation- **Swagger UI**: http://localhost:8000/docs- **ReDoc**: http://localhost:8000/redoc- **OpenAPI Schema**: http://localhost:8000/openapi.json### Example Requests#### Analyze File Hashes```bashcurl -X POST "http://localhost:8000/api/hash/analyze" \-H "Content-Type: multipart/form-data" \-F "file=@hashes.csv"```#### Analyze IP Addresses```bashcurl -X POST "http://localhost:8000/api/ip/analyze" \-H "Content-Type: multipart/form-data" \-F "file=@ips.csv"```#### Analyze Domains```bashcurl -X POST "http://localhost:8000/api/domain/analyze" \-H "Content-Type: multipart/form-data" \-F "file=@domains.csv"```## 📁 Project Structure```ioc-core/├── src/ # Application source code│ ├── api/ # API route handlers│ │ ├── hash.py # Hash analysis endpoints│ │ ├── ip.py # IP reputation endpoints│ │ └── domain.py # Domain analysis endpoints│ ├── models/ # Pydantic models│ │ ├── hash.py # Hash result models│ │ ├── ip.py # IP result models│ │ └── domain.py # Domain result models│ ├── services/ # External API integrations│ │ ├── base.py # Base service class│ │ ├── virustotal.py # VirusTotal service│ │ └── abuseipdb.py # AbuseIPDB service│ ├── utils/ # Utility functions│ │ ├── validators.py # Input validation│ │ └── helpers.py # Helper functions│ ├── config/ # Configuration management│ │ └── settings.py # App settings│ ├── app.py # FastAPI application factory│ ├── logging_config.py # Logging configuration│ └── exceptions.py # Custom exceptions├── tests/ # Test suite├── main.py # Application entry point├── Dockerfile # Docker configuration├── docker-compose.yml # Docker Compose setup├── pyproject.toml # Project metadata and dependencies├── Makefile # Development shortcuts└── CHANGELOG.md # Version history```## 🧪 Testing```bash# Run all testsmake test# Run with coverageuv run pytest tests/ -v --cov=src --cov-report=html```## 🔍 Code Quality```bash# Lint codemake lint# Format codemake format# Run all checksmake check```## 🐳 Docker Deployment## 📊 API Endpoints### Health Check- `GET /` - Service health check### Hash Analysis- `POST /api/hash/analyze` - Analyze file hashes from CSV- `POST /api/hash/export` - Export hash results to CSV### IP Reputation- `POST /api/ip/analyze` - Analyze IPs from CSV- `POST /api/ip/export` - Export IP results to CSV### Domain Analysis- `POST /api/domain/analyze` - Analyze domains from CSV- `POST /api/domain/export` - Export domain results to CSV## 🗺️ Roadmap- [ ] Rate limiting and request throttling- [ ] Database integration for historical tracking- [ ] User authentication and API key management- [ ] Caching layer for repeated queries- [ ] Additional threat intelligence providers- [ ] Async batch processing improvements- [ ] Webhooks for analysis completion- [ ] Advanced filtering and search## 📝 LicenseApache License 2.0
1234567from fastapi import FastAPIapp = FastAPI()@app.get("/")def health_check():return {"status": "ok"}12345678910111213"""IOC Core API - Main entry point.This module provides the entry point for running the application.The application logic is implemented in the src package."""from src.app import appif __name__ == "__main__":import uvicornuvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
3 unmodified lines45673 unmodified linesdescription = "Add your description here"readme = "README.md"requires-python = ">=3.10"dependencies = ["fastapi>=0.128.0", "uvicorn[standard]>=0.40.0"]3 unmodified lines456789101112131415161718193 unmodified linesdescription = "Add your description here"readme = "README.md"requires-python = ">=3.10"dependencies = ["fastapi>=0.128.0","pycountry>=24.6.1","python-dotenv>=1.2.1","python-multipart>=0.0.21","requests>=2.32.5","uvicorn[standard]>=0.40.0",][dependency-groups]dev = ["ruff>=0.14.11",]
1234567891011121314151617181920212223242526[lint]select = [ "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes "I", # isort "B", # flake8-bugbear "C4", # flake8-comprehensions "UP", # pyupgrade]ignore = [ "E501", # line too long - handled by formatter "B008", # do not perform function calls in argument defaults "C901", # too complex]
[lint.per-file-ignores]"__init__.py" = ["F401"]
[format]quote-style = "double"indent-style = "space"line-ending = "auto"
[lint.isort]known-first-party = ["src"]1234567"""IOC Core - Threat Intelligence API"""
__version__ = "1.0.0"__author__ = "IOC Core Team"__description__ = "Threat Intelligence API for analyzing hashes, IPs, and domains"123456789101112131415161718192021222324252627"""API routers and endpoints."""
from fastapi import APIRouter
from src.api import domain, hash, ip
def create_api_router() -> APIRouter: """ Create and configure the main API router with all sub-routers.
Returns: Configured APIRouter instance """ api_router = APIRouter(prefix="/api")
# Include sub-routers api_router.include_router(hash.router, prefix="/hash", tags=["Hash Analysis"]) api_router.include_router(ip.router, prefix="/ip", tags=["IP Reputation"]) api_router.include_router( domain.router, prefix="/domain", tags=["Domain Reputation"] )
return api_router
__all__ = ["create_api_router"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151"""API endpoints for domain reputation analysis."""
import csvimport ioimport logging
from fastapi import APIRouter, File, HTTPException, UploadFilefrom fastapi.responses import StreamingResponse
from src.exceptions import APIKeyMissingError, ExternalAPIErrorfrom src.models.domain import DomainResultfrom src.services import VirusTotalServicefrom src.utils.validators import validate_csv_file
logger = logging.getLogger(__name__)router = APIRouter()
@router.post("/analyze", response_model=list[DomainResult])async def analyze_domains(file: UploadFile = File(...)): """ Analyze domains from a CSV file using VirusTotal API.
The CSV file should contain one domain per line.
Args: file: CSV file containing domains
Returns: List of DomainResult objects with analysis results
Raises: HTTPException: If API key is missing or file format is invalid """ if not validate_csv_file(file.filename): raise HTTPException(status_code=400, detail="File must be a CSV")
try: vt_service = VirusTotalService() except APIKeyMissingError as e: logger.error(f"API key missing: {str(e)}") raise HTTPException(status_code=500, detail=str(e)) from e
try: # Read and parse CSV file content = await file.read() csv_wrapper = io.TextIOWrapper(io.BytesIO(content), encoding="utf-8") domains = [row[0].strip() for row in csv.reader(csv_wrapper) if row]
results = []
for domain in domains: logger.info(f"Analyzing domain: {domain}")
try: analysis = vt_service.analyze_domain(domain)
if not analysis.get("found"): results.append( DomainResult( domain=domain, error="Domain not found in VirusTotal database", ) ) continue
categories = analysis.get("categories", []) categories_str = ", ".join(categories) if categories else "N/A"
results.append( DomainResult( domain=domain, malicious_count=analysis.get("malicious_count"), suspicious_count=analysis.get("suspicious_count"), total_engines=analysis.get("total_engines"), reputation_score=analysis.get("reputation_score"), categories=categories_str, ) )
except ExternalAPIError as e: logger.error(f"VirusTotal error for domain {domain}: {str(e)}") results.append(DomainResult(domain=domain, error=str(e))) except Exception as e: logger.error(f"Unexpected error analyzing domain {domain}: {str(e)}") results.append( DomainResult(domain=domain, error=f"Analysis error: {str(e)}") )
return results
except Exception as e: logger.error(f"Error processing file: {str(e)}") raise HTTPException( status_code=500, detail=f"Error processing file: {str(e)}" ) from e finally: vt_service.close()
@router.post("/export")async def export_domain_results(results: list[DomainResult]): """ Export domain reputation results to CSV format.
Args: results: List of DomainResult objects to export
Returns: StreamingResponse with CSV file """ logger.info(f"Exporting {len(results)} domain results to CSV")
si = io.StringIO() cw = csv.writer(si)
# Write header cw.writerow( [ "Domain", "Malicious Count", "Suspicious Count", "Total Engines", "Reputation Score", "Categories", "Error", ] )
# Write data for result in results: cw.writerow( [ result.domain, result.malicious_count or "", result.suspicious_count or "", result.total_engines or "", result.reputation_score or "", result.categories or "", result.error or "", ] )
output = io.BytesIO(si.getvalue().encode("utf-8")) output.seek(0)
return StreamingResponse( output, media_type="text/csv", headers={"Content-Disposition": "attachment; filename=domain_reputation.csv"}, )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172"""API endpoints for hash analysis."""
import csvimport ioimport logging
from fastapi import APIRouter, File, HTTPException, UploadFilefrom fastapi.responses import StreamingResponse
from src.exceptions import APIKeyMissingError, ExternalAPIErrorfrom src.models.hash import HashResultfrom src.services import VirusTotalServicefrom src.utils.validators import HashType, validate_csv_file, validate_hash
logger = logging.getLogger(__name__)router = APIRouter()
@router.post("/analyze", response_model=list[HashResult])async def analyze_hashes(file: UploadFile = File(...)): """ Analyze file hashes from a CSV file using VirusTotal API.
The CSV file should contain one hash per line (SHA256, SHA1, or MD5).
Args: file: CSV file containing hashes
Returns: List of HashResult objects with analysis results
Raises: HTTPException: If API key is missing or file format is invalid """ if not validate_csv_file(file.filename): raise HTTPException(status_code=400, detail="File must be a CSV")
try: # Initialize VirusTotal service vt_service = VirusTotalService() except APIKeyMissingError as e: logger.error(f"API key missing: {str(e)}") raise HTTPException(status_code=500, detail=str(e)) from e
try: # Read and parse CSV file content = await file.read() csv_content = content.decode("utf-8-sig") reader = csv.reader(io.StringIO(csv_content))
results = []
for row in reader: if not row or len(row) != 1: results.append( HashResult( hash_value="Invalid row", error="Invalid CSV file format - each row must contain exactly one hash", ) ) continue
hash_value = row[0].strip() hash_type = validate_hash(hash_value)
if hash_type == HashType.INVALID: logger.warning(f"Invalid hash format: {hash_value}") results.append( HashResult( hash_value=hash_value, error="Invalid hash value - must be MD5 (32), SHA1 (40), or SHA256 (64) characters", ) ) continue
# Analyze hash with VirusTotal try: analysis = vt_service.analyze_file_hash(hash_value)
if not analysis.get("found"): results.append( HashResult( hash_value=hash_value, error="Hash not found in VirusTotal database", ) ) continue
malicious = analysis.get("malicious_count", 0) total = analysis.get("total_engines", 0) malicious_percentage = (malicious / total * 100) if total > 0 else 0
results.append( HashResult( hash_value=hash_value, md5_hash=analysis.get("md5"), malicious_percentage=round(malicious_percentage, 2), malicious=malicious > 0, ) )
except ExternalAPIError as e: logger.error(f"VirusTotal API error for hash {hash_value}: {str(e)}") results.append( HashResult( hash_value=hash_value, error=f"VirusTotal API error: {str(e)}" ) ) except Exception as e: logger.error(f"Unexpected error analyzing hash {hash_value}: {str(e)}") results.append( HashResult(hash_value=hash_value, error=f"Analysis error: {str(e)}") )
return results
except Exception as e: logger.error(f"Error processing file: {str(e)}") raise HTTPException( status_code=500, detail=f"Error processing file: {str(e)}" ) from e finally: vt_service.close()
@router.post("/export")async def export_hash_results(results: list[HashResult]): """ Export hash analysis results to CSV format.
Args: results: List of HashResult objects to export
Returns: StreamingResponse with CSV file """ logger.info(f"Exporting {len(results)} hash results to CSV")
si = io.StringIO() cw = csv.writer(si)
# Write header cw.writerow( ["Original Hash", "MD5 Hash", "Malicious Percentage", "Malicious", "Error"] )
# Write data for result in results: cw.writerow( [ result.hash_value, result.md5_hash or "", f"{result.malicious_percentage}%" if result.malicious_percentage is not None else "", "Yes" if result.malicious else "No" if result.malicious is not None else "", result.error or "", ] )
output = io.BytesIO(si.getvalue().encode("utf-8")) output.seek(0)
return StreamingResponse( output, media_type="text/csv", headers={"Content-Disposition": "attachment; filename=hash_results.csv"}, )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219"""API endpoints for IP reputation analysis."""
import csvimport ioimport logging
from fastapi import APIRouter, File, HTTPException, UploadFilefrom fastapi.responses import StreamingResponse
from src.exceptions import APIKeyMissingError, ExternalAPIErrorfrom src.models.ip import AbuseIPDBResult, IPReputationResult, VirusTotalIPResultfrom src.services import AbuseIPDBService, VirusTotalServicefrom src.utils.helpers import get_country_namefrom src.utils.validators import validate_csv_file
logger = logging.getLogger(__name__)router = APIRouter()
@router.post("/analyze", response_model=list[IPReputationResult])async def analyze_ips(file: UploadFile = File(...)): """ Analyze IP addresses from a CSV file using AbuseIPDB and VirusTotal APIs.
The CSV file should contain one IP address per line.
Args: file: CSV file containing IP addresses
Returns: List of IPReputationResult objects with analysis from both providers
Raises: HTTPException: If API keys are missing or file format is invalid """ if not validate_csv_file(file.filename): raise HTTPException(status_code=400, detail="File must be a CSV")
# Initialize services try: vt_service = VirusTotalService() abuseipdb_service = AbuseIPDBService() except APIKeyMissingError as e: logger.error(f"API key missing: {str(e)}") raise HTTPException( status_code=500, detail="Both AbuseIPDB and VirusTotal API keys are required", ) from e
try: # Read and parse CSV file content = await file.read() csv_content = content.decode("utf-8-sig") ips = [row.strip() for row in csv_content.split("\n") if row.strip()]
results = []
for ip in ips: logger.info(f"Analyzing IP: {ip}")
# Initialize result placeholders abuseipdb_result = None vt_result = None
# AbuseIPDB check try: abuseipdb_data = abuseipdb_service.check_ip(ip)
abuseipdb_result = AbuseIPDBResult( ip_address=ip, is_public=abuseipdb_data.get("is_public"), ip_version=abuseipdb_data.get("ip_version"), abuse_confidence_score=abuseipdb_data.get("abuse_confidence_score"), country_code=abuseipdb_data.get("country_code"), country_name=get_country_name( abuseipdb_data.get("country_code", "") ), usage_type=abuseipdb_data.get("usage_type"), isp=abuseipdb_data.get("isp"), domain=abuseipdb_data.get("domain"), hostnames=", ".join(abuseipdb_data.get("hostnames", [])), is_tor=abuseipdb_data.get("is_tor"), total_reports=abuseipdb_data.get("total_reports"), num_distinct_users=abuseipdb_data.get("num_distinct_users"), last_reported_at=abuseipdb_data.get("last_reported_at"), ) except ExternalAPIError as e: logger.error(f"AbuseIPDB error for {ip}: {str(e)}") abuseipdb_result = AbuseIPDBResult(ip_address=ip, error=str(e)) except Exception as e: logger.error(f"Unexpected AbuseIPDB error for {ip}: {str(e)}") abuseipdb_result = AbuseIPDBResult( ip_address=ip, error=f"AbuseIPDB error: {str(e)}" )
# VirusTotal check try: vt_data = vt_service.analyze_ip(ip)
if vt_data.get("found"): vt_result = VirusTotalIPResult( vt_ip_address=ip, vt_country=vt_data.get("country"), vt_malicious_count=vt_data.get("malicious_count"), vt_total_engines=vt_data.get("total_engines"), vt_reputation_score=vt_data.get("reputation_score"), ) else: vt_result = VirusTotalIPResult( vt_ip_address=ip, error="IP not found in VirusTotal database" ) except ExternalAPIError as e: logger.error(f"VirusTotal error for {ip}: {str(e)}") vt_result = VirusTotalIPResult(vt_ip_address=ip, error=str(e)) except Exception as e: logger.error(f"Unexpected VirusTotal error for {ip}: {str(e)}") vt_result = VirusTotalIPResult( vt_ip_address=ip, error=f"VirusTotal error: {str(e)}" )
# Append combined results if abuseipdb_result and vt_result: results.append( IPReputationResult(abuseipdb=abuseipdb_result, virustotal=vt_result) )
return results
except Exception as e: logger.error(f"Error processing file: {str(e)}") raise HTTPException( status_code=500, detail=f"Error processing file: {str(e)}" ) from e finally: vt_service.close() abuseipdb_service.close()
@router.post("/export")async def export_ip_results(results: list[IPReputationResult]): """ Export IP reputation results to CSV format.
Args: results: List of IPReputationResult objects to export
Returns: StreamingResponse with CSV file """ logger.info(f"Exporting {len(results)} IP results to CSV")
si = io.StringIO() cw = csv.writer(si)
# Write headers cw.writerow( [ "IP Address", "Is Public", "IP Version", "Abuse Confidence Score", "Country Code", "Country Name", "Usage Type", "ISP", "Domain", "Hostnames", "Is Tor", "Total Reports", "Num Distinct Users", "Last Reported At", "VT IP Address", "VT Country", "VT Malicious Count", "VT Total Engines", "VT Reputation Score", "AbuseIPDB Error", "VirusTotal Error", ] )
# Write data for result in results: abuseipdb = result.abuseipdb vt = result.virustotal cw.writerow( [ abuseipdb.ip_address, abuseipdb.is_public or "", abuseipdb.ip_version or "", abuseipdb.abuse_confidence_score or "", abuseipdb.country_code or "", abuseipdb.country_name or "", abuseipdb.usage_type or "", abuseipdb.isp or "", abuseipdb.domain or "", abuseipdb.hostnames or "", abuseipdb.is_tor or "", abuseipdb.total_reports or "", abuseipdb.num_distinct_users or "", abuseipdb.last_reported_at or "", vt.vt_ip_address, vt.vt_country or "", vt.vt_malicious_count or "", vt.vt_total_engines or "", vt.vt_reputation_score or "", abuseipdb.error or "", vt.error or "", ] )
output = io.BytesIO(si.getvalue().encode("utf-8")) output.seek(0)
return StreamingResponse( output, media_type="text/csv", headers={"Content-Disposition": "attachment; filename=ip_reputation.csv"}, )12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697"""Main FastAPI application factory and configuration."""
import loggingfrom contextlib import asynccontextmanager
from fastapi import FastAPIfrom fastapi.middleware.cors import CORSMiddleware
from src import __description__, __version__from src.api import create_api_routerfrom src.config import settingsfrom src.logging_config import setup_logging
logger = logging.getLogger(__name__)
@asynccontextmanagerasync def lifespan(app: FastAPI): """ Application lifespan manager.
Handles startup and shutdown events. """ # Startup logger.info(f"Starting IOC Core API v{__version__}")
# Log API key status api_keys = settings.validate_api_keys() logger.info(f"API Key Status: {api_keys}")
if not all(api_keys.values()): logger.warning("Some API keys are not configured. Some endpoints may not work.")
yield
# Shutdown logger.info("Shutting down IOC Core API")
def create_app() -> FastAPI: """ Create and configure the FastAPI application.
Returns: Configured FastAPI application instance """ # Setup logging setup_logging()
# Create FastAPI app app = FastAPI( title=settings.APP_NAME, description=__description__, version=__version__, lifespan=lifespan, docs_url="/docs", redoc_url="/redoc", openapi_url="/openapi.json", )
# Add CORS middleware app.add_middleware( CORSMiddleware, allow_origins=["*"], # Configure appropriately for production allow_credentials=True, allow_methods=["*"], allow_headers=["*"], )
# Health check endpoint @app.get("/", tags=["Health"]) async def health_check(): """ Health check endpoint to verify API is running.
Returns: Status information including version and API key configuration """ api_keys = settings.validate_api_keys() return { "status": "ok", "message": "IOC Core API is running", "version": __version__, "api_keys_configured": api_keys, }
# Include API routers api_router = create_api_router() app.include_router(api_router)
logger.info("FastAPI application created successfully")
return app
# Create app instanceapp = create_app()12345"""Configuration management module."""
from src.config.settings import settings
__all__ = ["settings"]12345678910111213141516171819202122232425262728293031323334353637383940414243444546"""Application settings and configuration."""
import os
from dotenv import load_dotenv
# Load environment variablesload_dotenv()
class Settings: """Application settings with environment variable support."""
# API Information APP_NAME: str = "IOC Core API" APP_DESCRIPTION: str = ( "Threat Intelligence API for analyzing hashes, IPs, and domains" ) VERSION: str = "1.0.0"
# API Keys ABUSE_IP_DB_API_KEY: str | None = os.getenv("ABUSE_IP_DB_API_KEY") VIRUS_TOTAL_API_KEY: str | None = os.getenv("VIRUS_TOTAL_API_KEY")
# API Configuration REQUEST_TIMEOUT: int = 30 MAX_AGE_IN_DAYS: int = 365
# Server Configuration HOST: str = os.getenv("HOST", "0.0.0.0") PORT: int = int(os.getenv("PORT", "8000")) RELOAD: bool = os.getenv("RELOAD", "true").lower() == "true"
# Logging LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
def validate_api_keys(self) -> dict[str, bool]: """Check which API keys are configured.""" return { "abuse_ip_db": bool(self.ABUSE_IP_DB_API_KEY), "virus_total": bool(self.VIRUS_TOTAL_API_KEY), }
# Global settings instancesettings = Settings()123456789101112131415161718192021222324252627282930313233343536373839404142434445"""Custom exception classes for IOC Core."""
class IOCCoreException(Exception): """Base exception for IOC Core."""
pass
class APIKeyMissingError(IOCCoreException): """Raised when required API key is not configured."""
def __init__(self, provider: str): self.provider = provider super().__init__(f"{provider} API key not configured")
class InvalidFileFormatError(IOCCoreException): """Raised when uploaded file has invalid format."""
def __init__(self, expected_format: str): self.expected_format = expected_format super().__init__(f"Invalid file format. Expected: {expected_format}")
class InvalidHashError(IOCCoreException): """Raised when hash value is invalid."""
def __init__(self, hash_value: str): self.hash_value = hash_value super().__init__(f"Invalid hash value: {hash_value}")
class ExternalAPIError(IOCCoreException): """Raised when external API call fails."""
def __init__(self, provider: str, status_code: int = None, message: str = None): self.provider = provider self.status_code = status_code error_msg = f"{provider} API error" if status_code: error_msg += f" (status: {status_code})" if message: error_msg += f": {message}" super().__init__(error_msg)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647"""Logging configuration for the application."""
import loggingimport sys
from src.config import settings
def setup_logging(log_level: str | None = None) -> None: """ Configure application-wide logging.
Args: log_level: Optional log level override (defaults to settings.LOG_LEVEL) """ log_level = log_level or settings.LOG_LEVEL
# Convert string to logging level numeric_level = getattr(logging, log_level.upper(), logging.INFO)
# Create formatter formatter = logging.Formatter( fmt="%(asctime)s - %(name)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S", )
# Configure root logger root_logger = logging.getLogger() root_logger.setLevel(numeric_level)
# Remove existing handlers for handler in root_logger.handlers[:]: root_logger.removeHandler(handler)
# Console handler console_handler = logging.StreamHandler(sys.stdout) console_handler.setLevel(numeric_level) console_handler.setFormatter(formatter) root_logger.addHandler(console_handler)
# Set logging level for third-party libraries logging.getLogger("uvicorn").setLevel(logging.INFO) logging.getLogger("fastapi").setLevel(logging.INFO) logging.getLogger("requests").setLevel(logging.WARNING) logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.info(f"Logging configured with level: {log_level}")12345678910111213"""Pydantic models for API requests and responses."""
from src.models.domain import DomainResultfrom src.models.hash import HashResultfrom src.models.ip import AbuseIPDBResult, IPReputationResult, VirusTotalIPResult
__all__ = [ "HashResult", "AbuseIPDBResult", "VirusTotalIPResult", "IPReputationResult", "DomainResult",]12345678910111213141516171819202122232425262728293031323334353637"""Pydantic models for domain reputation analysis."""
from pydantic import BaseModel, Field
class DomainResult(BaseModel): """Result model for domain reputation analysis."""
domain: str = Field(..., description="Domain name analyzed") malicious_count: int | None = Field( None, description="Number of engines flagging as malicious", ge=0 ) suspicious_count: int | None = Field( None, description="Number of engines flagging as suspicious", ge=0 ) total_engines: int | None = Field( None, description="Total number of engines that scanned", ge=0 ) reputation_score: int | None = Field( None, description="VirusTotal reputation score" ) categories: str | None = Field(None, description="Domain categories") error: str | None = Field(None, description="Error message if analysis failed")
class Config: json_schema_extra = { "example": { "domain": "google.com", "malicious_count": 0, "suspicious_count": 0, "total_engines": 95, "reputation_score": 100, "categories": "search engines, technology", "error": None, } }12345678910111213141516171819202122232425262728293031323334"""Pydantic models for hash analysis."""
from pydantic import BaseModel, Field
class HashResult(BaseModel): """Result model for hash analysis."""
hash_value: str = Field( ..., description="Original hash value submitted for analysis" ) md5_hash: str | None = Field(None, description="MD5 hash of the file") malicious_percentage: float | None = Field( None, description="Percentage of engines that flagged as malicious", ge=0, le=100, ) malicious: bool | None = Field( None, description="Whether the file is considered malicious" ) error: str | None = Field(None, description="Error message if analysis failed")
class Config: json_schema_extra = { "example": { "hash_value": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "md5_hash": "d41d8cd98f00b204e9800998ecf8427e", "malicious_percentage": 15.5, "malicious": True, "error": None, } }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103"""Pydantic models for IP reputation analysis."""
from pydantic import BaseModel, Field
class AbuseIPDBResult(BaseModel): """Result model for AbuseIPDB IP analysis."""
ip_address: str = Field(..., description="IP address analyzed") is_public: bool | None = Field(None, description="Whether the IP is public") ip_version: int | None = Field(None, description="IP version (4 or 6)") abuse_confidence_score: int | None = Field( None, description="Abuse confidence score (0-100)", ge=0, le=100 ) country_code: str | None = Field(None, description="Two-letter country code") country_name: str | None = Field(None, description="Full country name") usage_type: str | None = Field(None, description="Usage type of the IP") isp: str | None = Field(None, description="Internet Service Provider") domain: str | None = Field(None, description="Domain associated with the IP") hostnames: str | None = Field( None, description="Hostnames associated with the IP" ) is_tor: bool | None = Field( None, description="Whether the IP is a Tor exit node" ) total_reports: int | None = Field( None, description="Total number of abuse reports" ) num_distinct_users: int | None = Field( None, description="Number of distinct users who reported" ) last_reported_at: str | None = Field( None, description="Timestamp of last report" ) error: str | None = Field(None, description="Error message if analysis failed")
class Config: json_schema_extra = { "example": { "ip_address": "8.8.8.8", "is_public": True, "ip_version": 4, "abuse_confidence_score": 0, "country_code": "US", "country_name": "United States", "usage_type": "Data Center/Web Hosting/Transit", "isp": "Google LLC", "domain": "google.com", "hostnames": "dns.google", "is_tor": False, "total_reports": 0, "num_distinct_users": 0, "last_reported_at": None, "error": None, } }
class VirusTotalIPResult(BaseModel): """Result model for VirusTotal IP analysis."""
vt_ip_address: str = Field(..., description="IP address analyzed") vt_country: str | None = Field(None, description="Country code from VirusTotal") vt_malicious_count: int | None = Field( None, description="Number of engines flagging as malicious", ge=0 ) vt_total_engines: int | None = Field( None, description="Total number of engines that scanned", ge=0 ) vt_reputation_score: int | None = Field( None, description="VirusTotal reputation score" ) error: str | None = Field(None, description="Error message if analysis failed")
class Config: json_schema_extra = { "example": { "vt_ip_address": "8.8.8.8", "vt_country": "US", "vt_malicious_count": 0, "vt_total_engines": 85, "vt_reputation_score": 100, "error": None, } }
class IPReputationResult(BaseModel): """Combined IP reputation result from multiple sources."""
abuseipdb: AbuseIPDBResult = Field(..., description="AbuseIPDB analysis results") virustotal: VirusTotalIPResult = Field( ..., description="VirusTotal analysis results" )
class Config: json_schema_extra = { "example": { "abuseipdb": AbuseIPDBResult.Config.json_schema_extra["example"], "virustotal": VirusTotalIPResult.Config.json_schema_extra["example"], } }123456"""Service layer for threat intelligence providers."""
from src.services.abuseipdb import AbuseIPDBServicefrom src.services.virustotal import VirusTotalService
__all__ = ["VirusTotalService", "AbuseIPDBService"]1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495"""AbuseIPDB threat intelligence service."""
import loggingfrom typing import Any
from src.config import settingsfrom src.exceptions import APIKeyMissingError, ExternalAPIErrorfrom src.services.base import BaseThreatIntelService
logger = logging.getLogger(__name__)
class AbuseIPDBService(BaseThreatIntelService): """Service for interacting with AbuseIPDB API v2."""
def __init__(self, api_key: str | None = None): """ Initialize AbuseIPDB service.
Args: api_key: AbuseIPDB API key (defaults to settings) """ api_key = api_key or settings.ABUSE_IP_DB_API_KEY if not api_key: raise APIKeyMissingError("AbuseIPDB")
super().__init__(api_key=api_key)
@property def provider_name(self) -> str: return "AbuseIPDB"
@property def base_url(self) -> str: return "https://api.abuseipdb.com/api/v2"
def _get_headers(self) -> dict[str, str]: """Get headers with API key for AbuseIPDB.""" return {"Key": self.api_key, "Accept": "application/json"}
def check_ip(self, ip_address: str, max_age_days: int = None) -> dict[str, Any]: """ Check an IP address for abuse reports.
Args: ip_address: IP address to check max_age_days: Maximum age of reports in days (defaults to settings)
Returns: Dictionary containing IP analysis results
Raises: ExternalAPIError: If the API request fails """ logger.info(f"Checking IP on AbuseIPDB: {ip_address}")
max_age_days = max_age_days or settings.MAX_AGE_IN_DAYS
response = self._make_request( method="GET", endpoint="check", headers=self._get_headers(), params={ "ipAddress": ip_address, "maxAgeInDays": max_age_days, "verbose": "", }, )
if response.status_code != 200: raise ExternalAPIError( self.provider_name, status_code=response.status_code, message=response.text, )
response_data = response.json() data = response_data.get("data", {})
return { "ip": ip_address, "is_public": data.get("isPublic", False), "ip_version": data.get("ipVersion"), "is_whitelisted": data.get("isWhitelisted", False), "abuse_confidence_score": data.get("abuseConfidenceScore", 0), "country_code": data.get("countryCode"), "usage_type": data.get("usageType"), "isp": data.get("isp"), "domain": data.get("domain"), "hostnames": data.get("hostnames", []), "is_tor": data.get("isTor", False), "total_reports": data.get("totalReports", 0), "num_distinct_users": data.get("numDistinctUsers", 0), "last_reported_at": data.get("lastReportedAt"), }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113"""Base service class for threat intelligence providers."""
import loggingfrom abc import ABC, abstractmethodfrom typing import Any
import requests
from src.config import settingsfrom src.exceptions import ExternalAPIError
logger = logging.getLogger(__name__)
class BaseThreatIntelService(ABC): """ Abstract base class for threat intelligence service providers.
Provides common functionality for making HTTP requests with error handling, logging, and retries. """
def __init__(self, api_key: str | None = None, timeout: int = None): """ Initialize the service.
Args: api_key: API key for the service timeout: Request timeout in seconds """ self.api_key = api_key self.timeout = timeout or settings.REQUEST_TIMEOUT self.session = requests.Session()
@property @abstractmethod def provider_name(self) -> str: """Name of the threat intelligence provider.""" pass
@property @abstractmethod def base_url(self) -> str: """Base URL for the API.""" pass
def _make_request( self, method: str, endpoint: str, headers: dict[str, str] | None = None, params: dict[str, Any] | None = None, **kwargs, ) -> requests.Response: """ Make an HTTP request to the API.
Args: method: HTTP method (GET, POST, etc.) endpoint: API endpoint (will be appended to base_url) headers: Optional request headers params: Optional query parameters **kwargs: Additional arguments to pass to requests
Returns: Response object
Raises: ExternalAPIError: If the request fails """ url = f"{self.base_url}/{endpoint.lstrip('/')}"
try: logger.debug(f"Making {method} request to {url}") response = self.session.request( method=method, url=url, headers=headers, params=params, timeout=self.timeout, **kwargs, )
logger.debug(f"Received response with status code: {response.status_code}") return response
except requests.exceptions.Timeout as e: logger.error(f"{self.provider_name} request timeout: {str(e)}") raise ExternalAPIError(self.provider_name, message="Request timeout") from e except requests.exceptions.RequestException as e: logger.error(f"{self.provider_name} request failed: {str(e)}") raise ExternalAPIError(self.provider_name, message=str(e)) from e
def _get_headers(self) -> dict[str, str]: """ Get default headers for requests.
Returns: Dictionary of headers """ return {}
def close(self): """Close the requests session.""" self.session.close()
def __enter__(self): """Context manager entry.""" return self
def __exit__(self, exc_type, exc_val, exc_tb): """Context manager exit.""" self.close()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187"""VirusTotal threat intelligence service."""
import loggingfrom typing import Any
from src.config import settingsfrom src.exceptions import APIKeyMissingError, ExternalAPIErrorfrom src.services.base import BaseThreatIntelService
logger = logging.getLogger(__name__)
class VirusTotalService(BaseThreatIntelService): """Service for interacting with VirusTotal API v3."""
def __init__(self, api_key: str | None = None): """ Initialize VirusTotal service.
Args: api_key: VirusTotal API key (defaults to settings) """ api_key = api_key or settings.VIRUS_TOTAL_API_KEY if not api_key: raise APIKeyMissingError("VirusTotal")
super().__init__(api_key=api_key)
@property def provider_name(self) -> str: return "VirusTotal"
@property def base_url(self) -> str: return "https://www.virustotal.com/api/v3"
def _get_headers(self) -> dict[str, str]: """Get headers with API key for VirusTotal.""" return {"x-apikey": self.api_key}
def analyze_file_hash(self, hash_value: str) -> dict[str, Any]: """ Analyze a file hash using VirusTotal.
Args: hash_value: File hash (MD5, SHA1, or SHA256)
Returns: Dictionary containing analysis results
Raises: ExternalAPIError: If the API request fails """ logger.info(f"Analyzing hash: {hash_value}")
response = self._make_request( method="GET", endpoint=f"files/{hash_value}", headers=self._get_headers() )
if response.status_code == 404: logger.warning(f"Hash not found in VirusTotal: {hash_value}") return {"found": False, "hash": hash_value}
if response.status_code != 200: raise ExternalAPIError( self.provider_name, status_code=response.status_code, message=response.text, )
data = response.json() attributes = data.get("data", {}).get("attributes", {}) stats = attributes.get("last_analysis_stats", {})
return { "found": True, "hash": hash_value, "md5": attributes.get("md5"), "sha1": attributes.get("sha1"), "sha256": attributes.get("sha256"), "malicious_count": stats.get("malicious", 0), "suspicious_count": stats.get("suspicious", 0), "undetected_count": stats.get("undetected", 0), "harmless_count": stats.get("harmless", 0), "total_engines": sum(stats.values()), "file_type": attributes.get("type_description"), "size": attributes.get("size"), }
def analyze_ip(self, ip_address: str) -> dict[str, Any]: """ Analyze an IP address using VirusTotal.
Args: ip_address: IP address to analyze
Returns: Dictionary containing analysis results
Raises: ExternalAPIError: If the API request fails """ logger.info(f"Analyzing IP: {ip_address}")
response = self._make_request( method="GET", endpoint=f"ip_addresses/{ip_address}", headers=self._get_headers(), )
if response.status_code == 404: logger.warning(f"IP not found in VirusTotal: {ip_address}") return {"found": False, "ip": ip_address}
if response.status_code != 200: raise ExternalAPIError( self.provider_name, status_code=response.status_code, message=response.text, )
data = response.json() attributes = data.get("data", {}).get("attributes", {}) stats = attributes.get("last_analysis_stats", {})
return { "found": True, "ip": ip_address, "country": attributes.get("country"), "malicious_count": stats.get("malicious", 0), "suspicious_count": stats.get("suspicious", 0), "undetected_count": stats.get("undetected", 0), "harmless_count": stats.get("harmless", 0), "total_engines": sum(stats.values()), "reputation_score": attributes.get("reputation", 0), "as_owner": attributes.get("as_owner"), "network": attributes.get("network"), }
def analyze_domain(self, domain: str) -> dict[str, Any]: """ Analyze a domain using VirusTotal.
Args: domain: Domain name to analyze
Returns: Dictionary containing analysis results
Raises: ExternalAPIError: If the API request fails """ logger.info(f"Analyzing domain: {domain}")
response = self._make_request( method="GET", endpoint=f"domains/{domain}", headers=self._get_headers() )
if response.status_code == 404: logger.warning(f"Domain not found in VirusTotal: {domain}") return {"found": False, "domain": domain}
if response.status_code != 200: raise ExternalAPIError( self.provider_name, status_code=response.status_code, message=response.text, )
data = response.json() attributes = data.get("data", {}).get("attributes", {}) stats = attributes.get("last_analysis_stats", {}) categories = attributes.get("categories", {})
return { "found": True, "domain": domain, "malicious_count": stats.get("malicious", 0), "suspicious_count": stats.get("suspicious", 0), "undetected_count": stats.get("undetected", 0), "harmless_count": stats.get("harmless", 0), "total_engines": sum(stats.values()), "reputation_score": attributes.get("reputation", 0), "categories": list(categories.values()) if categories else [], "creation_date": attributes.get("creation_date"), "last_modification_date": attributes.get("last_modification_date"), }123456"""Utility functions and helpers."""
from src.utils.helpers import get_country_namefrom src.utils.validators import HashType, validate_hash
__all__ = ["validate_hash", "HashType", "get_country_name"]1234567891011121314151617181920212223242526272829303132333435"""Helper utility functions."""
import pycountry
def get_country_name(country_code: str) -> str: """ Convert ISO country code to full country name.
Args: country_code: Two-letter ISO country code (e.g., 'US')
Returns: Full country name or the original code if not found """ try: country = pycountry.countries.get(alpha_2=country_code) return country.name if country else country_code except (KeyError, AttributeError): return country_code
def format_percentage(value: float, decimals: int = 2) -> float: """ Format a percentage value to specified decimal places.
Args: value: The percentage value decimals: Number of decimal places (default: 2)
Returns: Formatted percentage value """ return round(value, decimals)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647"""Validation utilities for IOCs."""
from enum import Enum
class HashType(str, Enum): """Supported hash types."""
SHA256 = "SHA256" SHA1 = "SHA1" MD5 = "MD5" INVALID = "INVALID"
def validate_hash(hash_value: str) -> HashType: """ Validate and identify hash type based on length.
Args: hash_value: The hash string to validate
Returns: HashType enum indicating the type of hash """ hash_length = len(hash_value.strip())
if hash_length == 64: return HashType.SHA256 elif hash_length == 40: return HashType.SHA1 elif hash_length == 32: return HashType.MD5 else: return HashType.INVALID
def validate_csv_file(filename: str) -> bool: """ Validate that a file is a CSV.
Args: filename: Name of the file to validate
Returns: True if the file is a CSV, False otherwise """ return filename.lower().endswith(".csv")33 unmodified lines343536373839109 unmodified lines149150151152153154155156157158159160161162163128 unmodified lines29229329429529629758 unmodified lines35635735835936036128 unmodified lines39039139239339439533 unmodified lines{ url = "https://files.pythonhosted.org/packages/38/0e/27be9fdef66e72d64c0cdc3cc2823101b80585f8119b5c112c2e8f5f7dab/anyio-4.12.1-py3-none-any.whl", hash = "sha256:d405828884fc140aa80a3c667b8beed277f1dfedec42ba031bd6ac3db606ab6c", size = 113592 },][[package]]name = "click"version = "8.3.1"109 unmodified linessource = { virtual = "." }dependencies = [{ name = "fastapi" },{ name = "uvicorn", extra = ["standard"] },][package.metadata]requires-dist = [{ name = "fastapi", specifier = ">=0.128.0" },{ name = "uvicorn", extras = ["standard"], specifier = ">=0.40.0" },][[package]]name = "pydantic"version = "2.12.5"128 unmodified lines{ url = "https://files.pythonhosted.org/packages/14/1b/a298b06749107c305e1fe0f814c6c74aea7b2f1e10989cb30f544a1b3253/python_dotenv-1.2.1-py3-none-any.whl", hash = "sha256:b81ee9561e9ca4004139c6cbba3a238c32b03e4894671e181b671e8cb8425d61", size = 21230 },][[package]]name = "pyyaml"version = "6.0.3"58 unmodified lines{ url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341 },][[package]]name = "starlette"version = "0.50.0"28 unmodified lines{ url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611 },][[package]]name = "uvicorn"version = "0.40.0"33 unmodified lines343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137109 unmodified lines247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286128 unmodified lines41541641741841942042142242342442542642742842958 unmodified lines48848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353428 unmodified lines56356456556656756856957057157257357457557657733 unmodified lines{ url = "https://files.pythonhosted.org/packages/38/0e/27be9fdef66e72d64c0cdc3cc2823101b80585f8119b5c112c2e8f5f7dab/anyio-4.12.1-py3-none-any.whl", hash = "sha256:d405828884fc140aa80a3c667b8beed277f1dfedec42ba031bd6ac3db606ab6c", size = 113592 },][[package]]name = "certifi"version = "2026.1.4"source = { registry = "https://pypi.org/simple" }sdist = { url = "https://files.pythonhosted.org/packages/e0/2d/a891ca51311197f6ad14a7ef42e2399f36cf2f9bd44752b3dc4eab60fdc5/certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120", size = 154268 }wheels = [{ url = "https://files.pythonhosted.org/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900 },][[package]]name = "charset-normalizer"version = "3.4.4"source = { registry = "https://pypi.org/simple" }sdist = { url = "https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz", hash = "sha256:94537985111c35f28720e43603b8e7b43a6ecfb2ce1d3058bbe955b73404e21a", size = 129418 }wheels = [{ url = "https://files.pythonhosted.org/packages/1f/b8/6d51fc1d52cbd52cd4ccedd5b5b2f0f6a11bbf6765c782298b0f3e808541/charset_normalizer-3.4.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e824f1492727fa856dd6eda4f7cee25f8518a12f3c4a56a74e8095695089cf6d", size = 209709 },{ url = "https://files.pythonhosted.org/packages/5c/af/1f9d7f7faafe2ddfb6f72a2e07a548a629c61ad510fe60f9630309908fef/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4bd5d4137d500351a30687c2d3971758aac9a19208fc110ccb9d7188fbe709e8", size = 148814 },{ url = "https://files.pythonhosted.org/packages/79/3d/f2e3ac2bbc056ca0c204298ea4e3d9db9b4afe437812638759db2c976b5f/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:027f6de494925c0ab2a55eab46ae5129951638a49a34d87f4c3eda90f696b4ad", size = 144467 },{ url = "https://files.pythonhosted.org/packages/ec/85/1bf997003815e60d57de7bd972c57dc6950446a3e4ccac43bc3070721856/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f820802628d2694cb7e56db99213f930856014862f3fd943d290ea8438d07ca8", size = 162280 },{ url = "https://files.pythonhosted.org/packages/3e/8e/6aa1952f56b192f54921c436b87f2aaf7c7a7c3d0d1a765547d64fd83c13/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:798d75d81754988d2565bff1b97ba5a44411867c0cf32b77a7e8f8d84796b10d", size = 159454 },{ url = "https://files.pythonhosted.org/packages/36/3b/60cbd1f8e93aa25d1c669c649b7a655b0b5fb4c571858910ea9332678558/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9d1bb833febdff5c8927f922386db610b49db6e0d4f4ee29601d71e7c2694313", size = 153609 },{ url = "https://files.pythonhosted.org/packages/64/91/6a13396948b8fd3c4b4fd5bc74d045f5637d78c9675585e8e9fbe5636554/charset_normalizer-3.4.4-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9cd98cdc06614a2f768d2b7286d66805f94c48cde050acdbbb7db2600ab3197e", size = 151849 },{ url = "https://files.pythonhosted.org/packages/b7/7a/59482e28b9981d105691e968c544cc0df3b7d6133152fb3dcdc8f135da7a/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:077fbb858e903c73f6c9db43374fd213b0b6a778106bc7032446a8e8b5b38b93", size = 151586 },{ url = "https://files.pythonhosted.org/packages/92/59/f64ef6a1c4bdd2baf892b04cd78792ed8684fbc48d4c2afe467d96b4df57/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:244bfb999c71b35de57821b8ea746b24e863398194a4014e4c76adc2bbdfeff0", size = 145290 },{ url = "https://files.pythonhosted.org/packages/6b/63/3bf9f279ddfa641ffa1962b0db6a57a9c294361cc2f5fcac997049a00e9c/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:64b55f9dce520635f018f907ff1b0df1fdc31f2795a922fb49dd14fbcdf48c84", size = 163663 },{ url = "https://files.pythonhosted.org/packages/ed/09/c9e38fc8fa9e0849b172b581fd9803bdf6e694041127933934184e19f8c3/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:faa3a41b2b66b6e50f84ae4a68c64fcd0c44355741c6374813a800cd6695db9e", size = 151964 },{ url = "https://files.pythonhosted.org/packages/d2/d1/d28b747e512d0da79d8b6a1ac18b7ab2ecfd81b2944c4c710e166d8dd09c/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:6515f3182dbe4ea06ced2d9e8666d97b46ef4c75e326b79bb624110f122551db", size = 161064 },{ url = "https://files.pythonhosted.org/packages/bb/9a/31d62b611d901c3b9e5500c36aab0ff5eb442043fb3a1c254200d3d397d9/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:cc00f04ed596e9dc0da42ed17ac5e596c6ccba999ba6bd92b0e0aef2f170f2d6", size = 155015 },{ url = "https://files.pythonhosted.org/packages/1f/f3/107e008fa2bff0c8b9319584174418e5e5285fef32f79d8ee6a430d0039c/charset_normalizer-3.4.4-cp310-cp310-win32.whl", hash = "sha256:f34be2938726fc13801220747472850852fe6b1ea75869a048d6f896838c896f", size = 99792 },{ url = "https://files.pythonhosted.org/packages/eb/66/e396e8a408843337d7315bab30dbf106c38966f1819f123257f5520f8a96/charset_normalizer-3.4.4-cp310-cp310-win_amd64.whl", hash = "sha256:a61900df84c667873b292c3de315a786dd8dac506704dea57bc957bd31e22c7d", size = 107198 },{ url = "https://files.pythonhosted.org/packages/b5/58/01b4f815bf0312704c267f2ccb6e5d42bcc7752340cd487bc9f8c3710597/charset_normalizer-3.4.4-cp310-cp310-win_arm64.whl", hash = "sha256:cead0978fc57397645f12578bfd2d5ea9138ea0fac82b2f63f7f7c6877986a69", size = 100262 },{ url = "https://files.pythonhosted.org/packages/ed/27/c6491ff4954e58a10f69ad90aca8a1b6fe9c5d3c6f380907af3c37435b59/charset_normalizer-3.4.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6e1fcf0720908f200cd21aa4e6750a48ff6ce4afe7ff5a79a90d5ed8a08296f8", size = 206988 },{ url = "https://files.pythonhosted.org/packages/94/59/2e87300fe67ab820b5428580a53cad894272dbb97f38a7a814a2a1ac1011/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5f819d5fe9234f9f82d75bdfa9aef3a3d72c4d24a6e57aeaebba32a704553aa0", size = 147324 },{ url = "https://files.pythonhosted.org/packages/07/fb/0cf61dc84b2b088391830f6274cb57c82e4da8bbc2efeac8c025edb88772/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a59cb51917aa591b1c4e6a43c132f0cdc3c76dbad6155df4e28ee626cc77a0a3", size = 142742 },{ url = "https://files.pythonhosted.org/packages/62/8b/171935adf2312cd745d290ed93cf16cf0dfe320863ab7cbeeae1dcd6535f/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8ef3c867360f88ac904fd3f5e1f902f13307af9052646963ee08ff4f131adafc", size = 160863 },{ url = "https://files.pythonhosted.org/packages/09/73/ad875b192bda14f2173bfc1bc9a55e009808484a4b256748d931b6948442/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d9e45d7faa48ee908174d8fe84854479ef838fc6a705c9315372eacbc2f02897", size = 157837 },{ url = "https://files.pythonhosted.org/packages/6d/fc/de9cce525b2c5b94b47c70a4b4fb19f871b24995c728e957ee68ab1671ea/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:840c25fb618a231545cbab0564a799f101b63b9901f2569faecd6b222ac72381", size = 151550 },{ url = "https://files.pythonhosted.org/packages/55/c2/43edd615fdfba8c6f2dfbd459b25a6b3b551f24ea21981e23fb768503ce1/charset_normalizer-3.4.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ca5862d5b3928c4940729dacc329aa9102900382fea192fc5e52eb69d6093815", size = 149162 },{ url = "https://files.pythonhosted.org/packages/03/86/bde4ad8b4d0e9429a4e82c1e8f5c659993a9a863ad62c7df05cf7b678d75/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d9c7f57c3d666a53421049053eaacdd14bbd0a528e2186fcb2e672effd053bb0", size = 150019 },{ url = "https://files.pythonhosted.org/packages/1f/86/a151eb2af293a7e7bac3a739b81072585ce36ccfb4493039f49f1d3cae8c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:277e970e750505ed74c832b4bf75dac7476262ee2a013f5574dd49075879e161", size = 143310 },{ url = "https://files.pythonhosted.org/packages/b5/fe/43dae6144a7e07b87478fdfc4dbe9efd5defb0e7ec29f5f58a55aeef7bf7/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:31fd66405eaf47bb62e8cd575dc621c56c668f27d46a61d975a249930dd5e2a4", size = 162022 },{ url = "https://files.pythonhosted.org/packages/80/e6/7aab83774f5d2bca81f42ac58d04caf44f0cc2b65fc6db2b3b2e8a05f3b3/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:0d3d8f15c07f86e9ff82319b3d9ef6f4bf907608f53fe9d92b28ea9ae3d1fd89", size = 149383 },{ url = "https://files.pythonhosted.org/packages/4f/e8/b289173b4edae05c0dde07f69f8db476a0b511eac556dfe0d6bda3c43384/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:9f7fcd74d410a36883701fafa2482a6af2ff5ba96b9a620e9e0721e28ead5569", size = 159098 },{ url = "https://files.pythonhosted.org/packages/d8/df/fe699727754cae3f8478493c7f45f777b17c3ef0600e28abfec8619eb49c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ebf3e58c7ec8a8bed6d66a75d7fb37b55e5015b03ceae72a8e7c74495551e224", size = 152991 },{ url = "https://files.pythonhosted.org/packages/1a/86/584869fe4ddb6ffa3bd9f491b87a01568797fb9bd8933f557dba9771beaf/charset_normalizer-3.4.4-cp311-cp311-win32.whl", hash = "sha256:eecbc200c7fd5ddb9a7f16c7decb07b566c29fa2161a16cf67b8d068bd21690a", size = 99456 },{ url = "https://files.pythonhosted.org/packages/65/f6/62fdd5feb60530f50f7e38b4f6a1d5203f4d16ff4f9f0952962c044e919a/charset_normalizer-3.4.4-cp311-cp311-win_amd64.whl", hash = "sha256:5ae497466c7901d54b639cf42d5b8c1b6a4fead55215500d2f486d34db48d016", size = 106978 },{ url = "https://files.pythonhosted.org/packages/7a/9d/0710916e6c82948b3be62d9d398cb4fcf4e97b56d6a6aeccd66c4b2f2bd5/charset_normalizer-3.4.4-cp311-cp311-win_arm64.whl", hash = "sha256:65e2befcd84bc6f37095f5961e68a6f077bf44946771354a28ad434c2cce0ae1", size = 99969 },{ url = "https://files.pythonhosted.org/packages/f3/85/1637cd4af66fa687396e757dec650f28025f2a2f5a5531a3208dc0ec43f2/charset_normalizer-3.4.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0a98e6759f854bd25a58a73fa88833fba3b7c491169f86ce1180c948ab3fd394", size = 208425 },{ url = "https://files.pythonhosted.org/packages/9d/6a/04130023fef2a0d9c62d0bae2649b69f7b7d8d24ea5536feef50551029df/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b5b290ccc2a263e8d185130284f8501e3e36c5e02750fc6b6bdeb2e9e96f1e25", size = 148162 },{ url = "https://files.pythonhosted.org/packages/78/29/62328d79aa60da22c9e0b9a66539feae06ca0f5a4171ac4f7dc285b83688/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74bb723680f9f7a6234dcf67aea57e708ec1fbdf5699fb91dfd6f511b0a320ef", size = 144558 },{ url = "https://files.pythonhosted.org/packages/86/bb/b32194a4bf15b88403537c2e120b817c61cd4ecffa9b6876e941c3ee38fe/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f1e34719c6ed0b92f418c7c780480b26b5d9c50349e9a9af7d76bf757530350d", size = 161497 },{ url = "https://files.pythonhosted.org/packages/19/89/a54c82b253d5b9b111dc74aca196ba5ccfcca8242d0fb64146d4d3183ff1/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2437418e20515acec67d86e12bf70056a33abdacb5cb1655042f6538d6b085a8", size = 159240 },{ url = "https://files.pythonhosted.org/packages/c0/10/d20b513afe03acc89ec33948320a5544d31f21b05368436d580dec4e234d/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11d694519d7f29d6cd09f6ac70028dba10f92f6cdd059096db198c283794ac86", size = 153471 },{ url = "https://files.pythonhosted.org/packages/61/fa/fbf177b55bdd727010f9c0a3c49eefa1d10f960e5f09d1d887bf93c2e698/charset_normalizer-3.4.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ac1c4a689edcc530fc9d9aa11f5774b9e2f33f9a0c6a57864e90908f5208d30a", size = 150864 },{ url = "https://files.pythonhosted.org/packages/05/12/9fbc6a4d39c0198adeebbde20b619790e9236557ca59fc40e0e3cebe6f40/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:21d142cc6c0ec30d2efee5068ca36c128a30b0f2c53c1c07bd78cb6bc1d3be5f", size = 150647 },{ url = "https://files.pythonhosted.org/packages/ad/1f/6a9a593d52e3e8c5d2b167daf8c6b968808efb57ef4c210acb907c365bc4/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:5dbe56a36425d26d6cfb40ce79c314a2e4dd6211d51d6d2191c00bed34f354cc", size = 145110 },{ url = "https://files.pythonhosted.org/packages/30/42/9a52c609e72471b0fc54386dc63c3781a387bb4fe61c20231a4ebcd58bdd/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:5bfbb1b9acf3334612667b61bd3002196fe2a1eb4dd74d247e0f2a4d50ec9bbf", size = 162839 },{ url = "https://files.pythonhosted.org/packages/c4/5b/c0682bbf9f11597073052628ddd38344a3d673fda35a36773f7d19344b23/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d055ec1e26e441f6187acf818b73564e6e6282709e9bcb5b63f5b23068356a15", size = 150667 },{ url = "https://files.pythonhosted.org/packages/e4/24/a41afeab6f990cf2daf6cb8c67419b63b48cf518e4f56022230840c9bfb2/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:af2d8c67d8e573d6de5bc30cdb27e9b95e49115cd9baad5ddbd1a6207aaa82a9", size = 160535 },{ url = "https://files.pythonhosted.org/packages/2a/e5/6a4ce77ed243c4a50a1fecca6aaaab419628c818a49434be428fe24c9957/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:780236ac706e66881f3b7f2f32dfe90507a09e67d1d454c762cf642e6e1586e0", size = 154816 },{ url = "https://files.pythonhosted.org/packages/a8/ef/89297262b8092b312d29cdb2517cb1237e51db8ecef2e9af5edbe7b683b1/charset_normalizer-3.4.4-cp312-cp312-win32.whl", hash = "sha256:5833d2c39d8896e4e19b689ffc198f08ea58116bee26dea51e362ecc7cd3ed26", size = 99694 },{ url = "https://files.pythonhosted.org/packages/3d/2d/1e5ed9dd3b3803994c155cd9aacb60c82c331bad84daf75bcb9c91b3295e/charset_normalizer-3.4.4-cp312-cp312-win_amd64.whl", hash = "sha256:a79cfe37875f822425b89a82333404539ae63dbdddf97f84dcbc3d339aae9525", size = 107131 },{ url = "https://files.pythonhosted.org/packages/d0/d9/0ed4c7098a861482a7b6a95603edce4c0d9db2311af23da1fb2b75ec26fc/charset_normalizer-3.4.4-cp312-cp312-win_arm64.whl", hash = "sha256:376bec83a63b8021bb5c8ea75e21c4ccb86e7e45ca4eb81146091b56599b80c3", size = 100390 },{ url = "https://files.pythonhosted.org/packages/97/45/4b3a1239bbacd321068ea6e7ac28875b03ab8bc0aa0966452db17cd36714/charset_normalizer-3.4.4-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:e1f185f86a6f3403aa2420e815904c67b2f9ebc443f045edd0de921108345794", size = 208091 },{ url = "https://files.pythonhosted.org/packages/7d/62/73a6d7450829655a35bb88a88fca7d736f9882a27eacdca2c6d505b57e2e/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b39f987ae8ccdf0d2642338faf2abb1862340facc796048b604ef14919e55ed", size = 147936 },{ url = "https://files.pythonhosted.org/packages/89/c5/adb8c8b3d6625bef6d88b251bbb0d95f8205831b987631ab0c8bb5d937c2/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3162d5d8ce1bb98dd51af660f2121c55d0fa541b46dff7bb9b9f86ea1d87de72", size = 144180 },{ url = "https://files.pythonhosted.org/packages/91/ed/9706e4070682d1cc219050b6048bfd293ccf67b3d4f5a4f39207453d4b99/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:81d5eb2a312700f4ecaa977a8235b634ce853200e828fbadf3a9c50bab278328", size = 161346 },{ url = "https://files.pythonhosted.org/packages/d5/0d/031f0d95e4972901a2f6f09ef055751805ff541511dc1252ba3ca1f80cf5/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5bd2293095d766545ec1a8f612559f6b40abc0eb18bb2f5d1171872d34036ede", size = 158874 },{ url = "https://files.pythonhosted.org/packages/f5/83/6ab5883f57c9c801ce5e5677242328aa45592be8a00644310a008d04f922/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a8a8b89589086a25749f471e6a900d3f662d1d3b6e2e59dcecf787b1cc3a1894", size = 153076 },{ url = "https://files.pythonhosted.org/packages/75/1e/5ff781ddf5260e387d6419959ee89ef13878229732732ee73cdae01800f2/charset_normalizer-3.4.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc7637e2f80d8530ee4a78e878bce464f70087ce73cf7c1caf142416923b98f1", size = 150601 },{ url = "https://files.pythonhosted.org/packages/d7/57/71be810965493d3510a6ca79b90c19e48696fb1ff964da319334b12677f0/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f8bf04158c6b607d747e93949aa60618b61312fe647a6369f88ce2ff16043490", size = 150376 },{ url = "https://files.pythonhosted.org/packages/e5/d5/c3d057a78c181d007014feb7e9f2e65905a6c4ef182c0ddf0de2924edd65/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:554af85e960429cf30784dd47447d5125aaa3b99a6f0683589dbd27e2f45da44", size = 144825 },{ url = "https://files.pythonhosted.org/packages/e6/8c/d0406294828d4976f275ffbe66f00266c4b3136b7506941d87c00cab5272/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:74018750915ee7ad843a774364e13a3db91682f26142baddf775342c3f5b1133", size = 162583 },{ url = "https://files.pythonhosted.org/packages/d7/24/e2aa1f18c8f15c4c0e932d9287b8609dd30ad56dbe41d926bd846e22fb8d/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:c0463276121fdee9c49b98908b3a89c39be45d86d1dbaa22957e38f6321d4ce3", size = 150366 },{ url = "https://files.pythonhosted.org/packages/e4/5b/1e6160c7739aad1e2df054300cc618b06bf784a7a164b0f238360721ab86/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:362d61fd13843997c1c446760ef36f240cf81d3ebf74ac62652aebaf7838561e", size = 160300 },{ url = "https://files.pythonhosted.org/packages/7a/10/f882167cd207fbdd743e55534d5d9620e095089d176d55cb22d5322f2afd/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9a26f18905b8dd5d685d6d07b0cdf98a79f3c7a918906af7cc143ea2e164c8bc", size = 154465 },{ url = "https://files.pythonhosted.org/packages/89/66/c7a9e1b7429be72123441bfdbaf2bc13faab3f90b933f664db506dea5915/charset_normalizer-3.4.4-cp313-cp313-win32.whl", hash = "sha256:9b35f4c90079ff2e2edc5b26c0c77925e5d2d255c42c74fdb70fb49b172726ac", size = 99404 },{ url = "https://files.pythonhosted.org/packages/c4/26/b9924fa27db384bdcd97ab83b4f0a8058d96ad9626ead570674d5e737d90/charset_normalizer-3.4.4-cp313-cp313-win_amd64.whl", hash = "sha256:b435cba5f4f750aa6c0a0d92c541fb79f69a387c91e61f1795227e4ed9cece14", size = 107092 },{ url = "https://files.pythonhosted.org/packages/af/8f/3ed4bfa0c0c72a7ca17f0380cd9e4dd842b09f664e780c13cff1dcf2ef1b/charset_normalizer-3.4.4-cp313-cp313-win_arm64.whl", hash = "sha256:542d2cee80be6f80247095cc36c418f7bddd14f4a6de45af91dfad36d817bba2", size = 100408 },{ url = "https://files.pythonhosted.org/packages/2a/35/7051599bd493e62411d6ede36fd5af83a38f37c4767b92884df7301db25d/charset_normalizer-3.4.4-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:da3326d9e65ef63a817ecbcc0df6e94463713b754fe293eaa03da99befb9a5bd", size = 207746 },{ url = "https://files.pythonhosted.org/packages/10/9a/97c8d48ef10d6cd4fcead2415523221624bf58bcf68a802721a6bc807c8f/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8af65f14dc14a79b924524b1e7fffe304517b2bff5a58bf64f30b98bbc5079eb", size = 147889 },{ url = "https://files.pythonhosted.org/packages/10/bf/979224a919a1b606c82bd2c5fa49b5c6d5727aa47b4312bb27b1734f53cd/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74664978bb272435107de04e36db5a9735e78232b85b77d45cfb38f758efd33e", size = 143641 },{ url = "https://files.pythonhosted.org/packages/ba/33/0ad65587441fc730dc7bd90e9716b30b4702dc7b617e6ba4997dc8651495/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:752944c7ffbfdd10c074dc58ec2d5a8a4cd9493b314d367c14d24c17684ddd14", size = 160779 },{ url = "https://files.pythonhosted.org/packages/67/ed/331d6b249259ee71ddea93f6f2f0a56cfebd46938bde6fcc6f7b9a3d0e09/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d1f13550535ad8cff21b8d757a3257963e951d96e20ec82ab44bc64aeb62a191", size = 159035 },{ url = "https://files.pythonhosted.org/packages/67/ff/f6b948ca32e4f2a4576aa129d8bed61f2e0543bf9f5f2b7fc3758ed005c9/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ecaae4149d99b1c9e7b88bb03e3221956f68fd6d50be2ef061b2381b61d20838", size = 152542 },{ url = "https://files.pythonhosted.org/packages/16/85/276033dcbcc369eb176594de22728541a925b2632f9716428c851b149e83/charset_normalizer-3.4.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cb6254dc36b47a990e59e1068afacdcd02958bdcce30bb50cc1700a8b9d624a6", size = 149524 },{ url = "https://files.pythonhosted.org/packages/9e/f2/6a2a1f722b6aba37050e626530a46a68f74e63683947a8acff92569f979a/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c8ae8a0f02f57a6e61203a31428fa1d677cbe50c93622b4149d5c0f319c1d19e", size = 150395 },{ url = "https://files.pythonhosted.org/packages/60/bb/2186cb2f2bbaea6338cad15ce23a67f9b0672929744381e28b0592676824/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:47cc91b2f4dd2833fddaedd2893006b0106129d4b94fdb6af1f4ce5a9965577c", size = 143680 },{ url = "https://files.pythonhosted.org/packages/7d/a5/bf6f13b772fbb2a90360eb620d52ed8f796f3c5caee8398c3b2eb7b1c60d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:82004af6c302b5d3ab2cfc4cc5f29db16123b1a8417f2e25f9066f91d4411090", size = 162045 },{ url = "https://files.pythonhosted.org/packages/df/c5/d1be898bf0dc3ef9030c3825e5d3b83f2c528d207d246cbabe245966808d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:2b7d8f6c26245217bd2ad053761201e9f9680f8ce52f0fcd8d0755aeae5b2152", size = 149687 },{ url = "https://files.pythonhosted.org/packages/a5/42/90c1f7b9341eef50c8a1cb3f098ac43b0508413f33affd762855f67a410e/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:799a7a5e4fb2d5898c60b640fd4981d6a25f1c11790935a44ce38c54e985f828", size = 160014 },{ url = "https://files.pythonhosted.org/packages/76/be/4d3ee471e8145d12795ab655ece37baed0929462a86e72372fd25859047c/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:99ae2cffebb06e6c22bdc25801d7b30f503cc87dbd283479e7b606f70aff57ec", size = 154044 },{ url = "https://files.pythonhosted.org/packages/b0/6f/8f7af07237c34a1defe7defc565a9bc1807762f672c0fde711a4b22bf9c0/charset_normalizer-3.4.4-cp314-cp314-win32.whl", hash = "sha256:f9d332f8c2a2fcbffe1378594431458ddbef721c1769d78e2cbc06280d8155f9", size = 99940 },{ url = "https://files.pythonhosted.org/packages/4b/51/8ade005e5ca5b0d80fb4aff72a3775b325bdc3d27408c8113811a7cbe640/charset_normalizer-3.4.4-cp314-cp314-win_amd64.whl", hash = "sha256:8a6562c3700cce886c5be75ade4a5db4214fda19fede41d9792d100288d8f94c", size = 107104 },{ url = "https://files.pythonhosted.org/packages/da/5f/6b8f83a55bb8278772c5ae54a577f3099025f9ade59d0136ac24a0df4bde/charset_normalizer-3.4.4-cp314-cp314-win_arm64.whl", hash = "sha256:de00632ca48df9daf77a2c65a484531649261ec9f25489917f09e455cb09ddb2", size = 100743 },{ url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402 },][[package]]name = "click"version = "8.3.1"109 unmodified linessource = { virtual = "." }dependencies = [{ name = "fastapi" },{ name = "pycountry" },{ name = "python-dotenv" },{ name = "python-multipart" },{ name = "requests" },{ name = "uvicorn", extra = ["standard"] },][package.dev-dependencies]dev = [{ name = "ruff" },][package.metadata]requires-dist = [{ name = "fastapi", specifier = ">=0.128.0" },{ name = "pycountry", specifier = ">=24.6.1" },{ name = "python-dotenv", specifier = ">=1.2.1" },{ name = "python-multipart", specifier = ">=0.0.21" },{ name = "requests", specifier = ">=2.32.5" },{ name = "uvicorn", extras = ["standard"], specifier = ">=0.40.0" },][package.metadata.requires-dev]dev = [{ name = "ruff", specifier = ">=0.14.11" }][[package]]name = "pycountry"version = "24.6.1"source = { registry = "https://pypi.org/simple" }sdist = { url = "https://files.pythonhosted.org/packages/76/57/c389fa68c50590881a75b7883eeb3dc15e9e73a0fdc001cdd45c13290c92/pycountry-24.6.1.tar.gz", hash = "sha256:b61b3faccea67f87d10c1f2b0fc0be714409e8fcdcc1315613174f6466c10221", size = 6043910 }wheels = [{ url = "https://files.pythonhosted.org/packages/b1/ec/1fb891d8a2660716aadb2143235481d15ed1cbfe3ad669194690b0604492/pycountry-24.6.1-py3-none-any.whl", hash = "sha256:f1a4fb391cd7214f8eefd39556d740adcc233c778a27f8942c8dca351d6ce06f", size = 6335189 },][[package]]name = "pydantic"version = "2.12.5"128 unmodified lines{ url = "https://files.pythonhosted.org/packages/14/1b/a298b06749107c305e1fe0f814c6c74aea7b2f1e10989cb30f544a1b3253/python_dotenv-1.2.1-py3-none-any.whl", hash = "sha256:b81ee9561e9ca4004139c6cbba3a238c32b03e4894671e181b671e8cb8425d61", size = 21230 },][[package]]name = "python-multipart"version = "0.0.21"source = { registry = "https://pypi.org/simple" }sdist = { url = "https://files.pythonhosted.org/packages/78/96/804520d0850c7db98e5ccb70282e29208723f0964e88ffd9d0da2f52ea09/python_multipart-0.0.21.tar.gz", hash = "sha256:7137ebd4d3bbf70ea1622998f902b97a29434a9e8dc40eb203bbcf7c2a2cba92", size = 37196 }wheels = [{ url = "https://files.pythonhosted.org/packages/aa/76/03af049af4dcee5d27442f71b6924f01f3efb5d2bd34f23fcd563f2cc5f5/python_multipart-0.0.21-py3-none-any.whl", hash = "sha256:cf7a6713e01c87aa35387f4774e812c4361150938d20d232800f75ffcf266090", size = 24541 },][[package]]name = "pyyaml"version = "6.0.3"58 unmodified lines{ url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341 },][[package]]name = "requests"version = "2.32.5"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "certifi" },{ name = "charset-normalizer" },{ name = "idna" },{ name = "urllib3" },]sdist = { url = "https://files.pythonhosted.org/packages/c9/74/b3ff8e6c8446842c3f5c837e9c3dfcfe2018ea6ecef224c710c85ef728f4/requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf", size = 134517 }wheels = [{ url = "https://files.pythonhosted.org/packages/1e/db/4254e3eabe8020b458f1a747140d32277ec7a271daf1d235b70dc0b4e6e3/requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6", size = 64738 },][[package]]name = "ruff"version = "0.14.11"source = { registry = "https://pypi.org/simple" }sdist = { url = "https://files.pythonhosted.org/packages/d4/77/9a7fe084d268f8855d493e5031ea03fa0af8cc05887f638bf1c4e3363eb8/ruff-0.14.11.tar.gz", hash = "sha256:f6dc463bfa5c07a59b1ff2c3b9767373e541346ea105503b4c0369c520a66958", size = 5993417 }wheels = [{ url = "https://files.pythonhosted.org/packages/f0/a6/a4c40a5aaa7e331f245d2dc1ac8ece306681f52b636b40ef87c88b9f7afd/ruff-0.14.11-py3-none-linux_armv6l.whl", hash = "sha256:f6ff2d95cbd335841a7217bdfd9c1d2e44eac2c584197ab1385579d55ff8830e", size = 12951208 },{ url = "https://files.pythonhosted.org/packages/5c/5c/360a35cb7204b328b685d3129c08aca24765ff92b5a7efedbdd6c150d555/ruff-0.14.11-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6f6eb5c1c8033680f4172ea9c8d3706c156223010b8b97b05e82c59bdc774ee6", size = 13330075 },{ url = "https://files.pythonhosted.org/packages/1b/9e/0cc2f1be7a7d33cae541824cf3f95b4ff40d03557b575912b5b70273c9ec/ruff-0.14.11-py3-none-macosx_11_0_arm64.whl", hash = "sha256:f2fc34cc896f90080fca01259f96c566f74069a04b25b6205d55379d12a6855e", size = 12257809 },{ url = "https://files.pythonhosted.org/packages/a7/e5/5faab97c15bb75228d9f74637e775d26ac703cc2b4898564c01ab3637c02/ruff-0.14.11-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:53386375001773ae812b43205d6064dae49ff0968774e6befe16a994fc233caa", size = 12678447 },{ url = "https://files.pythonhosted.org/packages/1b/33/e9767f60a2bef779fb5855cab0af76c488e0ce90f7bb7b8a45c8a2ba4178/ruff-0.14.11-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a697737dce1ca97a0a55b5ff0434ee7205943d4874d638fe3ae66166ff46edbe", size = 12758560 },{ url = "https://files.pythonhosted.org/packages/eb/84/4c6cf627a21462bb5102f7be2a320b084228ff26e105510cd2255ea868e5/ruff-0.14.11-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6845ca1da8ab81ab1dce755a32ad13f1db72e7fba27c486d5d90d65e04d17b8f", size = 13599296 },{ url = "https://files.pythonhosted.org/packages/88/e1/92b5ed7ea66d849f6157e695dc23d5d6d982bd6aa8d077895652c38a7cae/ruff-0.14.11-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e36ce2fd31b54065ec6f76cb08d60159e1b32bdf08507862e32f47e6dde8bcbf", size = 15048981 },{ url = "https://files.pythonhosted.org/packages/61/df/c1bd30992615ac17c2fb64b8a7376ca22c04a70555b5d05b8f717163cf9f/ruff-0.14.11-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:590bcc0e2097ecf74e62a5c10a6b71f008ad82eb97b0a0079e85defe19fe74d9", size = 14633183 },{ url = "https://files.pythonhosted.org/packages/04/e9/fe552902f25013dd28a5428a42347d9ad20c4b534834a325a28305747d64/ruff-0.14.11-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:53fe71125fc158210d57fe4da26e622c9c294022988d08d9347ec1cf782adafe", size = 14050453 },{ url = "https://files.pythonhosted.org/packages/ae/93/f36d89fa021543187f98991609ce6e47e24f35f008dfe1af01379d248a41/ruff-0.14.11-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a35c9da08562f1598ded8470fcfef2afb5cf881996e6c0a502ceb61f4bc9c8a3", size = 13757889 },{ url = "https://files.pythonhosted.org/packages/b7/9f/c7fb6ecf554f28709a6a1f2a7f74750d400979e8cd47ed29feeaa1bd4db8/ruff-0.14.11-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:0f3727189a52179393ecf92ec7057c2210203e6af2676f08d92140d3e1ee72c1", size = 13955832 },{ url = "https://files.pythonhosted.org/packages/db/a0/153315310f250f76900a98278cf878c64dfb6d044e184491dd3289796734/ruff-0.14.11-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:eb09f849bd37147a789b85995ff734a6c4a095bed5fd1608c4f56afc3634cde2", size = 12586522 },{ url = "https://files.pythonhosted.org/packages/2f/2b/a73a2b6e6d2df1d74bf2b78098be1572191e54bec0e59e29382d13c3adc5/ruff-0.14.11-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:c61782543c1231bf71041461c1f28c64b961d457d0f238ac388e2ab173d7ecb7", size = 12724637 },{ url = "https://files.pythonhosted.org/packages/f0/41/09100590320394401cd3c48fc718a8ba71c7ddb1ffd07e0ad6576b3a3df2/ruff-0.14.11-py3-none-musllinux_1_2_i686.whl", hash = "sha256:82ff352ea68fb6766140381748e1f67f83c39860b6446966cff48a315c3e2491", size = 13145837 },{ url = "https://files.pythonhosted.org/packages/3b/d8/e035db859d1d3edf909381eb8ff3e89a672d6572e9454093538fe6f164b0/ruff-0.14.11-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:728e56879df4ca5b62a9dde2dd0eb0edda2a55160c0ea28c4025f18c03f86984", size = 13850469 },{ url = "https://files.pythonhosted.org/packages/4e/02/bb3ff8b6e6d02ce9e3740f4c17dfbbfb55f34c789c139e9cd91985f356c7/ruff-0.14.11-py3-none-win32.whl", hash = "sha256:337c5dd11f16ee52ae217757d9b82a26400be7efac883e9e852646f1557ed841", size = 12851094 },{ url = "https://files.pythonhosted.org/packages/58/f1/90ddc533918d3a2ad628bc3044cdfc094949e6d4b929220c3f0eb8a1c998/ruff-0.14.11-py3-none-win_amd64.whl", hash = "sha256:f981cea63d08456b2c070e64b79cb62f951aa1305282974d4d5216e6e0178ae6", size = 14001379 },{ url = "https://files.pythonhosted.org/packages/c4/1c/1dbe51782c0e1e9cfce1d1004752672d2d4629ea46945d19d731ad772b3b/ruff-0.14.11-py3-none-win_arm64.whl", hash = "sha256:649fb6c9edd7f751db276ef42df1f3df41c38d67d199570ae2a7bd6cbc3590f0", size = 12938644 },][[package]]name = "starlette"version = "0.50.0"28 unmodified lines{ url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611 },][[package]]name = "urllib3"version = "2.6.3"source = { registry = "https://pypi.org/simple" }sdist = { url = "https://files.pythonhosted.org/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed", size = 435556 }wheels = [{ url = "https://files.pythonhosted.org/packages/39/08/aaaad47bc4e9dc8c725e68f9d04865dbcb2052843ff09c97b08904852d84/urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4", size = 131584 },][[package]]name = "uvicorn"version = "0.40.0"
.dockerignore+65-3
.env.exampleAdded+19
.gitignore+67-1
Dockerfile+36-9
MakefileAdded+44
README.md+215-1
main.py+11-5
pyproject.toml+13-1
ruff.tomlAdded+26
src/__init__.pyAdded+7
src/api/__init__.pyAdded+27
src/api/domain.pyAdded+151
src/api/hash.pyAdded+172
src/api/ip.pyAdded+219
src/app.pyAdded+97
src/config/__init__.pyAdded+5
src/config/settings.pyAdded+46
src/exceptions.pyAdded+45
src/logging_config.pyAdded+47
src/models/__init__.pyAdded+13
src/models/domain.pyAdded+37
src/models/hash.pyAdded+34
src/models/ip.pyAdded+103
src/services/__init__.pyAdded+6
src/services/abuseipdb.pyAdded+95
src/services/base.pyAdded+113
src/services/virustotal.pyAdded+187
src/utils/__init__.pyAdded+6
src/utils/helpers.pyAdded+35
src/utils/validators.pyAdded+47
uv.lock+182