mport execjs
print(execjs.get().name)
import execjs
file = ‘v.js’
node = execjs.get()
xvt_anti = node.compile(open(file).read()).call(‘get_anti’)
print(xvt_anti)
import execjs
js = ‘’’
function get_anti() {
const t = Date.now() / 1e3;
return btoa(${(()=>{ const t = 1e10 * (1 + Math.random() % 5e4); return t < 50 ? "-1" : t.toFixed(0) } )()}-ZG9udCBiZSBldmls-${t}
)
}
‘’’
xvt_anti = execjs.compile(js).call(‘get_anti’)
print(xvt_anti)
import execjs
#读取js文件
with open('t.js',encoding='utf-8') as f:
js = f.read()
#通过compile命令转成一个js对象
docjs = execjs.compile(js)
#调用function
res = docjs.call('createGuid')
print(res)
#调用变量
res = docjs.eval('guid')
print(res)