diff options
Diffstat (limited to '')
-rw-r--r-- | tools/sploit/sploit/arch.py | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/tools/sploit/sploit/arch.py b/tools/sploit/sploit/arch.py index ce88111..f6d4789 100644 --- a/tools/sploit/sploit/arch.py +++ b/tools/sploit/sploit/arch.py @@ -1,28 +1,15 @@ +from collections import namedtuple as nt + def btoi(b, signed=False): return int.from_bytes(b, arch.endianness, signed=signed) def itob(i, signed=False): return i.to_bytes(arch.wordsize, arch.endianness, signed=signed) -class Arch: - def __init__(self, wordsize, endianness, alignment, nopcode): - self.wordsize = wordsize - self.endianness = endianness - self.alignment = alignment - self.nopcode = nopcode - -archx86 = Arch( - wordsize = 4, - endianness = "little", - alignment = 16, - nopcode = b'\x90' -) - -archx86_64 = Arch( - wordsize = 8, - endianness = "little", - alignment = 16, - nopcode = b'\x90' -) +Arch = nt("Arch", "wordsize endianness alignment nopcode") +x86 = Arch( 4, 'little', 16, b'\x90') +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 = archx86_64 +arch = x86_64 |