Created
October 13, 2024 10:56
-
-
Save Ap0dexMe0/12092c815c22e4b6415f8444341f16bb to your computer and use it in GitHub Desktop.
Challenge/License Mirroring Decoding
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
| // MIRRORING LOGIC START | |
| const originalCreateSessionFn = MediaKeys.prototype.createSession; | |
| MediaKeys.prototype.createSession = function() { | |
| const session = originalCreateSessionFn.apply(this, arguments); | |
| session.addEventListener("message", event => { | |
| const payload = btoa(String.fromCharCode.apply(null, new Uint8Array(event.message))); | |
| fetch("http://127.0.0.1:1337/dev/widevine/responseLicense", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ license_challenge: payload }), | |
| }) | |
| .then(response => response.text()) | |
| .then(data => { | |
| console.log("%c[L33T.MY] - Message event intercepted:", "color: red"); | |
| console.log("%cPayload:", "color: green", payload); | |
| console.log("%cResponse:", "color: green", data); | |
| fetch("http://127.0.0.1:1337/dev/widevine/requestLicense", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ license_challenge: payload }), | |
| }) | |
| .then(response => response.text()) | |
| .then(data => { | |
| console.log("%c[L33T.MY] - License request sent:", "color: red"); | |
| console.log("%cResponse:", "color: green", data); | |
| }) | |
| .catch(error => { | |
| console.error("%cError sending license request:", "color: red", error); | |
| }); | |
| }) | |
| .catch(error => { | |
| console.error("%cError fetching license:", "color: red", error); | |
| }); | |
| }); | |
| const originalUpdateFn = session.update; | |
| session.update = function(config) { | |
| console.log("%c[L33T.MY] - Update event intercepted:", "color: red"); | |
| console.log("%cConfig:", "color: green", JSON.stringify(config)); | |
| return originalUpdateFn.apply(this, arguments); | |
| }; | |
| session.addEventListener("keystatuseschange", event => { | |
| const keyStatuses = Array.from(event.target.keyStatuses.entries()).map(([keyId, status]) => ({ keyId, status })); | |
| console.log("%c[L33T.MY] - MediaKeySession::keystatuseschange Session ID: " + session.sessionId, "color: red"); | |
| console.log("%cKey Statuses:", "color: green", JSON.stringify(keyStatuses)); | |
| }); | |
| session.addEventListener("encrypted", event => { | |
| console.log("%c[L33T.MY] - MediaKeySession::encrypted Session ID: " + session.sessionId, "color: red"); | |
| console.log("%cEncrypted data:", "color: green", event.initData); | |
| console.log("%cMedia initialization data:", "color: green", event.initDataType); | |
| }); | |
| return session; | |
| }; | |
| const originalSetServerCertificateFn = MediaKeys.prototype.setServerCertificate; | |
| MediaKeys.prototype.setServerCertificate = function(serverCertificate) { | |
| const base64Certificate = btoa(String.fromCharCode.apply(null, serverCertificate)); | |
| console.log("%c[L33T.MY] - SetServerCertificate event intercepted:", "color: red"); | |
| console.log("%cServer Certificate:", "color: green", JSON.stringify({ certificate: base64Certificate })); | |
| return originalSetServerCertificateFn.apply(this, arguments); | |
| }; | |
| const originalFetch = window.fetch; | |
| window.fetch = function(request, options) { | |
| if (typeof request === "string" && request.endsWith(".mpd")) { | |
| console.log("%c[L33T.MY] - MPD manifest requested:", "color: red"); | |
| console.log("%cManifest URL:", "color: green", request); | |
| } | |
| return originalFetch.apply(this, arguments); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment