summaryrefslogtreecommitdiffstats
path: root/sploit/rev/gadget.py
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2025-01-01 07:22:26 -0500
committerMalfurious <m@lfurio.us>2025-01-01 07:22:26 -0500
commit70c7c16a157f0e2056d0b96b96f6e13c83841bc3 (patch)
tree5f6d84642fc8b0aa89a32ef17f4b374605c7e089 /sploit/rev/gadget.py
parentf01ec45e773291c3659a1dcaf8cd9a51ece19823 (diff)
parent438c66673f7daca0fdc2d23b1a4fd39517528576 (diff)
downloadnsploit-70c7c16a157f0e2056d0b96b96f6e13c83841bc3.tar.gz
nsploit-70c7c16a157f0e2056d0b96b96f6e13c83841bc3.zip
Merge branch 'indextbl'
This branch is a major semantic redesign of Symtbl and Payload. These two classes are now implemented as derivitives of the newly refactored IndexTbl mechanism. Necessary cascading changes have been made to keep these tools in working order. * indextbl: payload: rop: Update for new Payload class Update ROP gadget types to extend IndexEntry payload: Refactor as a concrete IndexTbl lict: Add new list-dictionary hybrid type symtbl: Refactor abstract IndexTbl interface
Diffstat (limited to 'sploit/rev/gadget.py')
-rw-r--r--sploit/rev/gadget.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/sploit/rev/gadget.py b/sploit/rev/gadget.py
index a2564c0..cc69723 100644
--- a/sploit/rev/gadget.py
+++ b/sploit/rev/gadget.py
@@ -1,35 +1,24 @@
from dataclasses import dataclass, field
+from sploit.types.index_entry import IndexEntry
@dataclass
-class Gadget:
+class Gadget(IndexEntry):
"""
Basic gadget description object
- offset (int): The location this gadget is found at. What `offset` is
- relative to depends on context.
+ base (int): The location this gadget is found at. What `base` is relative
+ to depends on context.
asm (list[re.Match]): A list of assembly instructions matched by the gadget
search query.
"""
- offset: int = 0
+ base: int = 0
asm: list = field(default_factory=list)
- def __index__(self):
- """Convert object to integer using offset value."""
- return self.offset
-
- def __add__(self, x):
- """Return new object with adjusted offset."""
- return Gadget(self.offset + x, self.asm)
-
- def __sub__(self, x):
- """Return new object with adjusted offset."""
- return self + (-x)
-
def __repr__(self):
"""Return human-readable Gadget."""
- s = hex(self.offset)
+ s = hex(self.base)
if len(self.asm) > 0:
asm = "; ".join([ m.string for m in self.asm ])
s += f", '{asm}'"