Created
March 4, 2018 13:51
-
-
Save samdenty/450f87af61a8d8fb697610cce273656c to your computer and use it in GitHub Desktop.
PoC discord realtime message decryption engine
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
(() => { | |
let styles = ` | |
.un-decryptable, | |
.encrypted-msg { | |
background-color: rgba(255, 141, 0, 0.29); | |
padding: 5px; | |
border-radius: 5px; | |
} | |
.un-decryptable::before, | |
.encrypted-msg::before { | |
content: "Decrypted message: "; | |
display: block; | |
font-weight: bold; | |
padding-bottom: 10px; | |
margin-bottom: 10px; | |
border-bottom: 1px solid rgba(255, 255, 255, 0.39); | |
} | |
.un-decryptable { | |
background-color: rgba(255, 0, 0, 0.29) | |
} | |
.un-decryptable::before { | |
content: "Failed to decrypt message!"; | |
} | |
` | |
let css = document.createElement('style') | |
css.innerHTML = styles | |
document.head.appendChild(css) | |
})(); | |
function decrypt() { | |
let prefix = `[ENCRYPTED]` | |
let messages = document.getElementsByClassName('markup') | |
for (let i = 0; i < messages.length; i++) { | |
let message = messages[i].innerHTML | |
if (messages[i].classList.contains('un-decryptable')) return | |
if (message && message.startsWith(prefix)) { | |
let decrypted = message.replace(prefix, '') | |
try { | |
decrypted = atob(decrypted) | |
messages[i].classList.add('encrypted-msg') | |
messages[i].innerHTML = ( | |
decrypted | |
.replace(/&/g, '&') | |
.replace(/>/g, '>') | |
.replace(/</g, '<') | |
.replace(/"/g, '"') | |
) | |
} catch(e) { | |
messages[i].classList.add('un-decryptable') | |
return | |
} | |
} | |
} | |
} | |
clearInterval(window.discordCrypt) | |
window.discordCrypt = setInterval(decrypt, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment