This commit is contained in:
FoxRefire 2024-04-13 06:20:33 +09:00
parent 09c6468b08
commit 078268b069
4 changed files with 89 additions and 4 deletions

View File

@ -30,8 +30,6 @@
### Todo
* Support custom payload scheme
* Improve UI
### Disclaimer

View File

@ -29,7 +29,7 @@
<input type="button" id="licenseButton" value="Select" /><br>
<label for="scheme">Challenge scheme</label>
<select id="challengeScheme">
<select id="scheme">
<option value="CommonWV">CommonWV</option>
<option value="DRMToday">DRMToday</option>
</select><br>

View File

@ -1,4 +1,5 @@
import CommonWV from './schemes/CommonWV.js';
import DRMToday from './schemes/DRMToday.js';
let psshs=chrome.extension.getBackgroundPage().getPsshs();
let requests=chrome.extension.getBackgroundPage().getRequests();
@ -30,7 +31,16 @@ function handleRadioChange(event) {
}
async function guess(){
const result=await CommonWV(document.getElementById('guessr').value,
let WVScheme;
switch (document.getElementById('scheme').value) {
case "CommonWV":
WVScheme=CommonWV;
break;
case "DRMToday":
WVScheme=DRMToday;
break;
}
const result=await WVScheme(document.getElementById('guessr').value,
document.getElementById('pssh').value,
requests[userInputs['license']]['url'],
requests[userInputs['license']]['headers'])

77
schemes/DRMToday.js Normal file
View File

@ -0,0 +1,77 @@
export default async function(serverAddr, pssh, licUrl,_headers) {
console.group("fetch cert...");
let certBuffer = await fetch(licUrl, {
body: new Uint8Array([0x08, 0x04]),
headers: _headers,
method: "POST",
}).then((resp) => resp.arrayBuffer());
let certB64 = "";
if (isValidJson(String.fromCharCode(...new Uint8Array(certBuffer)))) {
let jsonData = JSON.parse(
String.fromCharCode(...new Uint8Array(certBuffer))
);
if (jsonData.license) {
certB64 = jsonData.license;
} else {
console.log("JSON does not contain 'license'");
}
} else {
certB64 = btoa(String.fromCharCode(...new Uint8Array(certBuffer)));
}
console.log(certB64);
console.groupEnd();
console.group("fetch challenge...");
let jsonC = await fetch(serverAddr + "/getchallenge", {
body: JSON.stringify({
PSSH: pssh,
CertBase64: certB64,
}),
headers: {
"Content-Type": "application/json",
},
method: "POST",
}).then((resp) => resp.json());
let challengeBase64 = jsonC.challengeBase64;
console.log(challengeBase64);
console.groupEnd();
console.group("fetch license...");
let licBuffer = await fetch(licUrl, {
body: Uint8Array.from(atob(challengeBase64), (c) => c.charCodeAt(0)),
headers: _headers,
method: "POST",
}).then((resp) => resp.arrayBuffer());
let licB64 = "";
if (isValidJson(String.fromCharCode(...new Uint8Array(licBuffer)))) {
let jsonData = JSON.parse(
String.fromCharCode(...new Uint8Array(licBuffer))
);
if (jsonData.license) {
licB64 = jsonData.license;
} else {
console.log("JSON does not contain 'license'");
}
} else {
licB64 = btoa(String.fromCharCode(...new Uint8Array(licBuffer)));
}
console.log(licB64);
console.groupEnd();
console.group("get keys...");
let jsonK = await fetch(serverAddr + "/getkeys", {
body: JSON.stringify({
PSSH: pssh,
ChallengeBase64: challengeBase64,
LicenseBase64: licB64,
}),
headers: {
"Content-Type": "application/json",
},
method: "POST",
}).then((resp) => resp.json());
let keys = jsonK.keys;
console.log(keys);
console.groupEnd();
return keys;
};