summaryrefslogtreecommitdiffstats
path: root/sploit/arch.py
blob: ce8811141f641962f73e8158da09158497d5f0c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 = archx86_64