diff options
author | Malfurious <m@lfurio.us> | 2024-05-19 13:00:10 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2025-01-02 03:47:03 -0500 |
commit | bdd36861f7ae3517da0dd2486bf72b47b5a52e02 (patch) | |
tree | ae2c44109b74cf32a4928e65ad936de5f08d0576 | |
parent | 675aea7d480c72e3b60ad1a41ff97f4e8893621f (diff) | |
download | nsploit-bdd36861f7ae3517da0dd2486bf72b47b5a52e02.tar.gz nsploit-bdd36861f7ae3517da0dd2486bf72b47b5a52e02.zip |
payload: padalign reference property
Previously, the auto alignment tool would ensure that the next payload
byte address was evenly divisible by the padding size, and nothing more.
Users now have the added flexibility to specify a basis or "reference"
address. The next payload byte address will then be an even multiple of
the padding size away from this reference.
Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r-- | sploit/payload/payload_entry.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sploit/payload/payload_entry.py b/sploit/payload/payload_entry.py index 4dca83d..295a91f 100644 --- a/sploit/payload/payload_entry.py +++ b/sploit/payload/payload_entry.py @@ -91,13 +91,14 @@ class padrel(padlen): class padalign(padlen): """Generate padding to reach next aligned address.""" - def __init__(self, size=None, data=None): + def __init__(self, size=None, data=None, reference=0): self.size = size self.data = data + self.reference = reference def payload_len(self, payload): size = self.size or arch.alignment - return -self.base % size + return (self.reference - self.base) % size class placeholder(padlen): """Generate fixed length of magic bytes, one word length by default.""" |