Forked from neopunisher/bypass-cloudflare-email-protection.js
Created
February 16, 2024 16:31
-
-
Save cliffordp/3fa819c1a4dfef4f945a03b7735cf2c7 to your computer and use it in GitHub Desktop.
How to circumvent Cloudflare's [email protected] thing, WITHOUT enabling Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://raddle.me/f/Privacy/3722/how-to-circumvent-cloudflare-s-email-protected-thing-without with the help of chatGPT | |
function fixObfuscatedEmails() { | |
const elements = document.getElementsByClassName('__cf_email__'); | |
for (let i = 0; i < elements.length; i++) { | |
const element = elements[i]; | |
const obfuscatedEmail = element.getAttribute('data-cfemail'); | |
if (obfuscatedEmail) { | |
const decodedEmail = decrypt(obfuscatedEmail); | |
element.setAttribute('href', 'mailto:' + decodedEmail); | |
element.innerHTML = decodedEmail; | |
} | |
} | |
} | |
function decrypt(obfuscatedEmail) { | |
let output = ''; | |
const xorKey = parseInt(obfuscatedEmail.substr(0, 2), 16); | |
for (let i = 2; i < obfuscatedEmail.length; i += 2) { | |
const charCode = parseInt(obfuscatedEmail.substr(i, 2), 16) ^ xorKey; | |
output += String.fromCharCode(charCode); | |
} | |
try { | |
output = decodeURIComponent(escape(output)); | |
} catch (error) { | |
console.error(error); | |
} | |
return output; | |
} | |
// Call the function to fix the obfuscated email addresses | |
fixObfuscatedEmails(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment