pyv8执行js错误

郁闷龙 发布于 2014/04/15 16:15
阅读 776
收藏 0

各位大大帮忙看看是什么问题呢,完全没有头绪,是qq空间登陆密码加密里的一段。

http://imgcache.qq.com/ptlogin/ver/10074/js/c_login_old.js?max_age=604800

import PyV8
with PyV8.JSContext() as ctxt:
    func = ctxt.eval("""
function hexchar2bin(str) {
    var arr = [];
    for (var i = 0; i < str.length; i = i + 2) {
        arr.push("\\x" + str.substr(i, 2))
    }
    arr = arr.join("");
    eval("var temp = '" + arr + "'");
    return temp
}
                """)
    hexchar2bin = ctxt.locals.hexchar2bin
    print hexchar2bin('E53A0A2978C28872A4505BDB51DB06DC')



加载中
0
c
caixiaozhong

arr.push("\\x" + str.substr(i, 2))
改成
arr.push("\\\\x" + str.substr(i, 2))

0
岁月留魂
岁月留魂
with PyV8.JSContext() as ctxt:
        ctxt.enter()
        func = ctxt.eval("""
function hexchar2bin(str) {
    var arr = [];
    for (var i = 0; i < str.length; i = i + 2) {
        arr.push("\\\\x" + str.substr(i, 2))
    }
    arr = arr.join("");
    eval("var temp = '" + arr + "'");
    return temp
}
                """)
    hexchar2bin = ctxt.locals.hexchar2bin
    print hexchar2bin('E53A0A2978C28872A4505BDB51DB06DC')



返回顶部
顶部