diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-03-19 04:09:15 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-03-19 04:09:15 -0400 |
commit | 90d7c4ea1b303b25eaa233d75101e0e35d710e7f (patch) | |
tree | 7d28583109b3ba6193ffe90cad2b982816afba93 | |
parent | 6a617f6dea973862fc88fdbdbbf9c7afed44de62 (diff) | |
download | lib-des-gnux-90d7c4ea1b303b25eaa233d75101e0e35d710e7f.tar.gz lib-des-gnux-90d7c4ea1b303b25eaa233d75101e0e35d710e7f.zip |
Add indirection to arch access
Add a layer of indirection to access the active arch config.
Currently when importing sploit.arch.arch, the name will be bound to
whatever the current reference is and won't follow if another module
(user script) updates the reference in sploit.arch. A layer of
indirection seemlessly solves that issue and also provides a cleaner
interface for setting the active arch from the user script.
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | tools/sploit/sploit/arch.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/sploit/sploit/arch.py b/tools/sploit/sploit/arch.py index f6d4789..e5de2ce 100644 --- a/tools/sploit/sploit/arch.py +++ b/tools/sploit/sploit/arch.py @@ -12,4 +12,10 @@ x86_64 = Arch( 8, 'little', 16, b'\x90') ARM = Arch( 4, 'little', 8, b'\xe1\xa0\x00\x00') THUMB = Arch( 4, 'little', 8, b'\x46\xc0') -arch = x86_64 +class __ActiveArch__: + __arch = x86_64 + def __getattr__(self,k): + return getattr(self.__arch,k) + def set(self,a): + self.__arch = a +arch = __ActiveArch__() |