Last active
June 11, 2023 02:34
-
-
Save optionsx/3f1fa9a8e02ba6a219b28e02138c7162 to your computer and use it in GitHub Desktop.
xc.com RE
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
fetch('https://xc.com/js/tripledes.js') | |
.then(res => res.text()) | |
.then(source => { | |
eval(source.replace('export { encryptByDES, decryptByDES }', '')); | |
const decryptKey = 'iZTE2V29USHROXhH'; | |
const encryptKey = 'Yo2NpZNkgVGRKSWN'; | |
CHAT_API.ws.addEventListener('message', ({ data }) => { | |
const decrypted = JSON.parse(decryptByDES(arrToB64(data), decryptKey))?.result?.text; | |
decrypted && console.log(decrypted); | |
}); | |
const data = { | |
id: Date.now(), | |
method: '/chat/dialog/text', | |
params: { | |
msgText: 'Hello?' | |
} | |
}; | |
CHAT_API.ws.send(bToArr(encryptByDES(JSON.stringify(data), encryptKey))); | |
}); | |
function base64ToArrayBuffer(b64) { | |
return Uint8Array.from(atob(b64), char => char.charCodeAt(0)).buffer | |
} | |
function ArrayBufferToBase64(bfr) { | |
return btoa(String.fromCharCode(...new Uint8Array(bfr))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment