Update 2
- Added persistent injection for sites that use polyfill - Fix overflow on top bar
This commit is contained in:
parent
358be057bb
commit
67e2a11258
1
frontend/.gitignore
vendored
1
frontend/.gitignore
vendored
@ -8,7 +8,6 @@ pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
|
52
frontend/dist/assets/index-BFZJq4X0.js
vendored
Normal file
52
frontend/dist/assets/index-BFZJq4X0.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
frontend/dist/assets/index-UaipKa9p.css
vendored
Normal file
1
frontend/dist/assets/index-UaipKa9p.css
vendored
Normal file
File diff suppressed because one or more lines are too long
13
frontend/dist/index.html
vendored
Normal file
13
frontend/dist/index.html
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CDRM Decryption Extension</title>
|
||||
<script type="module" crossorigin src="./assets/index-BFZJq4X0.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-UaipKa9p.css">
|
||||
</head>
|
||||
<body class="min-w-full min-h-full w-full h-full">
|
||||
<div class="min-w-full min-h-full w-full h-full" id="root"></div>
|
||||
</body>
|
||||
</html>
|
@ -42,7 +42,7 @@ function TopNav({ onMenuClick }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-full h-full flex flex-row">
|
||||
<div className="w-full h-full flex flex-row overflow-x-hidden">
|
||||
<img
|
||||
src={hamburgerIcon}
|
||||
alt="Menu"
|
||||
|
61
inject.js
61
inject.js
@ -11,6 +11,8 @@ let originalChallenge = null;
|
||||
let widevineDeviceInfo = null;
|
||||
let playreadyDeviceInfo = null;
|
||||
let drmOveride = "DISABLED"
|
||||
let serviceCertificate = null;
|
||||
|
||||
|
||||
window.postMessage({ type: "__GET_DRM_OVERRIDE__" }, "*");
|
||||
|
||||
@ -626,29 +628,45 @@ MediaKeySession.prototype.generateRequest = async function(initDataType, initDat
|
||||
|
||||
// === Intercept License or EME Messages ===
|
||||
if (!messageSuppressed && interceptType === 'EME') {
|
||||
session.addEventListener("message", function originalMessageInterceptor(event) {
|
||||
event.stopImmediatePropagation();
|
||||
console.log("[Intercepted EME Message] Injecting custom message.");
|
||||
console.log(event.data);
|
||||
let intercepted = false;
|
||||
|
||||
const uint8 = base64ToUint8Array(customBase64);
|
||||
const arrayBuffer = uint8.buffer;
|
||||
const messageInterceptor = function(event) {
|
||||
const uint8View = new Uint8Array(event.message);
|
||||
const base64String = btoa(String.fromCharCode(...uint8View));
|
||||
|
||||
const syntheticEvent = new MessageEvent("message", {
|
||||
data: event.data,
|
||||
origin: event.origin,
|
||||
lastEventId: event.lastEventId,
|
||||
source: event.source,
|
||||
ports: event.ports
|
||||
});
|
||||
if (base64String === "CAQ=") {
|
||||
console.log("[CAQ] Detected - letting original message through.");
|
||||
return; // Allow original message
|
||||
}
|
||||
|
||||
Object.defineProperty(syntheticEvent, "message", {
|
||||
get: () => arrayBuffer
|
||||
});
|
||||
console.log(syntheticEvent);
|
||||
setTimeout(() => session.dispatchEvent(syntheticEvent), 0);
|
||||
}, { once: true });
|
||||
if (!intercepted) {
|
||||
intercepted = true;
|
||||
event.stopImmediatePropagation();
|
||||
console.log("[Intercepted EME Message] Injecting custom message.");
|
||||
|
||||
const uint8 = base64ToUint8Array(customBase64);
|
||||
const arrayBuffer = uint8.buffer;
|
||||
|
||||
const syntheticEvent = new MessageEvent("message", {
|
||||
data: event.data,
|
||||
origin: event.origin,
|
||||
lastEventId: event.lastEventId,
|
||||
source: event.source,
|
||||
ports: event.ports
|
||||
});
|
||||
|
||||
Object.defineProperty(syntheticEvent, "message", {
|
||||
get: () => arrayBuffer
|
||||
});
|
||||
|
||||
setTimeout(() => session.dispatchEvent(syntheticEvent), 0);
|
||||
|
||||
// Remove after interception
|
||||
session.removeEventListener("message", messageInterceptor);
|
||||
}
|
||||
};
|
||||
|
||||
session.addEventListener("message", messageInterceptor);
|
||||
messageSuppressed = true;
|
||||
}
|
||||
|
||||
@ -692,6 +710,8 @@ MediaKeySession.prototype.update = function(response) {
|
||||
|
||||
// Handle Service Certificate
|
||||
if (base64Response.startsWith("CAUS") && !firstValidServiceCertificate) {
|
||||
console.log("[Service Certificate] Found:", base64Response);
|
||||
serviceCertificate = base64Response;
|
||||
const base64ServiceCertificateData = {
|
||||
type: "__CERTIFICATE_DATA__",
|
||||
data: base64Response
|
||||
@ -785,6 +805,7 @@ window.fetch = async function(input, init = {}) {
|
||||
if (method === "POST") {
|
||||
const url = typeof input === "string" ? input : input.url;
|
||||
let body = init.body;
|
||||
|
||||
|
||||
// If the body is FormData, convert it to an object (or JSON)
|
||||
if (body instanceof FormData) {
|
||||
@ -807,6 +828,7 @@ window.fetch = async function(input, init = {}) {
|
||||
|
||||
// Handle body based on its type
|
||||
if (typeof body === 'string') {
|
||||
|
||||
if (isJson(body)) {
|
||||
const parsed = JSON.parse(body);
|
||||
if (jsonContainsValue(parsed, customBase64)) {
|
||||
@ -834,6 +856,7 @@ window.fetch = async function(input, init = {}) {
|
||||
sendToBackground({ url, method, headers, body: modifiedBody });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Ensure the modified body is used and passed to the original fetch call
|
||||
init.body = modifiedBody;
|
||||
|
@ -4,24 +4,28 @@
|
||||
"version": "2.0",
|
||||
"description": "Decrypt DRM Protected content",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"tabs",
|
||||
"activeTab",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"<all_urls>"
|
||||
"<all_urls>",
|
||||
"activeTab",
|
||||
"storage",
|
||||
"tabs",
|
||||
"contextMenus"
|
||||
],
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
"scripts": ["background.js"],
|
||||
"persistent": true
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["content.js"],
|
||||
"run_at": "document_start"
|
||||
"run_at": "document_start",
|
||||
"all_frames": true
|
||||
}
|
||||
],
|
||||
"web_accessible_resources": ["inject.js"],
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"16": "icons/icon16.png",
|
||||
|
Loading…
x
Reference in New Issue
Block a user