Skip to content

Commit

Permalink
Added test for issue Gallopsled#891
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff3r committed Feb 15, 2017
1 parent bc471d1 commit 52aadfa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pwnlib/rop/rop.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,16 @@ def unresolve(self, value):
def generatePadding(self, offset, count):
"""
Generates padding to be inserted into the ROP stack.
>>> rop = ROP([])
>>> val = rop.generatePadding(5,15)
>>> cyclic_find(val[:4])
5
>>> len(val)
15
>>> rop.generatePadding(0,0)
''
"""
if count:
return cyclic.cyclic(offset + count)[-count:]
Expand Down Expand Up @@ -786,6 +796,18 @@ def raw(self, value):
Arguments:
data(int/str): The raw value to put onto the rop chain.
>>> rop = ROP([])
>>> rop.raw('AAAAAAAA')
>>> rop.raw('BBBBBBBB')
>>> rop.raw('CCCCCCCC')
>>> print rop.dump()
0x0000: 'AAAA' 'AAAAAAAA'
0x0004: 'AAAA'
0x0008: 'BBBB' 'BBBBBBBB'
0x000c: 'BBBB'
0x0010: 'CCCC' 'CCCCCCCC'
0x0014: 'CCCC'
"""
if self.migrated:
log.error('Cannot append to a migrated chain')
Expand Down

0 comments on commit 52aadfa

Please sign in to comment.