Skip to content

Instantly share code, notes, and snippets.

@jo-makar
Last active October 17, 2019 20:02
Show Gist options
  • Save jo-makar/e88169f90ff1240aa031120d29b5f7fc to your computer and use it in GitHub Desktop.
Save jo-makar/e88169f90ff1240aa031120d29b5f7fc to your computer and use it in GitHub Desktop.
Read live process memory

Read live process memory

/proc/$pid/maps describes virtual memory regions with the first column being the address range

cd /proc/$pid/mem

# Extract the start and end address for the first entry (NR==1)
eval $(awk -F'[- ]' 'NR==1 {print "s="$1" e="$2}' maps)

/proc/$pid/mem provides access to the process' virtual memory

python3 -c 'f=open("mem","rb"); f.seek(0x'$s'); (f.read(0x'$e'-0x'$s'))' | hexdump -C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment