Skip to content

Commit

Permalink
fix(Player): Fix signature algorithm extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue committed Dec 9, 2024
1 parent ad2ae51 commit 0c1f46b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,21 @@ export default class Player {
}

static extractSigSourceCode(data: string): string {
const calls = getStringBetweenStrings(data, 'function(a){a=a.split("")', 'return a.join("")}');
let calls = getStringBetweenStrings(data, 'function(a){a=a.split("")', 'return a.join("")}');
let var_name = 'a';

if (!calls) {
calls = getStringBetweenStrings(data, 'function(J){J=J.split("")', 'return J.join("")}');
var_name = 'J';
}

const obj_name = calls?.split(/\.|\[/)?.[0]?.replace(';', '')?.trim();
const functions = getStringBetweenStrings(data, `var ${obj_name}={`, '};');

if (!functions || !calls)
Log.warn(TAG, 'Failed to extract signature decipher algorithm.');

return `function descramble_sig(a) { a = a.split(""); let ${obj_name}={${functions}}${calls} return a.join("") } descramble_sig(sig);`;
return `function descramble_sig(${var_name}) { ${var_name} = ${var_name}.split(""); let ${obj_name}={${functions}}${calls} return ${var_name}.join("") } descramble_sig(sig);`;
}

static extractNSigSourceCode(data: string): string | undefined {
Expand Down

0 comments on commit 0c1f46b

Please sign in to comment.