Skip to content

Commit

Permalink
Fixed n decoding for base.js b22ef6e7
Browse files Browse the repository at this point in the history
  • Loading branch information
Seneral committed Jul 8, 2024
1 parent db21cc3 commit 9a46cbd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3200,7 +3200,8 @@ function yt_decodeStreams (config) {
var whitelist = [ "var", "void", "function", "new", "this", "null", "undefined", "NaN",
"switch", "case", "default", "throw", "try", "catch", "finally", "for", "continue", "break", "return",
"forEach", "indexOf", "unshift", "push", "pop", "split", "join", "length", "splice", "reverse",
"String", "fromCharCode", "Math", "pow", "abs", "sqrt", "Date"
"String", "fromCharCode", "Math", "pow", "abs", "sqrt", "Date",
"Array", "prototype", "call"
];
var match;
var blacklistedSymbols = false;
Expand Down Expand Up @@ -3266,7 +3267,7 @@ function yt_decodeStreams (config) {
var nFuncCode = "";
try {
// For new n-cipher, similarly get function call first
var nFuncCall = jsSRC.match(/\.get\("n"\)\)&&\(b=([a-zA-Z0-9$]+)(?:\[(\d+)\])?\([a-zA-Z0-9]\)/);
var nFuncCall = jsSRC.match(/(?:\.get\("n"\)\)&&\(b=|b=String\.fromCharCode\(110\),c=a\.get\(b\)\)&&\(c=)([a-zA-Z0-9$]+)(?:\[(\d+)\])?\([a-zA-Z0-9]\)/);
var nFuncName = nFuncCall[1];
nFuncName = nFuncName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // Escape for use in regex
if (nFuncCall.length > 2) {
Expand All @@ -3277,7 +3278,7 @@ function yt_decodeStreams (config) {
nFuncName = nFuncArr[1];
nFuncName = nFuncName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // Escape for use in regex
}
var nFuncDecoder = jsSRC.match(nFuncName + "\\s*=\\s*function\\s*\\(([\\w]+)\\)\\s*\\{([\\s\\S]+?\\s*return\\s[\\w]+\\.join\\s*\\(\"\"\\))");
var nFuncDecoder = jsSRC.match(nFuncName + "\\s*=\\s*function\\s*\\(([\\w]+)\\)\\s*\\{([\\s\\S]+?\\s*return\\s(?:[\\w]+\\.join\\s*\\(\"\"\\)|Array\\.prototype\\.join\\.call\\([\\w]+,\\s*\"\"\\)))");
// Now find all "symbols" and make sure none of them is suspect since we'll have to eval this code
if (checkMaliciousDecipherCode(nFuncDecoder[2])) {
console.error("Rejecting n-cipher decoding code, cannot verify:\n" + nFuncDecoder[2]);
Expand All @@ -3301,8 +3302,10 @@ function yt_decodeStreams (config) {
}
else
console.log("Failed to parse decoding data for id " + jsID + ":");
console.log(" Transform plan: " + transformPlan);
console.log(" nFunc (" + nFuncVar + "): " + nFuncCode);
console.log(" Transform plan: ");
console.log(transformPlan);
console.log(" nFunc (" + nFuncVar + "): ");
console.log(nFuncCode);

return decodingData;
}));
Expand Down
2 changes: 1 addition & 1 deletion sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Licensed under AGPLv3
See https://github.com/Seneral/FlagPlayer for details
*/

var VERSION = 50;
var VERSION = 51;
var APP_CACHE = "flagplayer-cache-1";
var IMG_CACHE = "flagplayer-thumbs";
var MEDIA_CACHE = "flagplayer-media";
Expand Down

0 comments on commit 9a46cbd

Please sign in to comment.