Skip to content

Commit

Permalink
fix ropchain printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Kyle committed Jan 30, 2024
1 parent 2a8a21e commit 915a6de
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions angrop/rop_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from .errors import RopException
from .value import ROPValue

from cle.address_translator import AT

class RopChain:
"""
This class holds rop chains returned by the rop chain building methods such as rop.set_regs()
Expand Down Expand Up @@ -156,16 +154,15 @@ def payload_code(self, constraints=None, print_instructions=True):

instruction_code = ""
if print_instructions:
if needs_rebase:
#dealing with pie code
value_in_gadget = AT.from_lva(value, self._p.loader.main_object).to_mva()
else:
value_in_gadget = value
value_in_gadget = value
if value_in_gadget in gadget_dict:
asmstring = rop_utils.gadget_to_asmstring(self._p,gadget_dict[value_in_gadget])
asmstring = rop_utils.gadget_to_asmstring(self._p, gadget_dict[value_in_gadget])
if asmstring != "":
instruction_code = "\t# " + asmstring

if self._pie:
value -= self._p.loader.main_object.mapped_base

if needs_rebase:
payload += "chain += " + pack_rebase % value + instruction_code
else:
Expand Down

0 comments on commit 915a6de

Please sign in to comment.