const fs = require('fs');
const QXVM_GENERATE = require('../qxVm_sanbox/qxVm.sanbox');

function ReadCode(name, dir) {
    let file_path = dir === undefined ? `${__dirname}/${name}` : `${__dirname}/${dir}/${name}`;
    return fs.readFileSync(file_path) + "\r\n"
}

const js_code = ReadCode(`./rs4.js`);

const user_config = {
    isTest: false,
    runConfig: { proxy: false, logOpen: true},
    window_attribute: {},
    env: {
        canvas: "data:image/png;base64,[encoded data, 12611 characters]",
        navigator: {
            userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.55"
        },
        location: {
            href: "http://www.fangdi.com.cn/index.html"
        },
        document: {
            referrer: "http://www.fangdi.com.cn/index.html",
            cookie: "www.fangdi.com_http_ic=www.fangdi.com.cn_80_RS"
        }
    }
}
// 帮助信息打印
QXVM_GENERATE.help()

let result = QXVM_GENERATE.sanbox(js_code, "get_run", user_config, false);
let cookieInfo = result.get_run()
console.log(cookieInfo['FSSBBIl1UgzbN7N80T'], cookieInfo['FSSBBIl1UgzbN7N80T'].length)

console.log(result.printLog())