summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-03-19 04:09:15 -0400
committerdusoleil <howcansocksbereal@gmail.com>2022-03-19 04:09:15 -0400
commit0101b6e4307771cc24e46381ab20aa059fcea78d (patch)
treeef6a9b5b831559019051b67c81708c72f9274306
parent489180d56f9544dc8219ee331814179ddb882d1e (diff)
downloadsploit-0101b6e4307771cc24e46381ab20aa059fcea78d.tar.gz
sploit-0101b6e4307771cc24e46381ab20aa059fcea78d.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--sploit/arch.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sploit/arch.py b/sploit/arch.py
index f6d4789..e5de2ce 100644
--- a/sploit/arch.py
+++ b/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__()