All Projects → pinterest → Ptracer

pinterest / Ptracer

Licence: apache-2.0
A library for ptrace-based tracing of Python programs

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Ptracer

PRoot
chroot, mount --bind, and binfmt_misc without privilege/setup for Linux
Stars: ✭ 31 (-77.21%)
Mutual labels:  ptrace, syscalls
Tardis
Trace And Rewrite Delays In Syscalls: Hooking time-related Linux syscalls to warp a process's perspective of time, using ptrace.
Stars: ✭ 144 (+5.88%)
Mutual labels:  syscalls, ptrace
Proot
chroot, mount --bind, and binfmt_misc without privilege/setup for Linux
Stars: ✭ 933 (+586.03%)
Mutual labels:  syscalls, ptrace
Write A Strace And Gdb
A tiny system call tracer and debugger implementation
Stars: ✭ 93 (-31.62%)
Mutual labels:  syscalls, ptrace
Sandy
A tiny "sandbox" to run untrusted code 🏖️
Stars: ✭ 335 (+146.32%)
Mutual labels:  ptrace
Syscall intercept
The system call intercepting library
Stars: ✭ 408 (+200%)
Mutual labels:  syscalls
Kubectl Dig
Deep kubernetes visibility from the kubectl
Stars: ✭ 325 (+138.97%)
Mutual labels:  syscalls
Krf
A kernelspace syscall interceptor and randomized faulter
Stars: ✭ 267 (+96.32%)
Mutual labels:  syscalls
Syswall
Work in progress firewall for Linux syscalls, written in Rust
Stars: ✭ 110 (-19.12%)
Mutual labels:  syscalls
Ios debugger challenge
A playground for run-time iOS app inspection
Stars: ✭ 39 (-71.32%)
Mutual labels:  ptrace
Procjack
PoC of injecting code into a running Linux process
Stars: ✭ 17 (-87.5%)
Mutual labels:  ptrace
Dlinject
Inject a shared library (i.e. arbitrary code) into a live linux process, without ptrace
Stars: ✭ 521 (+283.09%)
Mutual labels:  ptrace
Freshycalls
FreshyCalls tries to make the use of syscalls comfortable and simple, without generating too much boilerplate and in modern C++17!
Stars: ✭ 37 (-72.79%)
Mutual labels:  syscalls
Cubostratus
Blazingly fast Linux syscall collector
Stars: ✭ 68 (-50%)
Mutual labels:  syscalls
Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (+501.47%)
Mutual labels:  ptrace
Pyflame
🔥 Pyflame: A Ptracing Profiler For Python. This project is deprecated and not maintained.
Stars: ✭ 2,930 (+2054.41%)
Mutual labels:  ptrace
Nitro
Stars: ✭ 38 (-72.06%)
Mutual labels:  syscalls
Shellen
🌸 Interactive shellcoding environment to easily craft shellcodes
Stars: ✭ 799 (+487.5%)
Mutual labels:  syscalls
Picotrace
picotrace - system call process tracer
Stars: ✭ 26 (-80.88%)
Mutual labels:  ptrace
Ltp
Linux Test Project http://linux-test-project.github.io/
Stars: ✭ 1,654 (+1116.18%)
Mutual labels:  syscalls

ptracer -- a library for ptrace-based tracing of Python programs

Ptracer is a library providing on-demand system call tracing in Python programs.

Basic Usage

.. code-block:: python

import traceback
import ptracer

def callback(syscall):
    print('{}({}) -> {}'.format(
        syscall.name,
        ', '.join(repr(arg.value) for arg in syscall.args),
        syscall.result.text))
    print('Traceback: ')
    print(''.join(traceback.format_list(syscall.traceback)))

with ptracer.context(callback):
    open('/dev/null', 'wb')

Filtering

Ptracer allows elaborate syscall filtering via the filter argument:

.. code-block:: python

flt = [
    ptracer.SysCallPattern(
        name='open',
        args=[
            re.compile(b'/tmp/.*'),
            lambda arg: arg.value & os.O_WRONLY
        ],
        result=lambda res: res.value > 0
    )
]

with ptracer.context(callback, filter=flt):
    # traced code
    ...

In the above example, ptracer will invoke the callback only for successful attempts to open files in the "/tmp" directory for writing.

Documentation

The documentation is available on ptracer.readthedocs.io <https://ptracer.readthedocs.io/>_.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].