{"id":16446482,"url":"https://github.com/edoardottt/defangjs","last_synced_at":"2025-03-21T05:30:35.076Z","repository":{"id":40272666,"uuid":"468453794","full_name":"edoardottt/defangjs","owner":"edoardottt","description":"URL / IP / Email defanging with Javascript. Make IoC harmless.","archived":false,"fork":false,"pushed_at":"2024-11-10T09:51:55.000Z","size":68,"stargazers_count":28,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T21:43:35.157Z","etag":null,"topics":["cti","defang","defanging","email","email-security","emailjs","evasion-attack","ioc","ip","javascript","javascript-library","malware","malware-protection","nodejs","phishing","phishing-attacks","phishing-protection","security-tools","url","url-defanging"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/defangjs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edoardottt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"edoardottt","liberapay":"edoardottt","patreon":"edoardottt","ko_fi":"edoardottt","open_collective":"edoardottt","custom":"https://www.paypal.me/edoardottt"}},"created_at":"2022-03-10T17:54:00.000Z","updated_at":"2025-03-15T01:12:27.000Z","dependencies_parsed_at":"2023-11-29T11:26:11.346Z","dependency_job_id":"a3fa4ecb-bd4d-436b-9a51-d32446a15c65","html_url":"https://github.com/edoardottt/defangjs","commit_stats":{"total_commits":60,"total_committers":1,"mean_commits":60.0,"dds":0.0,"last_synced_commit":"ad53cd04abf9c14049c21db7367e454958e32be8"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoardottt%2Fdefangjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoardottt%2Fdefangjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoardottt%2Fdefangjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoardottt%2Fdefangjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edoardottt","download_url":"https://codeload.github.com/edoardottt/defangjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130278,"owners_count":20402753,"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":["cti","defang","defanging","email","email-security","emailjs","evasion-attack","ioc","ip","javascript","javascript-library","malware","malware-protection","nodejs","phishing","phishing-attacks","phishing-protection","security-tools","url","url-defanging"],"created_at":"2024-10-11T09:47:43.763Z","updated_at":"2025-03-21T05:30:35.069Z","avatar_url":"https://github.com/edoardottt.png","language":"JavaScript","funding_links":["https://github.com/sponsors/edoardottt","https://liberapay.com/edoardottt","https://patreon.com/edoardottt","https://ko-fi.com/edoardottt","https://opencollective.com/edoardottt","https://www.paypal.me/edoardottt"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cb\u003edefangjs\u003c/b\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eURL / IP / Email defanging with Javascript\u003c/b\u003e\u003cbr\u003e\n  \u003ca href=\"https://www.npmjs.com/package/defangjs\"\u003e\u003cimg src=\"https://github.com/edoardottt/images/blob/main/defangjs/npm.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/defangjs\"\u003e\u003cimg src=\"https://github.com/edoardottt/images/blob/main/defangjs/ipv6.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/defangjs\"\u003e\u003cimg src=\"https://github.com/edoardottt/images/blob/main/defangjs/dependencies.svg\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://github.com/edoardottt/defangjs/blob/main/LICENSE\"\u003e\u003cimg src=\"https://github.com/edoardottt/images/blob/main/defangjs/license.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://runkit.com/edoardottt/runkit-npm-defangjs\"\u003e\u003cimg src=\"https://github.com/edoardottt/images/blob/main/defangjs/runkit.svg\"\u003e\u003c/a\u003e\n\u003cbr\u003e\n  \u003csub\u003eCoded with 💙 by edoardottt\u003c/sub\u003e\n\u003c/p\u003e\n\nDefanging 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).\n\n- [Blocking Email Links: Why we use HXXP in emails](https://privacymatters.ubc.ca/blocking-email-links-why-we-use-hxxp-emails)\n- [Email Security – Defanging URLs](https://www.ibm.com/docs/en/sqsp/32.0?topic=SSBRUQ_32.0.0/com.ibm.resilient.doc/install/resilient_install_defangURLs.htm)\n\nInstall ⬇️\n------\n\n```console\nnpm install defangjs@latest\n```\n\nUsage 🚀\n-------\n\n```Javascript\nvar defangjs = require('defangjs');\n\nvar url = 'https://edoardottt.com/index.html';\nconsole.log(defangjs.Url(url)); \n// hxxps[://]edoardottt[.]com/index.html\n\nvar maliciousIpv4 = '666.666.666.666';\nconsole.log(defangjs.Ip(maliciousIpv4)); \n// 666[.]666[.]666[.]666\n\nvar maliciousIpv6 = '2001:0db8:85a3:0000:0000:8a2e:0370:7334';\nconsole.log(defangjs.Ip(maliciousIpv6));\n// 2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7334\n\nvar maliciousEmail = 'mailto:edoardott@gmail.com';\nconsole.log(defangjs.Email(maliciousEmail));\n// mailto[:]edoardott@gmail[.]com\n```\n\nTest 🧑‍🏭\n-------\n\n```console\nnpm test\n```\n\nTake a look to [test.js](https://github.com/edoardottt/defangjs/blob/main/test.js), this file contains all the supported formats (URLs, various protocols, ports, Ipv4 and Ipv6 and email addresses)\n\nChangelog 📌\n-------\n\nDetailed changes for each release are documented in the [release notes](https://github.com/edoardottt/defangjs/releases).\n\nContributing 🤝\n------\n\nIf you want to contribute to this project, you can start opening an [issue](https://github.com/edoardottt/defangjs/issues).\n\nLicense 📝\n-------\n\nThis repository is under [GNU General Public License v3.0](https://github.com/edoardottt/defangjs/blob/main/LICENSE).  \n[edoardottt.com](https://edoardottt.com) to contact me.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedoardottt%2Fdefangjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedoardottt%2Fdefangjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedoardottt%2Fdefangjs/lists"}