init
This commit is contained in:
commit
2eef88f3c9
2 changed files with 29 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/*.so
|
28
dump.sh
Executable file
28
dump.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
pid="$1"
|
||||||
|
target_soname="$2"
|
||||||
|
|
||||||
|
echo "pid: $pid"
|
||||||
|
echo "soname: $target_soname"
|
||||||
|
|
||||||
|
lines=()
|
||||||
|
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
for line in $(cat /proc/$pid/maps); do
|
||||||
|
region=${line%% *}
|
||||||
|
region_file=/proc/$pid/map_files/$region
|
||||||
|
if [[ -e $region_file ]]; then
|
||||||
|
soname=$(objdump -p "$region_file" 2>/dev/null | grep SONAME ||:)
|
||||||
|
if [[ $(echo "$soname" | awk '{print $2}') == $target_soname ]]; then
|
||||||
|
lines+=($line)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for line in ${lines[@]}; do
|
||||||
|
dd if="/proc/$pid/map_files/$(echo "$line" | awk '{print $1}')" seek="$((16#$(echo "$line" | awk '{print $3}')))" of=$target_soname
|
||||||
|
done
|
Loading…
Add table
Add a link
Reference in a new issue