-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_mod.py
40 lines (30 loc) · 989 Bytes
/
test_mod.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import dis
import types
import codeop
import vm
if __name__ == '__main__':
vm = vm.VM()
debug = False
if debug:
import mod
# print(mod.__loader__)
# print(mod.__builtins__)
# print(mod.__package__)
# for k, v in mod.__dict__.items():
# if not k.startswith('_') and type(v) not in [type, types.FunctionType]:
# print(k, type(v))
# for k, v in mod.__dict__.items():
# if not k.startswith('_') and type(v) in [types.FunctionType]:
# print(k, type(v))
# dis.dis(mod)
# print(dir(mod))
vm.import_module(mod)
else:
src = open('mod.py', 'r').read()
mod = codeop.compile_command(src, symbol='exec')
dis.dis(mod.co_code)
vm.import_src(mod)
vm.global_vars['_sender'] = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
vm.run([], 'init')
# vm.run([1000], 'mint')
# vm.run(['0x1111', 1000], 'transfer')