Reduce namespace clutter
This commit is contained in:
@@ -1,8 +1,14 @@
|
|||||||
import sys
|
import sys as _sys
|
||||||
|
|
||||||
if sys.version_info[0] == 2:
|
from .unicorn_const import (
|
||||||
|
UC_VERSION_MAJOR as __MAJOR,
|
||||||
|
UC_VERSION_MINOR as __MINOR,
|
||||||
|
UC_VERSION_PATCH as __PATCH
|
||||||
|
)
|
||||||
|
|
||||||
|
__version__ = "%u.%u.%u" % (__MAJOR, __MINOR, __PATCH)
|
||||||
|
|
||||||
|
if _sys.version_info.major == 2:
|
||||||
from .unicorn_py2 import *
|
from .unicorn_py2 import *
|
||||||
else:
|
else:
|
||||||
from .unicorn_py3 import *
|
from .unicorn_py3 import *
|
||||||
|
|
||||||
__version__ = "%u.%u.%u" % (uc.UC_VERSION_MAJOR, uc.UC_VERSION_MINOR, uc.UC_VERSION_PATCH)
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# from .arm import UcRegCP
|
|
||||||
# from .arm64 import UcRegCP64
|
|
||||||
# from .intel import UcRegFPR, UcRegMMR, UcRegMSR
|
|
||||||
# from .types import UcReg128, UcReg256, UcReg512, UcReg, UcLargeReg, UcTupledReg
|
|
||||||
@@ -6,9 +6,11 @@ from typing import Any, Tuple
|
|||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
from .. import Uc
|
# traditional unicorn imports
|
||||||
from .. import arm_const as const
|
from unicorn import arm_const as const
|
||||||
|
|
||||||
|
# newly introduced unicorn imports
|
||||||
|
from ..unicorn import Uc
|
||||||
from .types import UcTupledReg, UcReg128
|
from .types import UcTupledReg, UcReg128
|
||||||
|
|
||||||
ARMCPReg = Tuple[int, int, int, int, int, int, int, int]
|
ARMCPReg = Tuple[int, int, int, int, int, int, int, int]
|
||||||
@@ -83,3 +85,5 @@ class UcAArch32(Uc):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
self._reg_write(reg_id, reg_cls, value)
|
self._reg_write(reg_id, reg_cls, value)
|
||||||
|
|
||||||
|
__all__ = ['UcRegCP', 'UcAArch32']
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ from typing import Any, Callable, NamedTuple, Tuple
|
|||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
from .. import Uc, UcError
|
# traditional unicorn imports
|
||||||
from .. import arm64_const as const
|
from unicorn import arm64_const as const
|
||||||
|
from unicorn.unicorn_const import UC_ERR_ARG, UC_HOOK_INSN
|
||||||
|
|
||||||
from ..unicorn import uccallback
|
# newly introduced unicorn imports
|
||||||
from unicorn import UC_ERR_ARG, UC_HOOK_INSN
|
from ..unicorn import Uc, UcError, uccallback
|
||||||
from .types import uc_engine, UcTupledReg, UcReg128
|
from .types import uc_engine, UcTupledReg, UcReg128
|
||||||
|
|
||||||
ARM64CPReg = Tuple[int, int, int, int, int, int]
|
ARM64CPReg = Tuple[int, int, int, int, int, int]
|
||||||
@@ -124,3 +125,5 @@ class UcAArch64(Uc):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
self._reg_write(reg_id, reg_cls, value)
|
self._reg_write(reg_id, reg_cls, value)
|
||||||
|
|
||||||
|
__all__ = ['UcRegCP64', 'UcAArch64']
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
#
|
#
|
||||||
# @author elicn
|
# @author elicn
|
||||||
|
|
||||||
from typing import Any, Callable, Tuple
|
from typing import Any, Callable, Sequence, Tuple
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
from .. import Uc, UcError
|
# traditional unicorn imports
|
||||||
from .. import x86_const as const
|
from unicorn import x86_const as const
|
||||||
|
|
||||||
from unicorn.unicorn_py3 import uccallback
|
|
||||||
from unicorn.unicorn_const import UC_ERR_ARG, UC_HOOK_INSN
|
from unicorn.unicorn_const import UC_ERR_ARG, UC_HOOK_INSN
|
||||||
|
|
||||||
|
# newly introduced unicorn imports
|
||||||
|
from ..unicorn import Uc, UcError, uccallback
|
||||||
from .types import uc_engine, UcTupledReg, UcReg128, UcReg256, UcReg512
|
from .types import uc_engine, UcTupledReg, UcReg128, UcReg256, UcReg512
|
||||||
|
|
||||||
X86MMRReg = Tuple[int, int, int, int]
|
X86MMRReg = Tuple[int, int, int, int]
|
||||||
@@ -176,3 +177,6 @@ class UcIntel(Uc):
|
|||||||
|
|
||||||
def msr_write(self, msr_id: int, value: int) -> None:
|
def msr_write(self, msr_id: int, value: int) -> None:
|
||||||
self._reg_write(const.UC_X86_REG_MSR, UcRegMSR, (msr_id, value))
|
self._reg_write(const.UC_X86_REG_MSR, UcRegMSR, (msr_id, value))
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['UcRegMMR', 'UcRegMSR', 'UcRegFPR', 'UcIntel']
|
||||||
|
|||||||
@@ -94,3 +94,6 @@ class UcReg256(UcLargeReg):
|
|||||||
|
|
||||||
class UcReg512(UcLargeReg):
|
class UcReg512(UcLargeReg):
|
||||||
_fields_ = [('qwords', ctypes.c_uint64 * 8)]
|
_fields_ = [('qwords', ctypes.c_uint64 * 8)]
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['uc_err', 'uc_engine', 'uc_context', 'uc_hook_h', 'UcReg', 'UcTupledReg', 'UcLargeReg', 'UcReg128', 'UcReg256', 'UcReg512']
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import ctypes
|
|||||||
import functools
|
import functools
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from unicorn import x86_const, arm_const, arm64_const, unicorn_const as uc
|
from unicorn import unicorn_const as uc
|
||||||
from .arch.types import *
|
from .arch.types import uc_err, uc_engine, uc_context, uc_hook_h, UcReg
|
||||||
|
|
||||||
__version__ = f'{uc.UC_VERSION_MAJOR}.{uc.UC_VERSION_MINOR}.{uc.UC_VERSION_PATCH}'
|
# __version__ = f'{uc.UC_VERSION_MAJOR}.{uc.UC_VERSION_MINOR}.{uc.UC_VERSION_PATCH}'
|
||||||
|
|
||||||
def _structure_repr(self):
|
def _structure_repr(self):
|
||||||
return "%s(%s)" % (self.__class__.__name__, ", ".join("%s=%s" % (k, getattr(self, k)) for (k, _) in self._fields_))
|
return "%s(%s)" % (self.__class__.__name__, ", ".join("%s=%s" % (k, getattr(self, k)) for (k, _) in self._fields_))
|
||||||
@@ -457,7 +457,7 @@ class Uc(RegStateManager):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __wrapped() -> Type[Uc]:
|
def __wrapped() -> Type[Uc]:
|
||||||
archmod = importlib.import_module(f'.arch.{pkgname}', f'unicorn.unicorn_py3')
|
archmod = importlib.import_module(f'.arch.{pkgname}', 'unicorn.unicorn_py3')
|
||||||
|
|
||||||
return getattr(archmod, clsname)
|
return getattr(archmod, clsname)
|
||||||
|
|
||||||
@@ -1163,8 +1163,6 @@ UC_MMIO_READ_TYPE = Callable[[Uc, int, int, Any], int]
|
|||||||
UC_MMIO_WRITE_TYPE = Callable[[Uc, int, int, int, Any], None]
|
UC_MMIO_WRITE_TYPE = Callable[[Uc, int, int, int, Any], None]
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['Uc', 'UcContext', 'ucsubclass', 'UcError', 'uc_version', 'version_bind', 'uc_arch_supported', 'debug']
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'Uc', 'UcContext', 'ucsubclass', 'uc_version', 'uc_arch_supported', 'version_bind', 'UcError', 'uc', 'debug', 'uccallback',
|
|
||||||
'x86_const', 'arm_const', 'arm64_const'
|
|
||||||
]
|
|
||||||
Reference in New Issue
Block a user