Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import CryptoJS from "npm:crypto-js";
const regex = /case (0[xX][\da-fA-F]+):([a-zA-Z\d]+)=(.),([a-zA-Z\d]+)=(.)/gm;
const req = await fetch("https://southcloud.tv/js/player/a/sc/prod/p1-debug.min.js");
const str = await req.text();
let m;
const dataChart: { variable: string; value: number }[][] = [];
function getValueOf(text: string): number {
const pattern = new RegExp(`,${text}=0x([a-zA-Z0-9]+)`, "g");
const match = pattern.exec(str);
if (match) {
return Number(`0x${match[1]}`);
}
throw new Error(`Value for ${text} not found`);
}
let match: RegExpExecArray | null;
while ((match = regex.exec(str)) !== null) {
if (match.index === regex.lastIndex) {
regex.lastIndex++;
}
dataChart.push([
{ variable: match[2], value: getValueOf(match[3]) },
{ variable: match[4], value: getValueOf(match[5]) },
]);
}
const decrypt = (encryptedText: string, key: string) => {
try {
const decrypted = CryptoJS.AES.decrypt(encryptedText, key);
return JSON.parse(decrypted.toString(CryptoJS.enc.Utf8));
} catch (error) {
console.error(error.message);
return [];
}
};
export function base(p) {
let key = "";
let encryptedText = p;
let offset = 0;
for (let iterator = 0; iterator < dataChart.length; iterator++) {
let temp0 = dataChart[iterator][0].value;
let temp1 = dataChart[iterator][1].value;
var temp2 = temp0 + offset;
var temp3 = temp2 + temp1;
key += p.slice(temp2, temp3);
encryptedText = encryptedText.replace(p.substring(temp2, temp3), "");
offset += temp1;
}
return decrypt(encryptedText, key);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
August 2, 2024