fanger
Defang and refang IoC
Last updated 17 days ago by ninoseki .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fanger 
SYNC missed versions from official npm registry.

fanger

npm version Build Status CodeFactor Coverage Status

fanger is an npm package for defang and refang IoC.

What are defang and refang

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)

Installation

npm install fanger -g

Usage

As a CLI

$ echo "example.com" | defang
example[.]com

$ echo "test@example.com" | defang
test@example[.]com

$ echo "https://example.com" | defang
hxxps://example[.]com
$ echo "example[.]com" | refang
example.com

$ echo "test@example[.]com" | refang
test@example.com

$ echo "hxxps://example[.]com" | refang
https://example.com

As a library

import { defang, refang } from "fanger";

const text = "example.com";
console.log(defang(text));
// example[.]com

const defangedText = "example[.]com";
console.log(refang(defangedText));
// example.com

Supported defang/refang techniques

Defang

The following defang techniques are supported.

IPv4

  • 1.1.1.1 => 1[.]1.1.1

The first dot of an IPv4 will be replaced with [.].

Domain

  • example.com => example[.]com
  • test.com.example.com => test[.]com.example[.]com

A dot before a label which is registered as a TLD will be replaced with [.].

HTTP scheme

  • http => hxxp
  • https => hxxps

Supported refang techniques

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
hxxp => http hxxps://google.com https://google.com
[at] => @ test[at]example.com test@example.com
[@] => @ test[@]example.com test@example.com
(@) => @ test(@)example.com test@example.com
[dot] => . test@example[dot]com test@example.com
(dot) => . test@example(dot)com test@example.com
Partial 1.1.1[.1 1.1.1.1
Any combination hxxps[:]//test\.example[.)com[/]path https://test.example.com/path

Current Tags

  • 0.2.4                                ...           latest (17 days ago)

12 Versions

  • 0.2.4                                ...           17 days ago
  • 0.2.3                                ...           4 months ago
  • 0.2.2                                ...           6 months ago
  • 0.2.1                                ...           7 months ago
  • 0.2.0                                ...           7 months ago
  • 0.1.7                                ...           8 months ago
  • 0.1.6                                ...           9 months ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 12
Dependencies (3)
Dev Dependencies (16)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |