Skip to main content

python binding of ptrace

Project description

python-ptrace is a Python binding of ptrace library.

The binding works on:

  • Linux version 2.6.20 on i386, x86_64, PPC (may works on Linux 2.4.x and 2.6.x)

  • Linux version 2.4 on PPC

  • FreeBSD version 7.0RC1 on i386 (may works on FreeBSD 5.x/6.x)

  • OpenBSD version 4.2 on i386

  • Experimental support of ARM architecture (Linux EAPI), strace.py has been tested on Raspberry Pi (armv6l)

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 (http://www.ragestorm.net/distorm/) disassembler

  • Dump registers, memory mappings, stack, etc.

  • Syscall tracer and parser (strace command)

Website: http://bitbucket.org/haypo/python-ptrace/wiki/Home

Installation

Read INSTALL documentation file.

Documentation

Browse doc/ and examples/ directories.

Changelog

python-ptrace 0.7 (2013-03-05)

  • Experimental support of Python 3.3 in the same code base

  • Drop support of Python 2.5

  • Remove the ptrace.compatibility module

  • Fix Process.readStruct() and Process.readArray() on x86_64

  • Experimental support of ARM architecture (Linux EAPI), strace.py has been tested on Raspberry Pi (armv6l)

python-ptrace 0.6.6 (2013-12-16)

  • Fix os_tools.RUNNING_LINUX for Python 2.x compiled on Linux kernel 3.x

  • Support FreeBSD on x86_64

  • Add missing prototype of the unlinkat() system call. Patch written by Matthew Fernandez.

python-ptrace 0.6.5 (2013-06-06)

  • syscall: fix parsing socketcall on Linux x86

  • syscall: fix protoype of socket()

python-ptrace 0.6.4 (2012-02-26)

  • Convert all classes to new-style classes, patch written by teythoon

  • Fix compilation on Apple, patch written by Anthony Gelibert

  • Support GNU/kFreeBSD, patch written by Jakub Wilk

  • Support sockaddr_in6 (IPv6 address)

python-ptrace 0.6.3 (2011-02-16)

  • Support distrom3

  • Support Python 3

  • Rename strace.py option –socketcall to –socket, and fix this option for FreeBSD and Linux/64 bits

  • Add MANIFEST.in: include all files in source distribution (tests, cptrace module, …)

python-ptrace 0.6.2 (2009-11-09)

  • Fix 64 bits sub registers (set mask for eax, ebx, ecx, edx)

python-ptrace 0.6.1 (2009-11-07)

  • Create follow, showfollow, resetfollow, xray commands in gdb.py. Patch written by Dimitris Glynos

  • Project website moved to http://bitbucket.org/haypo/python-ptrace/

  • Replace types (u)intXX_t by c_(u)intXX

  • Create MemoryMapping.search() method and MemoryMapping now keeps a weak reference to the process

python-ptrace 0.6 (2009-02-13)

User visible changes:

  • python-ptrace now depends on Python 2.5

  • Invalid memory access: add fault address in the name

  • Update Python 3.0 conversion patch

  • Create -i (–show-ip) option to strace.py: show instruction pointer

  • Add a new example (itrace.py) written by Mark Seaborn and based on strace.py

API changes:

  • PtraceSyscall: store the instruction pointer at syscall enter (if the option instr_pointer=True, disabled by default)

  • Remove PROC_DIRNAME and procFilename() from ptrace.linux_proc

Bugfixes:

  • Fix locateProgram() for relative path

  • Fix interpretation of memory fault on MOSVW instruction (source is ESI and destination is EDI, and not the inverse!)

python-ptrace 0.5 (2008-09-13)

Visible changes:

  • Write an example (the most simple debugger) and begin to document the code

  • gdb.py: create “dbginfo” command

  • Parse socket syscalls on FreeBSD

  • On invalid memory access (SIGSEGV), eval the dereference expression to get the fault address on OS without siginfo (eg. FreeBSD)

  • Fixes to get minimal Windows support: fix imports, fix locateProgram()

Other changes:

  • Break the API: - Rename PtraceDebugger.traceSysgood() to PtraceDebugger.enableSysgood() - Rename PtraceDebugger.trace_sysgood to PtraceDebugger.use_sysgood - Remove PtraceProcess.readCode()

  • Create createChild() function which close all files except stdin, stdout and stderr

  • On FreeBSD, on process exit recalls waitpid(pid) to avoid zombi process

python-ptrace 0.4.2 (2008-08-28)

  • BUGFIX: Fix typo in gdb.py (commands => command_str), it wasn’t possible to write more than one command…

  • BUGIFX: Fix typo in SignalInfo class (remove “self.”). When a process received a signal SIGCHLD (because of a fork), the debugger exited because of this bug.

  • BUGFIX: Debugger._wait() return abnormal process exit as a normal event, the event is not raised as an exception

  • PtraceSignal: don’t clear preformatted arguments (eg. arguments of execve)

python-ptrace 0.4.1 (2008-08-23)

  • The project has a new dedicated website: http://python-ptrace.hachoir.org/

  • Create cptrace: optional Python binding of ptrace written in C (faster than ptrace, the Python binding written in Python with ctypes)

  • Add name attribute to SignalInfo classes

  • Fixes to help Python 3.0 compatibility: don’t use sys.exc_clear() (was useless) in writeBacktrace()

  • ProcessState: create utime, stime, starttime attributes

python-ptrace 0.4.0 (2008-08-19)

Visible changes:

  • Rename the project to “python-ptrace” (old name was “Ptrace)

  • strace.py: create –ignore-regex option

  • PtraceSignal: support SIGBUS, display the related registers and the instruction

  • Support execve() syscall tracing

Developer changes:

  • New API is incompatible with 0.3.2

  • PtraceProcess.waitProcessEvent() accepts optional blocking=False argument

  • PtraceProcess.getreg()/setreg() are able to read/write i386 and x86-64 “sub-registers” like al or bx

  • Remove iterProc() function, replaced by openProc() with explicit call to .close() to make sure that files are closed

  • Create searchProcessesByName()

  • Replace CPU_PPC constant by CPU_POWERPC and create CPU_PPC32 and CPU_PPC64

  • Create MemoryMapping object, used by readMappings() and findStack() methods of PtraceProcess

  • Always define all PtraceProcess methods but raise an error if the function is not implemented

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-ptrace-0.7.tar.gz (84.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_ptrace-0.7-py27-none-any.whl (88.5 kB view details)

Uploaded Python 2.7

File details

Details for the file python-ptrace-0.7.tar.gz.

File metadata

  • Download URL: python-ptrace-0.7.tar.gz
  • Upload date:
  • Size: 84.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-ptrace-0.7.tar.gz
Algorithm Hash digest
SHA256 df268620f8201ef7be65be6967799409b9b1befaabb669a09ff59451f17a3c6f
MD5 f1071992679bb20a4e377151f5853632
BLAKE2b-256 bcdeefae0e67afdf0bfc280256a58111be98feed068650065abebb1179b3fe79

See more details on using hashes here.

File details

Details for the file python_ptrace-0.7-py27-none-any.whl.

File metadata

File hashes

Hashes for python_ptrace-0.7-py27-none-any.whl
Algorithm Hash digest
SHA256 94381f461425d4586bf01bae87e83de775786c3efbab17ddadfb99e2f8b0f8bf
MD5 3bd2aec380b2ab22e275b6d0eece17a1
BLAKE2b-256 76968e4d1efe0badac26defa715c4da422f0414a98918668c6ca6a7e51d847d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page