Skip to main content

Django app to obfuscate text data.

Project description

https://img.shields.io/pypi/v/django-db-obfuscator.svg https://img.shields.io/travis/oesah/django-db-obfuscator.svg Documentation Status Updates

Django app to obfuscate text data. Originally develop by Dipcode Software.

Compatibility

Tested with python 3.6, 3.7, 3.8 and Django 1.11 & 2.2: Travis CI

How to install

To install the app run:

$ pip install django-db-obfuscater

or add it to the list of requirements of your project.

Then add ‘obfuscator’ to your INSTALLED_APPS.

INSTALLED_APPS = [
    ...
    'obfuscator',
]

Example usage

On you django project settings, configure the model names and field names to be obfuscated:

OBFUSCATOR = {
    'FIELDS': {
        'app_label.ModelClass1': ['field1', 'field2', 'field3'],
        'app_label.ModelClass2': ['field1'],
        // ...
    }
}

Run the management command to start obfuscation:

$ python manage.py obfuscate

You can run the management command passing as arguments: a model class path and a list of fields to obfuscate (thus will ignore FIELDS setting):

$ python manage.py obfuscate --model=app_label.ModelClass1 --fields=field1, field2, field3

Settings reference

OBFUSCATOR_CLASS

Default: obfuscator.utils.ObfuscatorUtils

Path to class where obfuscator methods are defined. By default, the class define tow obfuscator methods: * text - Obfuscate simple text data, respecting max-length field parameter; * email - Obfuscate email data. Only text before @ is obfuscated, respecting max-length field parameter.

This class also define an obfuscate method. This method use fields mapping (see FIELDS_MAPPING setting) to route the field type with the obfuscate method.

You can redefine this class by subclassing the default class and changing this setting to point to your class.

FIELDS_MAPPING

Default:

{
    models.CharField: 'text',
    models.TextField: 'text',
    models.EmailField: 'email'
}

Map django model field types with obfuscator methods.

FIELDS

Default: {}

Fields to be obfuscated and respective model class path. Must be a dict with keys as python dot notation to path where the models are declared and the values must be declared as lists of model fields.

If no value defined, the management command will do nothing.

Example:

{
    'contenttypes.ContentType': ['model', 'label'],
    // ...
}

License

MIT license, see the LICENSE file. You can use obfuscator in open source projects and commercial products.

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

django-db-obfuscator-0.3.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

django_db_obfuscator-0.3.0-py2.py3-none-any.whl (10.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-db-obfuscator-0.3.0.tar.gz.

File metadata

  • Download URL: django-db-obfuscator-0.3.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

File hashes

Hashes for django-db-obfuscator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 54b0fe645bb74b8e39ba4e58c21fa921784bba766f6ec3e0652d21bf4aa864b4
MD5 3c6dcfe962d1ceb3a3a22cb10fee7ba4
BLAKE2b-256 ada4f0c5a7ce13b3e1c9334161d65b738a522f1fe6b1d1646736c9f6320eb001

See more details on using hashes here.

File details

Details for the file django_db_obfuscator-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_db_obfuscator-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

File hashes

Hashes for django_db_obfuscator-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6eb3f99e4bc62d0d1e08416e97e0dc3953c08b41f004bf8130ddc9f2167d1170
MD5 46b02333ff5ceef7c5a1602d72071e6d
BLAKE2b-256 d59ae9206856be441076e93c988f5a04187ab93b1076e6f587d8598a45f2efdb

See more details on using hashes here.

Supported by

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