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.
🚀 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
- Python - Programming Language
- Black - Code Formatting
- isort - Import Sorting
- Flake8 - Code Linting
- pytest - Testing Framework
- pre-commit - Git Hooks Framework
🤝 Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sensitive_data_detector-1.0.3.tar.gz.
File metadata
- Download URL: sensitive_data_detector-1.0.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d6ab2ccb474a1242e8d55deb679a251511d4ff54cae92d877c17d8e148f77a5
|
|
| MD5 |
faf7d1f117f5fcae905fef1b666d65e8
|
|
| BLAKE2b-256 |
2d263224b5b777e5005b5780e82719b2b3bfd79a9b7409fc0add1fd3b6e7b5f7
|
File details
Details for the file sensitive_data_detector-1.0.3-py3-none-any.whl.
File metadata
- Download URL: sensitive_data_detector-1.0.3-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f25379e5c9fbabbe6109a18fdd7deaacf8cba50ce43c7a7e8f3cadbe5fcc80e1
|
|
| MD5 |
18f7f1a9ede97fc75da11af6488a6c42
|
|
| BLAKE2b-256 |
da6af1bddaaa708bdab53da2000c8ecf0790708db40809606020ea1a0bf5b7a7
|