Skip to content

Instantly share code, notes, and snippets.

@Zobber
Created May 12, 2020 00:50
Show Gist options
  • Save Zobber/286ef5735d5692ef5c3584c17646fca7 to your computer and use it in GitHub Desktop.
Save Zobber/286ef5735d5692ef5c3584c17646fca7 to your computer and use it in GitHub Desktop.
##### Pure bash
procdump()
(
cat /proc/$1/maps | grep "rw-p" | awk '{print $1}' | ( IFS="-"
while read a b; do
dd if=/proc/$1/mem bs=$( getconf PAGESIZE ) iflag=skip_bytes,count_bytes \
skip=$(( 0x$a )) count=$(( 0x$b - 0x$a )) of="$1_mem_$a.bin"
done )
)
###### procdump PID
procdump()
(
cat /proc/$1/maps | grep -Fv ".so" | grep " 0 " | awk '{print $1}' | ( IFS="-"
while read a b; do
dd if=/proc/$1/mem bs=$( getconf PAGESIZE ) iflag=skip_bytes,count_bytes \
skip=$(( 0x$a )) count=$(( 0x$b - 0x$a )) of="$1_mem_$a.bin"
done )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment