Skip to main content

A package to detect sensitive information in code and files

Project description

Sensitive Data Detector 🔍

A Python package that helps detect sensitive information in files and code. Protect your codebase from accidental exposure of API keys, passwords, tokens, and other sensitive data.

PyPI version Python Versions License: MIT Downloads Code style: black Imports: isort Made with Python

🚀 Features

  • 🔑 Detects API keys and tokens
  • 📧 Identifies email addresses
  • 🔐 Finds sensitive patterns in code
  • ⚙️ Configurable detection patterns
  • 📁 Works with any text-based file
  • 🛡️ Pre-commit hook support

📦 Installation

pip install sensitive_data_detector

🎯 Quick Start

from sensitive_data_detector import has_sensitive_info

# Check a single file
result = has_sensitive_info("path/to/your/file.txt")
if result:
    True (sensitive info found in the file)
else:
    False (no sensitive info found)

🔍 What It Detects

The package detects various types of sensitive information, including:

  • API Keys and Tokens
  • Email Addresses
  • Private Keys
  • Access Tokens
  • And more configurable patterns

🛠️ Development Setup

# Clone the repository
git clone https://github.com/akashdv25/sensitive_info_detector.git
cd sensitive_info_detector

# Create and activate virtual environment (optional)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run pre-commit hooks
pre-commit run --all-files

🔧 Configuration

The package uses a config.json file that defines patterns for sensitive information detection. You can customize these patterns for your specific needs.

Default patterns include:

{
    "patterns": {
        "api_key": "api[_-]?key['\"]?\\s*[:=]\\s*['\"]([\\w-]+)['\"]",
        "email": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"
    }
}

🐍 Python Version Support

  • Python 3.9
  • Python 3.10
  • Python 3.11

🛠️ Built With

🤝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (pytest)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

📫 Contact

Akash Anandani


Made with ❤️ by Akash Anandani

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

sensitive_data_detector-1.0.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

sensitive_data_detector-1.0.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file sensitive_data_detector-1.0.2.tar.gz.

File metadata

  • Download URL: sensitive_data_detector-1.0.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for sensitive_data_detector-1.0.2.tar.gz
Algorithm Hash digest
SHA256 20da73d28132e34aacd83cd24655352c3ff72f8caae6881e48f537024faae2b4
MD5 bfa623fcee8ae898230447f1e6797b50
BLAKE2b-256 7c1c7bb79299994f8c183be2b6a4e905c9189b573a9fd9d6624c1de13f8a3396

See more details on using hashes here.

File details

Details for the file sensitive_data_detector-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sensitive_data_detector-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 834731372da77627756d0b4721475ceaab8e1127482bf9684b3401b083c73f59
MD5 2966ae173e834c82424e0916ff113d0b
BLAKE2b-256 79898c14d8dd4a68197934699095ab72db79872d51053df5b2c5b5a70bbd5ccf

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