Skip to content

Commit

Permalink
Add elf.process, elf.fit, process.fit
Browse files Browse the repository at this point in the history
Also fix the implementation of elf.flag
  • Loading branch information
zachriggle committed Jan 11, 2017
1 parent 17e4f01 commit 466c0e4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
27 changes: 25 additions & 2 deletions pwnlib/elf/elf.py
Expand Up @@ -285,6 +285,22 @@ def process(self, argv=[], *a, **kw):
p = adb.process
return p([self.path] + argv, *a, **kw)

def debug(self, argv=[], *a, **kw):
"""debug(argv=[], *a, **kw) -> tube
Debug the binary with :func:`.gdb.debug`.
Arguments:
argv(list): List of arguments to the binary
*args: Extra arguments to :func:`.gdb.debug`
**kwargs: Extra arguments to :func:`.gdb.debug`
Returns:
:class:`.tube`: See :func:`.gdb.debug`
"""
import pwnlib.gdb
return pwnlib.gdb.debug([self.path] + argv, *a, **kw)

def _describe(self):
log.info_once('\n'.join((repr(self.path),
'%-10s%s-%s-%s' % ('Arch:', self.arch, self.bits, self.endian),
Expand Down Expand Up @@ -1134,9 +1150,16 @@ def string(self, address):
data += c
address += 1

def flat(self, *a, **kw):
def flat(self, address, *a, **kw):
"""Writes a full array of values to the specified address.
See: :func:`.packing.flat`
"""
return self.send(packing.flat(*a,**kw))
return self.write(address, packing.flat(*a,**kw))

def fit(self, address, *a, **kw):
"""Writes fitted data into the specified address.
See: :func:`.packing.fit`
"""
return self.write(address, packing.fit(*a, **kw))
1 change: 1 addition & 0 deletions pwnlib/tubes/tube.py
Expand Up @@ -1366,3 +1366,4 @@ def u8(self, *a, **kw): return packing.u8(self.recvn(1), *a, **kw)
def unpack(self, *a, **kw): return packing.unpack(self.recvn(context.bytes), *a, **kw)

def flat(self, *a, **kw): return self.send(packing.flat(*a,**kw))
def fit(self, *a, **kw): return self.send(packing.fit(*a, **kw))

0 comments on commit 466c0e4

Please sign in to comment.