Skip to content

Commit

Permalink
update jsjiami.com.v7 logic
Browse files Browse the repository at this point in the history
  • Loading branch information
delic1ous committed Feb 13, 2025
1 parent 95dcee7 commit 4ad90a1
Showing 1 changed file with 22 additions and 33 deletions.
55 changes: 22 additions & 33 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,6 @@ function handleChangeArrayIIFE(ast, return_array_function_name) {
}

function restoreCallExpression(ast, decrypt_string_function_name, code_str1, code_str2, code_str3) {
eval(code_str1);
eval(code_str2);
eval(code_str3);

const caller_callee_map = new Map();
const visitor1 = {
VariableDeclarator(path) {
Expand All @@ -301,6 +297,9 @@ function restoreCallExpression(ast, decrypt_string_function_name, code_str1, cod
};
traverse(ast, visitor1);

eval(code_str1);
eval(code_str2);

const decrypt_string_function_alias = [decrypt_string_function_name];
let current_alias = [decrypt_string_function_name];
while (current_alias.length > 0) {
Expand All @@ -316,16 +315,14 @@ function restoreCallExpression(ast, decrypt_string_function_name, code_str1, cod
current_alias = next_alias;
}

function evalAndReplace(path) {
const value = eval(path.toString());
const node = types.valueToNode(value);
path.replaceInline(node);
}
eval(code_str3);

const visitor2 = {
CallExpression(path) {
if (decrypt_string_function_alias.includes(path.node.callee.name)) {
evalAndReplace(path);
const value = eval(path.toString());
const node = types.valueToNode(value);
path.replaceInline(node);
}
}
};
Expand All @@ -349,36 +346,28 @@ function restoreMemberExpression(ast) {
};
traverse(ast, visitor1);

function restoreString(path) {
const value = eval(path.toString());
const node = types.valueToNode(value);
path.replaceInline(node);
}

function restoreExpression(path) {
const { info_object_properties } = info_object_map.get(path.node.callee.object.name);
const property = info_object_properties.find(prop => prop.key.value === path.node.callee.property.value);
const expression = property.value.body.body[0].argument;
let new_expression;
if (expression.type === 'BinaryExpression') {
new_expression = types.binaryExpression(expression.operator, path.node.arguments[0], path.node.arguments[1]);
} else if (expression.type === 'CallExpression') {
new_expression = types.callExpression(path.node.arguments[0], path.node.arguments.slice(1));
} else {
console.log(666)
}
path.replaceInline(new_expression);
}

const visitor2 = {
MemberExpression(path) {
if (info_object_map.has(path.node.object.name)) {
restoreString(path);
const value = eval(path.toString());
const node = types.valueToNode(value);
path.replaceInline(node);
}
},
CallExpression(path) {
if (info_object_map.has(path.node.callee.object?.name)) {
restoreExpression(path);
const { info_object_properties } = info_object_map.get(path.node.callee.object.name);
const property = info_object_properties.find(prop => prop.key.value === path.node.callee.property.value);
const expression = property.value.body.body[0].argument;
let new_expression;
if (expression.type === 'BinaryExpression') {
new_expression = types.binaryExpression(expression.operator, path.node.arguments[0], path.node.arguments[1]);
} else if (expression.type === 'CallExpression') {
new_expression = types.callExpression(path.node.arguments[0], path.node.arguments.slice(1));
} else {
console.log(666)
}
path.replaceInline(new_expression);
}
}
};
Expand Down

0 comments on commit 4ad90a1

Please sign in to comment.