Skip to content

Commit

Permalink
Improve pwnup template, gdbserver detection (#1148)
Browse files Browse the repository at this point in the history
* Improve pwnup template

* Don't want to break at main again if its been hit already

* Always start the program

* Handle extra newline printed by gdb

* Remove moved recvline

* Remove controversial set sysroot

* Update gdb.py

* Update pwnup.mako
  • Loading branch information
ambiso authored and zachriggle committed May 30, 2018
1 parent 8da0827 commit 338fbeb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pwnlib/data/templates/pwnup.mako
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ def start(argv=[], *a, **kw):
gdbscript = '''
%if ctx.binary:
%if 'main' in ctx.binary.symbols:
break *0x{exe.symbols.main:x}
%else:
break *0x{exe.entry:x}
tbreak main
%elif 'DYN' != ctx.binary.elftype:
tbreak *0x{exe.entry:x}
%endif
%endif
continue
Expand Down
6 changes: 3 additions & 3 deletions pwnlib/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,9 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, **kw

# gdbserver outputs a message when a client connects
garbage = gdbserver.recvline(timeout=1)

if "Remote debugging from host" not in garbage:
gdbserver.unrecv(garbage)
# Some versions of gdbserver output an additional message
garbage2 = gdbserver.recvline_startswith("Remote debugging from host ", timeout=1)

return gdbserver

Expand Down

0 comments on commit 338fbeb

Please sign in to comment.