Skip to content
Permalink
Browse files

Fix issues related with debugging (#1323)

* Fix issues related with debugging

* Update pwnlib/tubes/process.py

Co-Authored-By: Arusekk <arek_koz@o2.pl>

* Enable doctest for find_module_addresses

* Experiment about adding doctests to gdb.py

* Add doctests for most functions in gdb.py

* Remove 'file' statement in gdb script

* Encode cyclic alphabet

* Fix travis build

Co-authored-by: Arusekk <arek_koz@o2.pl>
  • Loading branch information
bet4it and Arusekk committed Dec 29, 2019
1 parent c334ceb commit f727b66475dc8eb779e2d0af56250892f7642fa9
Showing with 175 additions and 155 deletions.
  1. +3 −0 .travis.yml
  2. +2 −0 docs/source/gdb.rst
  3. +1 −1 examples/attach.py
  4. +1 −1 examples/remote_gdb_debugging.py
  5. +127 −135 pwnlib/gdb.py
  6. +10 −0 pwnlib/gdb_faketerminal.py
  7. +11 −10 pwnlib/tubes/process.py
  8. +10 −8 pwnlib/tubes/ssh.py
  9. +2 −0 pwnlib/util/cyclic.py
  10. +8 −0 travis/install.sh
@@ -12,6 +12,8 @@ addons:
- zsh
- pandoc
- gdb
- socat
- sshpass
- binutils
- qemu-user-static
- binutils-multiarch
@@ -47,6 +49,7 @@ before_script:
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
- PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
- sudo sh -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7 --show-source --statistics --exclude=android-?dk # TODO: Add F82
@@ -1,6 +1,8 @@
.. testsetup:: *

from pwn import *
context.arch = 'amd64'
context.terminal = [os.path.join(os.path.dirname(pwnlib.__file__), 'gdb_faketerminal.py')]

:mod:`pwnlib.gdb` --- Working with GDB
======================================
@@ -5,7 +5,7 @@
from pwn import *

bash = process('/bin/bash')
gdb.attach(bash, execute = '''
gdb.attach(bash, gdbscript = '''
p "hello from pwnlib"
c
''')
@@ -8,7 +8,7 @@
from pwn import *

s = ssh(getpass.getuser(), '127.0.0.1', port = 22, keyfile = "~/.ssh/id_rsa")
c = gdb.ssh_gdb(s, '/bin/sh', execute = '''
c = gdb.ssh_gdb(s, '/bin/sh', gdbscript = '''
p/x $pc
c''')

0 comments on commit f727b66

Please sign in to comment.
You can’t perform that action at this time.