-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy path__init__.py
More file actions
68 lines (55 loc) · 2.51 KB
/
Copy path__init__.py
File metadata and controls
68 lines (55 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""libdebug: A Python library for programmatic debugging of binary executables.
libdebug provides a comprehensive set of building blocks designed to facilitate the development
of debugging tools for different purposes, including reverse engineering and exploitation.
With libdebug you have full control of your debugged executable:
- Access process memory and registers
- Control the execution flow of the process
- Handle and hijack syscalls
- Catch and hijack signals
- Interact with stdin, stdout, and stderr of the debugged process
- Debug multithreaded and multiprocess applications with ease
- Seamlessly switch to GDB for interactive analysis
- Debug on Linux systems based on AMD64, AArch64, and i386
Classes:
Debugger: The main debugger class that provides all methods to run and interact with processes.
Breakpoint: Represents a breakpoint that can be set in the debugged process.
SignalCatcher: Handles signal catching and hijacking functionality.
SyscallHandler: Manages system call handling and hijacking.
ThreadContext: Provides access to thread-specific information and state.
Functions:
debugger: Factory function to create a Debugger instance with the specified configuration.
Objects:
libcontext: Singleton configuration object for libdebug settings and terminal configuration.
Example:
Basic usage for debugging a binary:
>>> from libdebug import debugger
>>> d = debugger("/path/to/binary")
>>> io = d.run()
>>> bp = d.breakpoint("main")
>>> d.cont()
>>> d.wait()
>>> print(f"RAX: {d.regs.rax:#x}")
>>> d.cont()
Advanced usage with signal and syscall handling:
>>> from libdebug import debugger
>>> d = debugger("./binary", aslr=False)
>>> io = d.run()
>>> catcher = d.catch_signal("SIGINT", lambda t, c: print("Caught SIGINT!"))
>>> handler = d.handle_syscall("write", on_enter=lambda t, h: print("write() called"))
>>> d.cont()
For more information, visit: https://docs.libdebug.org
"""
try:
from rich.traceback import install
except ImportError:
pass
else:
install()
from libdebug.data.breakpoint import Breakpoint
from libdebug.data.signal_catcher import SignalCatcher
from libdebug.data.syscall_handler import SyscallHandler
from libdebug.debugger.debugger import Debugger
from libdebug.libdebug import debugger
from libdebug.state.thread_context import ThreadContext
from libdebug.utils.libcontext import libcontext
__all__ = ["Breakpoint", "Debugger", "SignalCatcher", "SyscallHandler", "ThreadContext", "debugger", "libcontext"]