brootware / redact-py

Redaction CLi Tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLI tool to enable redaction of sensitive information.

GitHub Workflow Status Tested with Bandit GitHub Pipenv locked Python version

Description

Data redaction tool for text files

This tool will help you ensure that sensitive information is not unintentionally sent out of your organization.

There are times that troubleshooting issues may require your vendor to analyse your log files. Ideally sensitive information such as IP addresses, hostnames, email addresses and even personal information might need to be redacted / masked.

Most of the time, redacting such information is reliant on the engineer eyeballing / searching and replacing sensitive information. Needless to say this is prone to human error and can sometimes take up a lot of an engineer's time.

Redactor helps by maintaining a repository of patterns that can be used over and over again to redact files in seconds. Tested timings on redacting a 4GB log file takes less than a minute

The tool is configured so that developers may expand on this by using redactor as a module. Or users may just opt to install the tool and run the tool in command line.

Installation

On command prompt (windows should be similar)

  1. $ git clone https://github.com/ben-labs/redact-py.git
  2. $ cd redact-py
  3. $ pip install .

Checking if installation was properly done

$ redactor -h

You should see the help file as below:

Alt

Usage:

Basic Redacting

  1. $ redactor test_sample2.txt
  2. Basic Redaction

Sample Result:

Sample

Rule files

You can create your own rule files and feed it to redactor with the -r flag. Sample of what a redaction rule file will look like:

Sample Rule File

Attribute Description
pattern Regex pattern of string to find
mask Replace found patterns with the mask
Description Non-Mandatory description

Optional Flags usable:

Flag Description
-h, --help Displays help message
-r RULEFILE, --rulefile RULEFILE Sets a custom rulefile
-o OUTPATH, --outpath OUTPATH Specify a directory to dump redacted files. Creates one if directory is not there.

Sample Files

About

Redaction CLi Tool

License:MIT License


Languages

Language:Python 100.0%