Skip to main content

A module to find credit card, UK bank account, sort code and postcode in text

Project description

Sensivalidate

Sensivalidate is a Python package designed to help identify sensitive data in text, including credit card numbers, UK bank account numbers, UK sort codes, and UK postcodes. It uses regular expressions for pattern matching, and performs real validation for credit card numbers using the creditcard Python package.

Features

  • Credit Card Validation: Validates credit card numbers by checking for valid formats and using the creditcard package to verify the card's authenticity.

  • UK Bank Account Number Detection: Identifies UK bank account numbers (8-digit numbers).

  • UK Sort Code Detection: Detects UK sort codes in formats like xx-xx-xx, xxxxxxxx, and xx xx xx.

  • UK Postcode Detection: Matches UK postcodes based on standard patterns.

Note: The package performs pattern matching for bank account numbers, sort codes, and postcodes, but only credit card numbers are validated for authenticity.

Installation

You can install the package using pip:

pip install sensivalidate

Or, if you've downloaded the package:

pip install sensivalidate-0.1.tar.gz

Usage

from sensivalidate import is_sensitive_data

result = is_sensitive_data("your text here")

if result:
	print("Sensitive data detected.")
else:
	print("No sensitive data found.")

The is_sensitive_data function checks the provided text for sensitive data and returns True if any of the following are detected:

  • Valid credit card number

  • UK bank account number

  • UK sort code

  • UK postcode

Code Overview

  • _is_credit_card(text): Detects and validates credit card numbers using regex and the creditcard package.

  • _is_uk_bank_account_and_sort_code(text): Matches UK bank account numbers and sort codes.

  • _is_uk_postcode(text): Matches UK postcodes.

  • is_sensitive_data(text): The main function that checks for sensitive data by calling the individual validator functions.

Contributing

Feel free to fork this repository and contribute. If you find any bugs or have ideas for improvements, please create an issue or submit a pull request.

License

This project is licensed under the MIT License.

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

sensivalidate-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

sensivalidate-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file sensivalidate-1.0.0.tar.gz.

File metadata

  • Download URL: sensivalidate-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for sensivalidate-1.0.0.tar.gz
Algorithm Hash digest
SHA256 58bdfb05714d1ae907f6419b16688728870fa05a67fd4f4a31d86e570f1c18e1
MD5 5379f0bae654c48668316fc3618f367a
BLAKE2b-256 e2a1d6385b14fdc3553925bb2e3ab00660b7e7b26847bb929befd575dddc7fbf

See more details on using hashes here.

File details

Details for the file sensivalidate-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sensivalidate-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for sensivalidate-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06039bb6cc2ce3c49dc9101a140bc8c5adb0612bcbef0a34fdc37a4b46e708f9
MD5 90c829133c9134ed5bbf93a982c0ba7f
BLAKE2b-256 716557381c25b69d08404cc6e30e73e1441c98bc75efe48d7f60461c21b1e326

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