logo

scripts

A bunch of scripts, some to be moved to their own repository
commit: c7f2cef4f64b092b68308ad0c8c96b678f03a478
parent: 6a2030d10ed2a8b4d4605a8fc8a3bbc9986a1b0e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 27 Nov 2018 04:01:03 +0100

…/email-decode.user.js: New

Diffstat:

Ajavascript/userscript/email-decode.user.js32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)

diff --git a/javascript/userscript/email-decode.user.js b/javascript/userscript/email-decode.user.js @@ -0,0 +1,32 @@ +// ==UserScript== +// @name CloudFlare email-decode +// @namespace https://hacktivis.me/ +// @description decode cloudflare-obfuscated “emails” +// @include http://shodan.io/* +// @version 1.0.0 +// @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; + } +}