Skip to main content

Bug bounty automation: vulnerability scanner, recon, BOLA, fix patterns for Python/Solidity/TS

Project description

Bounty Hunter Toolkit

Vulnerability scanner and fix patterns for Python, Solidity, and TypeScript. Zero dependencies.

Python Dependencies License

What's New in 1.3.0

  • Vulnerability scannerscan_file() and scan_directory() with regex-based detection
  • 28 vulnerability patterns — SQL injection, SSRF, path traversal, command injection, hardcoded secrets, weak hashes, integer overflow, unchecked calls, and more
  • CWE mapping — every pattern maps to a MITRE CWE ID
  • Severity levels — critical, high, medium, low
  • Mass scanning — recursive directory scan with ignore dirs (node_modules, .git, pycache)
  • CI integration — non-zero exit code when vulnerabilities found
  • Bulk fix mode--fix-all applies every matching pattern
  • JSON/CSV output — pipe to jq, import to spreadsheet, or feed to CI tooling
  • Dry run mode — preview changes before writing

Features

  • Python Security Patterns (17): SQL injection, JWT none algo, XXE, SSTI, CSRF, open redirect, NoSQL injection, YAML RCE, pickle RCE, CRLF injection, path traversal, command injection, SSRF, hardcoded secrets, insecure deserialization, weak hashes
  • Solidity Security Patterns (7): Reentrancy, zero-amount, batch ops, permit replay, indexed events, unchecked calls, integer overflow
  • SDK Patterns (2): Session refresh, EIP-712 typed data

Quick Start

pip install bounty-hunter-toolkit

Scan a File

# Scan single file
python apply_fix.py --scan app.py

# Scan with JSON output for CI
python apply_fix.py --scan ./src --format json > findings.json

# CSV for spreadsheets
python apply_fix.py --scan ./src --format csv > findings.csv

Output:

Found 3 potential vulnerabilities:

  [!] CRITICAL sql_injection            app.py:42
           CWE-89 — Replace f-string SQL with parameterized queries
           match: execute(f"SELECT * F

  [*] HIGH     hardcoded_secrets        app.py:8
           CWE-798 — Move secrets to environment variables
           match: API_KEY = "sk-1234567

  [~] MEDIUM   weak_hash                app.py:56
           CWE-328 — Use hashlib.sha256 instead of md5/sha1
           match: hashlib.md5(password.

Summary:
  critical: 1
  high    : 1
  medium  : 1

Apply Fixes

# Apply a specific fix pattern
python apply_fix.py --fix sql_injection --file app.py

# Apply all matching fixes at once
python apply_fix.py --fix-all --file app.py

# Preview without writing
python apply_fix.py --fix-all --file app.py --dry-run

Scan a Project

# Scan entire project (auto-skips node_modules, .git, __pycache__, etc.)
python apply_fix.py --scan ./my-project

# Scan specific extensions only
python apply_fix.py --scan ./contracts --ext .sol
python apply_fix.py --scan ./backend --ext .py

List All Patterns

python apply_fix.py --list
28 patterns available:

  PYTHON:
    sql_injection                 CRITICAL  Replace f-string SQL with parameterized queries
    jwt_none                      HIGH      Force explicit JWT algorithms
    command_injection             CRITICAL  Use subprocess with shell=False and list args
    ...

CI/CD Integration

The scanner exits with code 1 when vulnerabilities are found, making it drop-in for CI:

# GitHub Actions
- name: Security scan
  run: |
    pip install bounty-hunter-toolkit
    python -m apply_fix --scan ./src --format json > findings.json
    # Fails build if vulnerabilities found
# Pre-commit hook
bounty-hunter-toolkit --scan . --format text || exit 1

Python API

from apply_fix import scan_file, scan_directory, apply_fix, format_findings

# Scan a file
findings = scan_file("app.py")
print(format_findings(findings))

# Scan a directory
findings = scan_directory("./src", extensions=[".py"])

# Apply a fix
success, message = apply_fix("sql_injection", "app.py")

# Get JSON output
import json
print(json.dumps(findings, indent=2))

Pattern Reference

Python Patterns

Pattern Severity CWE Description
sql_injection Critical CWE-89 f-string in SQL execute()
jwt_none High CWE-347 algorithms=None in JWT decode
xxe High CWE-611 xml.etree without defusedxml
ssti Critical CWE-1336 f-string in render_template_string
csrf Medium CWE-352 Missing CSRF token validation
open_redirect Medium CWE-601 Unvalidated redirect URL
nosql_injection High CWE-943 Raw JSON in NoSQL query
yaml_rce Critical CWE-502 yaml.load without safe_load
pickle_rce Critical CWE-502 pickle.loads on untrusted data
crlf_injection Medium CWE-93 Unstripped CR/LF in headers
path_traversal High CWE-22 Unvalidated file path
command_injection Critical CWE-78 os.system or shell=True
ssrf High CWE-918 Unvalidated outbound URL
hardcoded_secrets High CWE-798 API keys in source code
insecure_deserialize Critical CWE-502 marshal.loads
weak_hash Medium CWE-328 md5/sha1 for passwords

Solidity Patterns

Pattern Severity CWE Description
reentrancy Critical CWE-668 Missing nonReentrant modifier
zero_amount Medium CWE-664 Missing zero-amount check
batch_ops Low CWE-400 Unbounded batch array
permit_replay High CWE-345 Missing chainId in hash
indexed_events Low CWE-682 Unindexed address params
unchecked_call High CWE-252 Unchecked .call() return
integer_overflow High CWE-190 Solidity <0.8 arithmetic

Testing

python -m pytest tests/ -v

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bounty_hunter_toolkit-1.3.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bounty_hunter_toolkit-1.3.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file bounty_hunter_toolkit-1.3.0.tar.gz.

File metadata

  • Download URL: bounty_hunter_toolkit-1.3.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for bounty_hunter_toolkit-1.3.0.tar.gz
Algorithm Hash digest
SHA256 314aec8863bc3669372a558d9ab7bde5c9aa00ebcd4b683b1d39871ca1dbef3a
MD5 f46ae7d81d81e393373ebbeae279fc54
BLAKE2b-256 5a811c9a1903d9c87f68219357fb6eb618104ebd6ae3a4e2d99a30f48e8c133c

See more details on using hashes here.

File details

Details for the file bounty_hunter_toolkit-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bounty_hunter_toolkit-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c2f487fdad1c5b1d8b00b1fdb2703a2064fc7f82caa7596dc5a87647d17d88a
MD5 193f57ba2dc2133ebc383eafddca0de8
BLAKE2b-256 215bf8e64137c22d12988be5a993ac118ed6bf17fb9ddfd65ad3dc870fa3372c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page