Trees | Index | Help |
|
---|
Package pydbg :: Module pydbg_core :: Class pydbg_core |
|
object
--+
|
pydbg_core
pydbg
Method Summary | |
---|---|
Set the default attributes. | |
system_dll |
Return the system DLL that contains the address specified. |
MODULEENTRY32 |
Return the MODULEENTRY32 structure for the module that contains the address specified. |
pydbg_core |
Attach to the specified process by PID. |
pydbg_core |
Clean up after ourselves. |
Bool |
Convenience wraper around kernel32.CloseHandle(). |
Convenience wrapper around GetLastError() and FormatMessage(). | |
Enter the infinite debug event handling loop. | |
Convenience wrapper around DebugSetProcessKillOnExit(). | |
Detach from debuggee. | |
List |
Using the CreateToolhelp32Snapshot() API enumerate and return the list of module name / base address tuples that belong to the debuggee |
List |
Using the CreateToolhelp32Snapshot() API enumerate all system processes returning a list of pid / process name tuples. |
List |
Using the CreateToolhelp32Snapshot() API enumerate all system threads returning a list of thread IDs that belong to the debuggee. |
DWORD |
This is the default CREATE_PROCESS_DEBUG_EVENT handler. |
DWORD |
This is the default CREATE_THREAD_DEBUG_EVENT handler. |
This is the default EXIT_PROCESS_DEBUG_EVENT handler. | |
DWORD |
This is the default EXIT_THREAD_DEBUG_EVENT handler. |
DWORD |
This is the default LOAD_DLL_DEBUG_EVENT handler. |
DWORD |
This is the default UNLOAD_DLL_DEBUG_EVENT handler. |
DWORD |
This is the default EXCEPTION_ACCESS_VIOLATION handler. |
DWORD |
This is the default EXCEPTION_BREAKPOINT handler. |
DWORD |
This is the default EXCEPTION_GUARD_PAGE handler. |
DWORD |
This is the default EXCEPTION_SINGLE_STEP handler. |
Mixed |
Return the value for the specified class attribute. |
Obtain necessary privileges for debugging. | |
Mixed |
Return the system DLL at the specified index. |
CONTEXT |
Convenience wrapper around GetThreadContext(). |
MODULEENTRY32 |
A simple iterator function that can be used to iterate through all modules the target process has mapped in its address space. |
PROCESSENTRY32 |
A simple iterator function that can be used to iterate through all running processes. |
PROCESSENTRY32 |
A simple iterator function that can be used to iterate through all running processes. |
Load the specified executable and optional command line arguments into the debugger. | |
Convenience wrapper around OpenProcess(). | |
Convenience wrapper around OpenThread(). | |
Alias to read_process_memory(). | |
Raw |
Read from the debuggee process space. |
pydbg_core |
Resume all process threads. |
pydbg_core |
Resume the specified thread. |
This convenience routine exists for internal functions to call and transparently return the correct version of self. | |
Alias for debug_event_loop(). | |
Return the value for the specified class attribute. | |
Set a callback for the specified exception (or debug event) code. | |
Enable or disable the control flag for the main debug event loop. | |
pydbg_core |
Convenience wrapper around SetThreadContext(). |
Interrupt signal handler. | |
pydbg_core |
Enable or disable single stepping in the specified thread or self.h_thread if a thread handle is not specified. |
pydbg_core |
Suspend all process threads. |
pydbg_core |
Suspend the specified thread. |
Terminate the debuggee. | |
DWORD |
Convenience wrapper around VirtualAllocEx() |
Convenience wrapper around VirtualFreeEx() | |
DWORD |
Convenience wrapper around VirtualProtectEx() |
MEMORY_BASIC_INFORMATION |
Convenience wrapper around VirtualQueryEx(). |
Convenience wrapper around GetLastError() and FormatMessage(). | |
Alias to write_process_memory(). | |
Write to the debuggee process space. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Class Variable Summary | |
---|---|
dict |
callbacks = {}
|
bool |
client_server = False
|
NoneType |
context = None |
NoneType |
dbg = None |
bool |
debugger_active = True
|
bool |
dirty = False
|
NoneType |
exception_address = None |
bool |
follow_forks = False
|
NoneType |
h_process = None |
NoneType |
h_thread = None |
int |
page_size = 0 |
int |
pid = 0 |
list |
system_dlls = []
|
NoneType |
violation_address = None |
NoneType |
write_violation = None |
Method Details |
---|
__init__(self,
ff=True,
cs=False)
Set the default attributes. See the source if you want to modify the
default creation values.
|
addr_to_dll(self, address)Return the system DLL that contains the address specified.
|
addr_to_module(self, address)Return the MODULEENTRY32 structure for the module that contains the address specified.
|
attach(self, pid)Attach to the specified process by PID. Saves a process handle in self.h_process and prevents debuggee from exiting on debugger quit.
|
cleanup(self)Clean up after ourselves.
|
close_handle(self, handle)Convenience wraper around kernel32.CloseHandle().
|
debug_active_process(self, pid)Convenience wrapper around GetLastError() and FormatMessage(). Returns the error code and formatted message associated with the last error. You probably do not want to call this directly, rather look at attach().
|
debug_event_loop(self)Enter the infinite debug event handling loop. This is the main loop of the debugger and is responsible for catching debug events and exceptions and dispatching them appropriately. This routine will check for and call the USER_CALLBACK_DEBUG_EVENT callback on each loop iteration. run() is an alias for this routine.
|
debug_set_process_kill_on_exit(self, kill_on_exit)Convenience wrapper around DebugSetProcessKillOnExit().
|
detach(self)Detach from debuggee. |
enumerate_modules(self)Using the CreateToolhelp32Snapshot() API enumerate and return the list of module name / base address tuples that belong to the debuggee
|
enumerate_processes(self)Using the CreateToolhelp32Snapshot() API enumerate all system processes returning a list of pid / process name tuples.
|
enumerate_threads(self)Using the CreateToolhelp32Snapshot() API enumerate all system threads returning a list of thread IDs that belong to the debuggee.
|
event_handler_create_process(self)This is the default CREATE_PROCESS_DEBUG_EVENT handler.
|
event_handler_create_thread(self)This is the default CREATE_THREAD_DEBUG_EVENT handler.
|
event_handler_exit_process(self)This is the default EXIT_PROCESS_DEBUG_EVENT handler.
|
event_handler_exit_thread(self)This is the default EXIT_THREAD_DEBUG_EVENT handler.
|
event_handler_load_dll(self)This is the default LOAD_DLL_DEBUG_EVENT handler.
|
event_handler_unload_dll(self)This is the default UNLOAD_DLL_DEBUG_EVENT handler.
|
exception_handler_access_violation(self)This is the default EXCEPTION_ACCESS_VIOLATION handler.
|
exception_handler_breakpoint(self)This is the default EXCEPTION_BREAKPOINT handler.
|
exception_handler_guard_page(self)This is the default EXCEPTION_GUARD_PAGE handler.
|
exception_handler_single_step(self)This is the default EXCEPTION_SINGLE_STEP handler.
|
get_attr(self, attribute)Return the value for the specified class attribute. This routine should be used over directly accessing class member variables for transparent support across local vs. client/server debugger clients.
|
get_debug_privileges(self)Obtain necessary privileges for debugging.
|
get_system_dll(self, idx)Return the system DLL at the specified index. If the debugger is in client / server mode, remove the PE structure (we do not want to send that mammoth over the wire).
|
get_thread_context(self, thread_handle, thread_id=0)Convenience wrapper around GetThreadContext(). Can obtain a thread context via a handle or thread id.
|
iterate_modules(self)A simple iterator function that can be used to iterate through all modules the target process has mapped in its address space. Yielded objects are of type MODULEENTRY32.
|
iterate_processes(self)A simple iterator function that can be used to iterate through all running processes. Yielded objects are of type PROCESSENTRY32.
|
iterate_threads(self)A simple iterator function that can be used to iterate through all running processes. Yielded objects are of type PROCESSENTRY32.
|
load(self, path_to_file, command_line=None)Load the specified executable and optional command line arguments into the debugger.
|
open_process(self, pid)Convenience wrapper around OpenProcess().
|
open_thread(self, thread_id)Convenience wrapper around OpenThread().
|
read(self, address, length)Alias to read_process_memory().
|
read_process_memory(self, address, length)Read from the debuggee process space.
|
resume_all_threads(self)Resume all process threads.
|
resume_thread(self, thread_id)Resume the specified thread.
|
ret_self(self)This convenience routine exists for internal functions to call and transparently return the correct version of self. Specifically, an object in normal mode and a moniker when in client/server mode.
|
run(self)Alias for debug_event_loop().
|
set_attr(self, attribute, value)Return the value for the specified class attribute. This routine should be used over directly accessing class member variables for transparent support across local vs. client/server debugger clients.
|
set_callback(self, exception_code, callback_func)Set a callback for the specified exception (or debug event) code. The prototype of the callback routines is:func (pydbg): return DBG_CONTINUE # or other continue statusYou can register callbacks for any exception code or debug event. Look in the source for all event_handler_xxx and exception_handler_xxx routines to see which ones have internal processing (internal handlers will still pass control to your callback). You can also register a user specified callback that is called on each loop iteration from within debug_event_loop(). The callback code is USER_CALLBACK_DEBUG_EVENT and the function prototype is: func (pydbg) return DBG_CONTINUE # or other continue status
|
set_debugger_active(self, enable)Enable or disable the control flag for the main debug event loop. This is a convenience shortcut over set_attr.
|
set_thread_context(self, context, thread_handle=None, thread_id=0)Convenience wrapper around SetThreadContext(). Can set a thread context via a handle or thread id.
|
sigint_handler(self, signal_number, stack_frame)Interrupt signal handler. We override the default handler to disable the run flag and exit the main debug event loop.
|
single_step(self, enable, thread_handle=None)Enable or disable single stepping in the specified thread or self.h_thread if a thread handle is not specified.
|
suspend_all_threads(self)Suspend all process threads.
|
suspend_thread(self, thread_id)Suspend the specified thread.
|
terminate_process(self, exit_code=0)Terminate the debuggee.
|
virtual_alloc(self, address, size, alloc_type, protection)Convenience wrapper around VirtualAllocEx()
|
virtual_free(self, address, size, free_type)Convenience wrapper around VirtualFreeEx()
|
virtual_protect(self, base_address, size, protection)Convenience wrapper around VirtualProtectEx()
|
virtual_query(self, address)Convenience wrapper around VirtualQueryEx().
|
win32_error(self, prefix=None)Convenience wrapper around GetLastError() and FormatMessage(). Raises an exception with the relevant error code and formatted message.
|
write(self, address, data, length=0)Alias to write_process_memory().
|
write_process_memory(self, address, data, length=0)Write to the debuggee process space. Convenience wrapper around WriteProcessMemory(). This routine will continuously attempt to write the data requested until it is complete.
|
Class Variable Details |
---|
callbacks
|
client_server
|
context
|
dbg
|
debugger_active
|
dirty
|
exception_address
|
follow_forks
|
h_process
|
h_thread
|
page_size
|
pid
|
system_dlls
|
violation_address
|
write_violation
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Jun 16 17:16:24 2006 | http://epydoc.sf.net |