Javascript

python:execjs._exceptions.ProcessExitedWithNonZeroStatus

本文主要是介绍python:execjs._exceptions.ProcessExitedWithNonZeroStatus,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

前言

我在使用execjs模块对一部分内容进行解密,但在执行js脚本时报了这么个错误

完整错误是

execjs._exceptions.ProcessExitedWithNonZeroStatus: (1, '', '[stdin]:103\ndecode :function(t) {\n        ^^^^^^^^\n\nSyntaxError: Function statements require a function name\n    at new Script (node:vm:100:7)\n    at createScript (node:vm:257:10)\n    at Object.runInThisContext (node:vm:305:10)\n    at node:internal/process/execution:76:19\n    at [stdin]-wrapper:6:22\n    at evalScript (node:internal/process/execution:75:60)\n    at node:internal/main/eval_stdin:29:5\n    at Socket.<anonymous> (node:internal/process/execution:213:5)\n    at Socket.emit (node:events:539:35)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n')

过程

看着这个错误我懵了挺久,仔仔细细的检查了js文件的内容,确定没有问题之后(指的是内容完整,没有多,也没有少括号之类的)

既然js文件没有问题,我把错误从头到尾看了一遍,这个错误看的挺难受,不管好在,我还真看出了一点东西

看到这我突然想到了,我弄下来的js内容中有个方法,它长这个样子

decode :function(t) {
    var f = "[\\t\\n\\f\\r ]"
    var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    var e = (t = String(t).replace(f, "")).length;
    e % 4 == 0 && (e = (t = t.replace(/==?$/, "")).length),
    (e % 4 == 1 || /[^+a-zA-Z0-9/]/.test(t)) && l("Invalid character: the string to be decoded is not correctly encoded.");
    for (var n, r, i = 0, o = "", a = -1; ++a < e; )
        r = c.indexOf(t.charAt(a)),
        n = i % 4 ? 64 * n + r : r,
        i++ % 4 && (o += String.fromCharCode(255 & n >> (-2 * i & 6)));
    return o
}

它的调用点在这里

function o(t) {
    return s("5e5062e82f15fe4ca9d24bc5", a.a.decode(t), 0, 0, "012345677890123", 1)
}

解决方式

换名字,没错就是换名字,或者说是更换函数的定义方式 

function MyDecode(t) {
    var f = "[\\t\\n\\f\\r ]"
    var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    var e = (t = String(t).replace(f, "")).length;
    e % 4 == 0 && (e = (t = t.replace(/==?$/, "")).length),
    (e % 4 == 1 || /[^+a-zA-Z0-9/]/.test(t)) && l("Invalid character: the string to be decoded is not correctly encoded.");
    for (var n, r, i = 0, o = "", a = -1; ++a < e; )
        r = c.indexOf(t.charAt(a)),
        n = i % 4 ? 64 * n + r : r,
        i++ % 4 && (o += String.fromCharCode(255 & n >> (-2 * i & 6)));
    return o
}
function o(t) {
    return s("5e5062e82f15fe4ca9d24bc5", MyDecode(t), 0, 0, "012345677890123", 1)
}

OK了

尾声

如果这篇文章对您有所帮助,那么这篇文章就有意义!


感谢您的观看!

这篇关于python:execjs._exceptions.ProcessExitedWithNonZeroStatus的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!