unaware is a command-line tool for masking sensitive data within JSON, XML, and CSV files. It processes data from files or stdin and anonymizes specified property values. These values mimick the length and appearance of their original data types.
The program is a cross-platform, statically linked binary with no external dependencies. It leverages streaming and concurrency to efficiently process large files offline.
Build the program from source:
go build -o unaware main.goAlternatively, check the releases page for pre-built binaries.
Anonymize data in JSON, XML, and CSV files by replacing values with realistic-looking alternatives.
Use the -method deterministic option to preserve relationships by ensuring identical
input values get the same masked output value. By default every run uses a
random salt, use STATIC_SALT=test123 environment variable for consistent
masking.
-cpu int
Numbers of cpu cores used (default 4)
-exclude value
Glob pattern to exclude keys from masking (can be specified multiple times)
-format string
The format of the input data (json, xml, csv or text) (default "json")
-in string
Input file path (default: stdin)
-include value
Glob pattern to include keys for masking (can be specified multiple times)
-method string
Method of masking (random or deterministic) (default "random")
-out string
Output file path (default: stdout)
./unaware -in source.json -out anonymized.jsoncat source.xml | ./unaware -format xml -method deterministic > masked.xmlYou can control which fields are masked using the -include and -exclude flags, which both accept glob patterns (e.g., user.*, session.ip_*, **.email, user.*.id).
- Default Behavior: If no flags are used, all fields are masked.
- Using
-include: Specifies which fields should be masked. When-includepatterns are used, only fields matching them will be considered for masking. - Using
-exclude: Specifies fields that should not be masked, creating exceptions. - Combining Flags: When used together,
-excludealways takes precedence. A field is only masked if it matches an-includepattern but does not match an-excludepattern. If only-excludeis used, all fields are masked except for those that match an exclusion pattern.