Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2.4 change PyExecJS to node_vm2 #31

Merged
merged 1 commit into from Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/Recoverspilt.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-

import execjs, os, re, sqlite3
import node_vm2, os, re, sqlite3
from urllib.parse import urlparse
from lib.common.utils import Utils
from lib.Database import DatabaseType
Expand Down Expand Up @@ -53,13 +53,13 @@ def jsCodeCompile(self, jsCode, jsFilePath):
cursor.execute("select path from js_file where local='%s'" % (localFile))
jsUrlPath = cursor.fetchone()[0]
connect.close()
if "exec" not in jsCode and "spawn" not in jsCode and "eval" not in jsCode and "require" not in jsCode and "decode" not in jsCode: #防止黑吃黑被命令执行,不一定很完善欢迎继续反馈
jsCompileResult = execjs.compile(jsCodeFunc)
with node_vm2.VM() as vm:
vm.run(jsCodeFunc)
for name in nameList:
if "\"" in name:
name = name.replace("\"", "")
if "undefined" not in jsCompileResult.call("js_compile", name):
jsFileName = jsCompileResult.call("js_compile", name)
if "undefined" not in vm.call("js_compile", name):
jsFileName = vm.call("js_compile", name)
self.jsFileNames.append(jsFileName)
self.log.info(Utils().tellTime() + Utils().getMyWord("{run_codesplit_s}") + str(len(self.jsFileNames)))
self.getRealFilePath(jsSplitId, self.jsFileNames, jsUrlPath)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -3,5 +3,5 @@ urllib3
requests
docx2pdf
docx2txt
PyExecJS
node_vm2
python-docx