{"id":15434373,"url":"https://github.com/ninoseki/fanger","last_synced_at":"2025-04-19T18:09:29.188Z","repository":{"id":41490368,"uuid":"194457741","full_name":"ninoseki/fanger","owner":"ninoseki","description":"An npm package to defang and refang IoC","archived":false,"fork":false,"pushed_at":"2023-05-06T04:28:37.000Z","size":1371,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T21:00:51.919Z","etag":null,"topics":["indicators-of-compromise"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ninoseki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-29T23:49:15.000Z","updated_at":"2025-04-05T17:49:32.000Z","dependencies_parsed_at":"2024-06-19T01:27:51.838Z","dependency_job_id":"9616eb36-d316-44d0-9c6c-c38199daf85a","html_url":"https://github.com/ninoseki/fanger","commit_stats":{"total_commits":90,"total_committers":3,"mean_commits":30.0,"dds":"0.022222222222222254","last_synced_commit":"ce38cbf549fa9b23180c59a01cc2ccb335f0b59c"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninoseki%2Ffanger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninoseki%2Ffanger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninoseki%2Ffanger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ninoseki%2Ffanger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ninoseki","download_url":"https://codeload.github.com/ninoseki/fanger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249758843,"owners_count":21321610,"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":["indicators-of-compromise"],"created_at":"2024-10-01T18:39:03.540Z","updated_at":"2025-04-19T18:09:29.168Z","avatar_url":"https://github.com/ninoseki.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fanger\n\n[![npm version](https://badge.fury.io/js/fanger.svg)](https://badge.fury.io/js/fanger)\n![Node.js CI](https://github.com/ninoseki/fanger/workflows/Node.js%20CI/badge.svg)\n[![CodeFactor](https://www.codefactor.io/repository/github/ninoseki/fanger/badge)](https://www.codefactor.io/repository/github/ninoseki/fanger)\n[![Coverage Status](https://coveralls.io/repos/github/ninoseki/fanger/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/fanger?branch=master)\n\nfanger is an npm package for defang and refang IoC.\n\n## What are defang and refang\n\nDefang means to change a part of IoC to make inaccessible or unclickable. (e.g. `example.com` =\u003e `example[.]com`)\n\nRefang means to revert a defanged IoC to the original one. (e.g. `example[.]com` =\u003e `example.com`)\n\n## Installation\n\n```bash\nnpm install fanger -g\n```\n\n## Usage\n\n### As a CLI\n\n```bash\n$ echo \"example.com\" | defang\nexample[.]com\n\n$ echo \"test@example.com\" | defang\ntest@example[.]com\n\n$ echo \"https://example.com\" | defang\nhxxps://example[.]com\n```\n\n```bash\n$ echo \"example[.]com\" | refang\nexample.com\n\n$ echo \"test@example[.]com\" | refang\ntest@example.com\n\n$ echo \"hxxps://example[.]com\" | refang\nhttps://example.com\n```\n\n#### As a library\n\n```typescript\nimport { defang, refang } from \"fanger\";\n\nconst text = \"example.com\";\nconsole.log(defang(text));\n// example[.]com\n\nconst defangedText = \"example[.]com\";\nconsole.log(refang(defangedText));\n// example.com\n```\n\n## Supported defang/refang techniques\n\n### Defang\n\nThe following defang techniques are supported.\n\n#### IPv4\n\n- `1.1.1.1` =\u003e `1[.]1.1.1`\n\nThe first dot of an IPv4 will be replaced with `[.]`.\n\n#### Domain\n\n- `example.com` =\u003e `example[.]com`\n- `test.com.example.com` =\u003e `test[.]com.example[.]com`\n\nA dot before a label which is registered as a TLD will be replaced with `[.]`.\n\n#### HTTP scheme\n\n- `http` =\u003e `hxxp`\n- `https` =\u003e  `hxxps`\n\n### Supported refang techniques\n\nThe following refang techniques are supported.\n\n| Techniques       | Defanged                               | Refanged                        |\n|------------------|----------------------------------------|---------------------------------|\n| Remove spaces    | `1.1.1 . 1`                            | `1.1.1.1`                       |\n| `[.]` =\u003e `.`     | `1.1.1[.]1`                            | `1.1.1.1`                       |\n| `(.)` =\u003e `.`     | `1.1.1(.)1`                            | `1.1.1.1`                       |\n| `{.}` =\u003e `.`     | `1.1.1{.}1`                            | `1.1.1.1`                       |\n| `\\.`  =\u003e `.`     | `example\\.com`                         | `example.com`                   |\n| `[/]` =\u003e `/`     | `http://example.com[/]path`            | `http://example.com/path`       |\n| `[:]` =\u003e `:`     | `http[:]//example.com`                 | `http://example.com`            |\n| `[://]` =\u003e `://` | `http[://]example.com`                 | `http://example.com`            |\n| `hxxp` =\u003e `http` | `hxxps://google.com`                   | `https://google.com`            |\n| `[at]` =\u003e `@`    | `test[at]example.com`                  | `test@example.com`              |\n| `[@]` =\u003e `@`     | `test[@]example.com`                   | `test@example.com`              |\n| `(@)` =\u003e `@`     | `test(@)example.com`                   | `test@example.com`              |\n| `[dot]` =\u003e `.`   | `test@example[dot]com`                 | `test@example.com`              |\n| `(dot)` =\u003e `.`   | `test@example(dot)com`                 | `test@example.com`              |\n| `{dot}` =\u003e `.`   | `test@example{dot}com`                 | `test@example.com`              |\n| Partial          | `1.1.1[.1`                             | `1.1.1.1`                       |\n| Any combination  | `hxxps[:]//test\\.example[.)com[/]path` | `https://test.example.com/path` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninoseki%2Ffanger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fninoseki%2Ffanger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninoseki%2Ffanger/lists"}