gdb

ret2libc attack MOVAPS segfault

ret2libc attack MOVAPS segfault Question: I am trying to exploit a ret2libc vulnerable code in my own machine. Here is the source code. #include <unistd.h> #include <stdio.h> #include <string.h> #include <stdlib.h> void vuln(char *input); int main(int argc, char **argv) { if (argc > 1){ vuln(argv[1]); }; return 0; } void vuln(char *input){ char buffer[256]; memcpy(buffer, …

Total answers: 1

Why PyList_Append is called each time a list is evaluated?

Why PyList_Append is called each time a list is evaluated? Question: I’m working with CPython3.11.0a3+. I added a break point at PyList_Append and modified the function to stop when the newitem is a dict. The original function: int PyList_Append(PyObject *op, PyObject *newitem) { if (PyList_Check(op) && (newitem != NULL)) return app1((PyListObject *)op, newitem); PyErr_BadInternalCall(); return …

Total answers: 1

Fast ways of accessing core data (via gdb, external library, etc)

Fast ways of accessing core data (via gdb, external library, etc) Question: I have a gdb python macro walking through data in a c generated core file. The macro can take a long time to run. It walks through a list of struct pointers, reading each pointer into a gdb.Value. The majority of the time …

Total answers: 1

How to change the Python Interpreter that gdb uses?

How to change the Python Interpreter that gdb uses? Question: I’m using ubuntu 14.04, where python3 is a default system package. I want to debug Python2.7 programs with gdb, but I seem to encounter this issue: When i’m in gdb, using the py command puts me in an interpreter, so i ran these commands in …

Total answers: 3

C++ GDB Python Pretty Printing Tutorial?

C++ GDB Python Pretty Printing Tutorial? Question: I am looking for a solid tutorial on creating a custom printer. There are a few sparse pages on the GDB page however they are far from complete and leave much to the imagination! For instance, I’d love to be able to create a PrettyPrinter for our custom …

Total answers: 2

Memory dump formatted like xxd from gdb

Memory dump formatted like xxd from gdb Question: I’m trying to inspect a buffer which contains a binary formatted message, but also contains string data. As an example, I’m using this C code: int main (void) { char buf[100] = “x01x02x03x04String DataxAAxBBxCC”; return 0; } I’d like to get a hex dump of what’s in …

Total answers: 5

How to access the keys or values of Python GDB Value

How to access the keys or values of Python GDB Value Question: I have a struct in GDB and want to run a script which examines this struct. In Python GDB you can easily access the struct via (gdb) python mystruct = gdb.parse_and_eval(“mystruct”) Now I got this variable called mystruct which is a GDB.Value object. …

Total answers: 3

Debugging: stepping through Python script using gdb?

Debugging: stepping through Python script using gdb? Question: Let’s say we have the following mega-simple Python script: print “Initializing”…. a=10 print “Variable value is %d” % (a) print “All done!” … and say, I’d like to debug this script by placing a breakpoint at line a=10, and then stepping through the script. Now, I’d like …

Total answers: 4

Is it possible to use GDB's reverse debugging with Python? How?

Is it possible to use GDB's reverse debugging with Python? How? Question: I am trying to use GDB’s reverse debugging with a Django application. I get it running in GDB, but I can’t make it run backwards. I stopped my Django app with Ctrl-Z and then entered reverse-next at the gdb prompt, getting the error …

Total answers: 3

Invoke and control GDB from Python

Invoke and control GDB from Python Question: I am running a Python GUI application. I want to invoke and control GDB from it, like load an executable file, set breakpoints etc. I see that GDB has a command line interface which can be used by sending strings to the GDB process, but I want to …

Total answers: 2