Skip to content

Instantly share code, notes, and snippets.

@VVX7
Created September 16, 2023 19:06
Show Gist options
  • Save VVX7/32ab900e572ad6a3b8bd4522300311cf to your computer and use it in GitHub Desktop.
Save VVX7/32ab900e572ad6a3b8bd4522300311cf to your computer and use it in GitHub Desktop.
gdb_dump_memory
#!/bin/bash
#./dump-memory.sh <PID>
#https://book.hacktricks.xyz/linux-hardening/privilege-escalation#os-info
grep rw-p /proc/$1/maps \
| sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' \
| while read start stop; do \
gdb --batch --pid $1 -ex \
"dump memory $1-$start-$stop.dump 0x$start 0x$stop"; \
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment