self_example/Spider/Chapter11_JavaScript逆向/WebAssembly案例分析和爬取实战/wasmer执行wasm.py

18 lines
399 B
Python

# -*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/03/26 12:54
@Usage :
@Desc :使用pywasm执行wasm文件
'''
from wasmer import engine, Store, Module, Instance
from wasmer_compiler_cranelift import Compiler
store = Store(engine.JIT(Compiler))
module = Module(store, open('Wasm.wasm', 'rb').read())
instance = Instance(module)
result = instance.exports.encrypt(1, 2)
print(result)