fanger is an npm package for defang and refang IoC.
Defang means to change a part of IoC to make inaccessible or unclickable. (e.g. example.com => example[.]com)
Refang means to revert a defanged IoC to the original one. (e.g. example[.]com => example.com)
npm install fanger -g$ echo "example.com" | defang
example[.]com
$ echo "[email protected]" | defang
test[@[example[.]com
$ echo "https://example.com" | defang
hxxps://example[.]com$ echo "example[.]com" | refang
example.com
$ echo "test[@]example[.]com" | refang
[email protected]
$ echo "hxxps://example[.]com" | refang
https://example.comimport { defang, refang } from "fanger";
const text = "example.com";
console.log(defang(text));
// example[.]com
const defangedText = "example[.]com";
console.log(refang(defangedText));
// example.comThe following defang techniques are supported.
The following refang techniques are supported.
| Techniques | Defanged | Refanged |
|---|---|---|
| Remove spaces | 1.1.1 . 1 |
1.1.1.1 |
[.] => . |
1.1.1[.]1 |
1.1.1.1 |
(.) => . |
1.1.1(.)1 |
1.1.1.1 |
{.} => . |
1.1.1{.}1 |
1.1.1.1 |
\. => . |
example\.com |
example.com |
[/] => / |
http://example.com[/]path |
http://example.com/path |
[:] => : |
http[:]//example.com |
http://example.com |
[://] => :// |
http[://]example.com |
http://example.com |
hxxp => http |
hxxps://google.com |
https://google.com |
[at] => @ |
test[at]example.com |
[email protected] |
[@] => @ |
test[@]example.com |
[email protected] |
(@) => @ |
test(@)example.com |
[email protected] |
[dot] => . |
test@example[dot]com |
[email protected] |
(dot) => . |
test@example(dot)com |
[email protected] |
{dot} => . |
test@example{dot}com |
[email protected] |
| Partial | 1.1.1[.1 |
1.1.1.1 |
| Any combination | hxxps[:]//test\.example[.)com[/]path |
https://test.example.com/path |