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 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

🔗 Project Links

📝 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.4.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.4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sensitive_data_detector-1.0.4.tar.gz
Algorithm Hash digest
SHA256 6fd0615e9011ce6c307e6a792d6162e08c1fb48dc52b9ce56bbbd02c821f8f55
MD5 5725f9fd65caed96dedacdb3e1956207
BLAKE2b-256 19929dbd5b0957e4d5e74729de128158cfcfaa6097940b85504bb01388c1a44f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sensitive_data_detector-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7734781509b3869bdb8861e371a54866192a1035c4f9f3ab75faee46d04b83b2
MD5 1ababe248e52560b3d1458ebb865670f
BLAKE2b-256 fd9634e586ca7743ed64111e956c74a6edaf482acdfeafcadddef2da4fa7c758

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