{"id":25862738,"url":"https://github.com/romaklimenko/obfuscator","last_synced_at":"2025-03-01T23:56:25.835Z","repository":{"id":39919947,"uuid":"492035716","full_name":"romaklimenko/obfuscator","owner":"romaklimenko","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-04T11:36:02.000Z","size":383,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-02T06:03:27.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romaklimenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-13T20:43:31.000Z","updated_at":"2023-12-19T11:52:02.000Z","dependencies_parsed_at":"2023-02-18T16:00:59.855Z","dependency_job_id":null,"html_url":"https://github.com/romaklimenko/obfuscator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romaklimenko%2Fobfuscator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romaklimenko%2Fobfuscator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romaklimenko%2Fobfuscator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romaklimenko%2Fobfuscator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romaklimenko","download_url":"https://codeload.github.com/romaklimenko/obfuscator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241439768,"owners_count":19963100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-01T23:56:24.615Z","updated_at":"2025-03-01T23:56:25.808Z","avatar_url":"https://github.com/romaklimenko.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Obfuscator\n\n[![Code Style: Google](https://img.shields.io/badge/code%20style-google-blueviolet.svg)](https://github.com/google/gts)\n\nObfuscator is a simple tool that replaces JSON data with random values but preserves the data structure, types, and relations.\n\nThis tool becomes handy if you have a problem with a dataset that you can't share because it contains sensitive information. Obfuscator replaces all values in this dataset with random values (not with hash values), but it will keep the structure and JSON types intact.\n\nFor example, you have the following `employees.json` file:\n\n```json\n[\n  {\n    \"id\": 193,\n    \"department_id\": 10,\n    \"name\": \"Joe Sixpack\",\n    \"email\": \"nospam@spam.dev\",\n    \"phone\": \"+1-234-567-890\",\n    \"city\": \"New York\",\n    \"socialSecurityNumber\": \"555-55-5555\",\n    \"active\": true,\n    \"salary\": 10000\n  },\n  {\n    \"id\": 220,\n    \"department_id\": 12,\n    \"name\": \"Jane Plain\",\n    \"email\": \"me@main.none\",\n    \"city\": \"New York\",\n    \"phone\": \"+2-345-678-901\",\n    \"socialSecurityNumber\": \"777-77-7777\",\n    \"active\": false,\n    \"salary\": 150000\n  }\n]\n```\nAnd `departments.json` file in the same directory:\n```json\n[\n  {\n    \"id\": 10,\n    \"name\": \"HR\"\n  },\n  {\n    \"id\": 12,\n    \"name\": \"Sales\"\n  }\n]\n```\n\nIf you haven't installed Obfuscator yet, run this command:\n\n```shell\nnpm install -g data-obfuscator\n```\n\nAnd then, just `cd` to your directory with the JSON files run `obfuscate`. Obfuscator will create a file per every JSON file in the directory. So, for our example, it will make `employees.obfuscated.json`:\n\n```JSON\n[\n  {\n    \"id\": 961,\n    \"department_id\": 87,\n    \"name\": \"J5A CIWZLao\",\n    \"email\": \"RPYAh6@cqz0.2Cn\",\n    \"phone\": \"+7-514-949-061\",\n    \"city\": \"X9A zUS4\",\n    \"socialSecurityNumber\": \"972-82-8282\",\n    \"active\": true,\n    \"salary\": 58635\n  },\n  {\n    \"id\": 571,\n    \"department_id\": 5,\n    \"name\": \"RIz1 X9ve0\",\n    \"email\": \"1E@LrVW.RBo1\",\n    \"city\": \"X9A zUS4\",\n    \"phone\": \"+5-330-447-822\",\n    \"socialSecurityNumber\": \"137-42-7934\",\n    \"active\": false,\n    \"salary\": 243046\n  }\n]\n```\n\n`departments.obfuscated.json`:\n\n```JSON\n[\n  {\n    \"id\": 87,\n    \"name\": \"OL\"\n  },\n  {\n    \"id\": 5,\n    \"name\": \"JmzX0\"\n  }\n]\n```\n\nAnd `clues.json`:\n```JSON\n[\n  {\n    \"before\": 10,\n    \"_after\": 87\n  },\n  {\n    \"before\": \"HR\",\n    \"_after\": \"OL\"\n  },\n  {\n    \"before\": 12,\n    \"_after\": 5\n  },\n  {\n    \"before\": \"Sales\",\n    \"_after\": \"JmzX0\"\n  },\n  {\n    \"before\": 193,\n    \"_after\": 961\n  },\n  {\n    \"before\": \"Joe Sixpack\",\n    \"_after\": \"J5A CIWZLao\"\n  },\n  {\n    \"before\": \"nospam@spam.dev\",\n    \"_after\": \"RPYAh6@cqz0.2Cn\"\n  },\n  {\n    \"before\": \"+1-234-567-890\",\n    \"_after\": \"+7-514-949-061\"\n  },\n  {\n    \"before\": \"New York\",\n    \"_after\": \"X9A zUS4\"\n  },\n  {\n    \"before\": \"555-55-5555\",\n    \"_after\": \"972-82-8282\"\n  },\n  {\n    \"before\": 10000,\n    \"_after\": 58635\n  },\n  {\n    \"before\": 220,\n    \"_after\": 571\n  },\n  {\n    \"before\": \"Jane Plain\",\n    \"_after\": \"RIz1 X9ve0\"\n  },\n  {\n    \"before\": \"me@main.none\",\n    \"_after\": \"1E@LrVW.RBo1\"\n  },\n  {\n    \"before\": \"+2-345-678-901\",\n    \"_after\": \"+5-330-447-822\"\n  },\n  {\n    \"before\": \"777-77-7777\",\n    \"_after\": \"137-42-7934\"\n  },\n  {\n    \"before\": 150000,\n    \"_after\": 243046\n  }\n]\n```\n\nThe `clues.json` links the original values and the newly generated random values. So you can now share the two obfuscated files with your colleague and keep `clues.json` if you need to map the randomly generated values back to the original ones.\n\nHowever, you still need to be careful with the data: the default implementation of Obfuscator preserves string lengths, spaces, dots, \"at signs\" (@), and a couple more symbols to keep emails, GUIDs, and text look more natural.\nIt also doesn't change `null` and boolean values.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromaklimenko%2Fobfuscator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromaklimenko%2Fobfuscator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromaklimenko%2Fobfuscator/lists"}