defangjs
defangjs copied to clipboard
URL / IP / Email defanging with Javascript. Make IoC harmless.
defangjs
URL/IP/Email defanging with Javascript
Coded with 💙 by edoardottt
Defanging is the process where URLs, IPs, and email addresses no longer become effective (or clickable if you want). Why? Links can be used for phishing or it's simply safer to display them in a weakened way if they are malicious resources (eg. Indicators of compromise for a malware).
Install ⬇️
npm install defangjs@latest
Usage 🚀
var defangjs = require('defangjs');
var url = 'https://www.edoardoottavianelli.it/index.html';
console.log(defangjs.Url(url));
// --> hxxps[://]www[.]edoardoottavianelli[.]it/index.html
var maliciousIp = '666.666.666.666';
console.log(defangjs.Ip(maliciousIp));
// --> 666[.]666[.]666[.]666
Take a look to test.js, this file contains all the supported formats (various protocols, ports, Ipv4 and Ipv6...)
Test 🧑🏭
npm test
Changelog 📌
Detailed changes for each release are documented in the release notes.
Contributing 🤝
If you want to contribute to this project, you can start opening an issue.
License 📝
This repository is under GNU General Public License v3.0.
edoardoottavianelli.it to contact me.