Last active
December 18, 2020 12:02
-
-
Save therealdreg/906596aab3168d952df5e1149511dc68 to your computer and use it in GitHub Desktop.
Dreg gdb setup intel syntax, break start, print stack one value per column etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dreg gdb setup intel syntax, break start, print stack one value per column etc | |
r `perl -e 'print "A" x 300'` | |
gdb --args /bin/ls `perl -e 'print "A" x 300'` | |
gdb --args /bin/ls $(python -c "print 'A' * 64 + '\xef\xbe\xad\xde'") | |
set args $(python -c "print 'A' * 64 + '\xef\xbe\xad\xde'") | |
run <<< $(python -c "print 'A' * 64 + '\xef\xbe\xad\xde'") | |
set args $(python -c "print 'A' * 64 + '\xef\xbe\xad\xde'") | |
- | |
https://github.com/cyrus-and/gdb-dashboard | |
dashboard -layout registers assembly memory stack | |
dashboard registers -style column-major True | |
dashboard memory watch 0x00007fffffffe6a0 40 | |
- | |
https://github.com/scwuaptx/Pwngdb | |
https://github.com/stmerry/gdb-peda-cheatsheet/blob/master/gdb-peda%20cheatsheet.pdf | |
git clone https://github.com/longld/peda.git ~/peda | |
git clone https://github.com/scwuaptx/Pwngdb.git | |
cp ~/Pwngdb/.gdbinit ~/ | |
- | |
https://github.com/hugsy/gef | |
- | |
set breakpoint pending on | |
set confirm off | |
set disassembly-flavor intel | |
set disassemble-next-line on | |
disas /r | |
i r | |
tui enable | |
layout asm | |
layout regs | |
starti | |
stepi | |
nexti | |
break* main | |
define dregstack | |
set $pos = 0 | |
while ($pos < $arg0) | |
x/gx $rsp+$pos | |
set $pos = $pos + 8 | |
end | |
end | |
Stack from rsp: | |
set $pos = 0 | |
set $limit = 0x20 | |
while ($pos < $limit) | |
x/gx $rsp+$pos | |
set $pos = $pos + 8 | |
end | |
Stack from rbp to rsp: | |
set $pos = 0 | |
while ($pos < ($rbp-$rsp)) | |
x/gx $rbp-$pos | |
set $pos = $pos + 8 | |
end | |
0x7fffffffe690: 0x0000000000000000 | |
0x7fffffffe688: 0x0000000000000000 | |
0x7fffffffe680: 0x0000000000000000 | |
0x7fffffffe678: 0x0000000000000000 | |
0x7fffffffe670: 0x0000000000000000 | |
0x7fffffffe668: 0x0000000000000000 | |
0x7fffffffe660: 0x0000000000000000 | |
0x7fffffffe658: 0x0000000000000000 | |
0x7fffffffe650: 0x0000000000000000 | |
0x7fffffffe648: 0x0000000000000000 | |
0x7fffffffe640: 0x0000000000000000 | |
0x7fffffffe638: 0x0000000000000000 | |
define xxd | |
dump binary memory dump.bin $arg0 $arg0+$arg1 | |
shell xxd -g 1 -e dump.bin | |
end | |
xxd $esp 10 | |
xxd 0xff89f433 10 | |
00000000: 2f 68 6f 6d 65 2f 6b 61 6c 69 /home/kali | |
Stack from ebp to esp: | |
set $pos = 0 | |
while ($pos < ($ebp-$esp)) | |
x/wx $ebp-$pos | |
set $pos = $pos + 4 | |
end | |
Stack from esp: | |
set $pos = 0 | |
set $limit = 0x20 | |
while ($pos < $limit) | |
x/wx $esp+$pos | |
set $pos = $pos + 4 | |
end | |
0xff89d6f0: 0x00000001 | |
0xff89d6f4: 0xff89d7c4 | |
0xff89d6f8: 0xff89d7cc | |
0xff89d6fc: 0x0804939d | |
0xff89d700: 0xff89d720 | |
0xff89d704: 0x00000000 | |
0xff89d708: 0x00000000 | |
0xff89d70c: 0xf7d99df6 | |
x/s **((char ***) ($esp + 0x4)) | |
0xff89f433: "/home/kali/stackb0f2/stackb0f2" | |
x/s 0xff89f433 | |
0xff89f433: "/home/kali/stackb0f2/stackb0f2" | |
define dregstack | |
set $pos = 0 | |
while ($pos < $arg0) | |
x/wx $esp+$pos | |
set $pos = $pos + 4 | |
end | |
end | |
dregstack 0x9 | |
0xff89d6f0: 0x00000001 | |
0xff89d6f4: 0xff89d7c4 | |
0xff89d6f8: 0xff89d7cc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment