python-ptrace is a debugger using ptrace (Linux, BSD and Darwin system call to trace processes) written in Python.

python-ptrace is an opensource project (contribute!) written in Python under GNU GPLv2 license.

Features

  • High level Python object API : PtraceDebugger and PtraceProcess
  • Able to control multiple processes: catch fork events on Linux
  • Read/write bytes to arbitrary address: take care of memory alignment and split bytes to cpu word
  • Execution step by step using ptrace_singlestep() or hardware interruption 3
  • Can use distorm disassembler
  • Dump registers, memory mappings, stack, etc.
  • Syscall tracer and parser (strace.py command)

Download

Read INSTALL for the installation procedure.

Download development version using Subversion:

svn co http://python-ptrace.hachoir.org/svn/trunk python-ptrace

Browse python-ptrace source code

Status

Some important features are missing:

  • Symbols: it's not possible to break on a function or read a variable value
  • No C language support: debugger shows assembler code, not your C (C++ or other language) code!
  • No thread support

python-ptrace works on:

  • Linux version 2.6.20 on i386, x86_64 and PPC32 (may works on Linux 2.4.x and 2.6.x)
  • FreeBSD version 6.2 and 7.0 on i386 (may works on FreeBSD 5.x)

Pages

News

  • 2008-09-13: Release of python-ptrace 0.5.0, read the ChangeLog
    • Parse socket syscalls for FreeBSD
    • Avoid creation of zombi process on FreeBSD
    • Most basic Windows support
  • 2008-08-28: Release of python-ptrace 0.4.2, read the ChangeLog
  • 2008-08-23: Release of python-ptrace 0.4.1, read the ChangeLog
  • 2008-08-19: Release of python-ptrace 0.4.0, read the ChangeLog
  • 2008-07-25: Release of Ptrace 0.3.2 (bugfix version), read the ChangeLog
  • 2008-07-08: Release of Ptrace 0.3.1
  • 2008-02-14: Release of Ptrace 0.2
  • 2008-02-08: Ptrace 0.1 released

Project using python-ptrace