email-decode.user.js (822B)
- // ==UserScript==
- // @name CloudFlare email-decode
- // @namespace https://hacktivis.me/
- // @description decode cloudflare-obfuscated “emails”
- // @include http://shodan.io/*
- // @version 1.0.1
- // @grant none
- // ==/UserScript==
- function cfDecodeEmail(encodedString)
- {
- var email = "", r = parseInt(encodedString.substr(0, 2), 16), n, i;
- for(n = 2; encodedString.length - n; n += 2)
- {
- i = parseInt(encodedString.substr(n, 2), 16) ^ r;
- email += String.fromCharCode(i);
- }
- return email;
- }
- const cf_emails = document.getElementsByClassName("__cf_email__");
- var email = "";
- for (i = 0; i < cf_emails.length; i++) {
- try {
- email = cfDecodeEmail(cf_emails[i].getAttribute("data-cfemail"));
- cf_emails[i].setAttribute("href", "mailto:"+email);
- cf_emails[i].innerText = email;
- } catch {}
- }