Skip to content

Instantly share code, notes, and snippets.

@neopunisher
Last active February 16, 2024 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neopunisher/e8f561068e696f58f05397ad924b95cc to your computer and use it in GitHub Desktop.
Save neopunisher/e8f561068e696f58f05397ad924b95cc to your computer and use it in GitHub Desktop.
How to circumvent Cloudflare's [email protected] thing, WITHOUT enabling Javascript
// 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();
@neopunisher
Copy link
Author

More solutions for other languages https://usamaejaz.com/cloudflare-email-decoding/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment