GDB baby!


Some keys

CTRL-X A puts you into TUI mode. CTRL-L reprint screen CTRL-X 2 multiple windows, cycle thru. CTRL-X 1 go back. CTRL-P/N Next and Prev command.

Python interupter.

gdb> python print("hello world") gdb> python[RETURN]

print("type python code here")

gdb> info functions gdb> b factorial(int) # set breakpoint at function. gdb> l N,M # list from/to line number. gdb> info locals # local vars gdb> watch <var> # watch how a var changes. gdb> record full # start record. gdb> c # continue gdb> rs # alias for 'reverse step' gdb> p <var> # print value of var. gdb> set var <var>=<val> # set a var to any value.

gdb buffer overflow & GDB analysis

Examine the procedure call stack. $ gcc -fno-stack-protector -m32 overflow.c

gdb> run <args> gdb> info functions gdb> disass main gdb> x/20x $esp # dive into the stack. gdb> c # continue to do stuff.

gdb> x/20x $\(esp \) # Again to see what happens.

gdb> run # run Again, breakpoint will still

be set.

python>>> print "AAAAAAAAAAAAAAABBBB" > attack.txt

python>>> print 'A*28' + '\xfa\x84\x04\x08'