python: fix NEO's get_arch_info()

This commit is contained in:
Nguyen Anh Quynh 2018-07-05 12:05:10 +08:00
parent c6902f0f4d
commit 3d5095a2c4
2 changed files with 13 additions and 2 deletions

View File

@ -657,7 +657,7 @@ class CsInsn(object):
elif arch == CS_ARCH_EVM:
(self.pop, self.push, self.fee) = evm.get_arch_info(self._raw.detail.contents.arch.evm)
elif arch == CS_ARCH_NEO:
(self.pop, self.push, self.fee) = neo.get_arch_info(self._raw.detail.contents.arch.neo)
(self.op_size, self.pop, self.push, self.fee) = neo.get_arch_info(self._raw.detail.contents.arch.neo)
def __getattr__(self, name):

View File

@ -7,11 +7,22 @@ from .neo_const import *
# define the API
class CsNeo(ctypes.Structure):
_fields_ = (
('op_size', ctypes.c_byte),
('pop', ctypes.c_byte),
('push', ctypes.c_byte),
('fee', ctypes.c_uint),
)
def get_arch_info(a):
return (a.pop, a.push, a.fee)
if a.fee == NEO_FEE_0:
return (a.op_size, a.pop, a.push, 0)
if a.fee == NEO_FEE_01:
return (a.op_size, a.pop, a.push, 0.1)
if a.fee == NEO_FEE_001:
return (a.op_size, a.pop, a.push, 0.01)
if a.fee == NEO_FEE_002:
return (a.op_size, a.pop, a.push, 0.02)
if a.fee == NEO_FEE_0001:
return (a.op_size, a.pop, a.push, 0.001)
return None