// 直接执行原版代码的字符串解码部分
const vm = require('vm');
const fs = require('fs');

// 读取原版client.js
const code = fs.readFileSync('D:/temp/破解/cursorpro-0.4.5/原版本/extension/out/api/client.js', 'utf8');

// 创建沙箱环境
const sandbox = {
    console: console,
    setTimeout: setTimeout,
    clearTimeout: clearTimeout,
    exports: {},
    require: (mod) => {
        if (mod === 'vscode') {
            return {
                workspace: {
                    getConfiguration: () => ({
                        get: () => null
                    })
                }
            };
        }
        return {};
    },
    fetch: async () => ({ ok: true, json: async () => ({}) }),
    AbortController: class { abort() {} signal = {} }
};

// 提取解码函数并执行
const extractCode = `
var vip='cursor';
${code.split('Object[\'defineProperty\']')[0]}

// 测试解码
const _0x1ede40 = _0x3fbb;
const results = {
    DEFAULT_API_URL: _0x1ede40(0x18a,'yC20'),
    vscode: _0x1ede40(0x151,'pIfk'),
    apiUrl: _0x1ede40(0x15b,'j#7G'),
    workspace: _0x1ede40(0x177,']8Ci'),
    getConfiguration: 'cursorpro',
    verify: _0x1ede40(0x197,'Kfdi'),
    switch: _0x1ede40(0x141,'z&uV'),
    POST: _0x1ede40(0x186,'dpeu')
};
results;
`;

try {
    const result = vm.runInNewContext(extractCode, sandbox, { timeout: 5000 });
    console.log('=== 解码结果 ===');
    console.log(JSON.stringify(result, null, 2));
} catch (e) {
    console.log('Error:', e.message);

    // 尝试简单方法 - 直接搜索常见API地址模式
    const urlMatch = code.match(/https?:\/\/[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g);
    if (urlMatch) {
        console.log('\n找到的URL:', urlMatch);
    }
}
