forked from ZhangFengze/NeoXResearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opcode_tool.py
33 lines (27 loc) · 822 Bytes
/
opcode_tool.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
import sys
sys.path.insert(0, './archives')
import opmap
import opcode
def help_as_standard(standard_op):
try:
neox_op = opmap.encrypt_map[standard_op]
print(
"std {0}:{1} -> neox {2}".format(opcode.opname[standard_op], standard_op, neox_op))
except:
print("unknown std opcode")
def help_as_neox(neox_op):
try:
standard_op = opmap.decrypt_map[neox_op]
print("neox {0} -> std {1}:{2}".format(neox_op,
standard_op, opcode.opname[standard_op]))
except:
print("unknown neox opcode")
if __name__ == "__main__":
op = sys.argv[1]
try:
op = int(op)
help_as_standard(op)
help_as_neox(op)
except ValueError:
op = opcode.opmap[op]
help_as_standard(op)