|
|
@ -1,6 +1,7 @@ |
|
|
|
from ethereum import opcodes |
|
|
|
import sys |
|
|
|
import codecs |
|
|
|
|
|
|
|
import re |
|
|
|
import re |
|
|
|
|
|
|
|
import codecs |
|
|
|
|
|
|
|
from ethereum import opcodes |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regex_PUSH = re.compile('^PUSH(\d*)$') |
|
|
|
regex_PUSH = re.compile('^PUSH(\d*)$') |
|
|
@ -109,8 +110,13 @@ def disassemble(bytecode): |
|
|
|
instruction = {} |
|
|
|
instruction = {} |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
opcode = opcodes.opcodes[bytecode[i]] |
|
|
|
if (sys.version_info > (3, 0)): |
|
|
|
|
|
|
|
opcode = opcodes.opcodes[bytecode[i]] |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
opcode = opcodes.opcodes[ord(bytecode[i])] |
|
|
|
|
|
|
|
|
|
|
|
except KeyError: |
|
|
|
except KeyError: |
|
|
|
|
|
|
|
|
|
|
|
# invalid opcode |
|
|
|
# invalid opcode |
|
|
|
disassembly.append({'opcode': "INVALID"}) |
|
|
|
disassembly.append({'opcode': "INVALID"}) |
|
|
|
i += 1 |
|
|
|
i += 1 |
|
|
|