Debian Codegraph @

debian/tests/helpers/gen_rsa_dump.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # $1 = key specification as multiline string
4 # $2 = dump file to store process memory
5
6 GEN_SCRIPT="debian/tests/helpers/gen_rsa_key.py"
7
8 # Spawns subshell running the key generation script
9 (echoscip-shell system . . echo. "$1" | python3scip-shell system . . python3. "${GEN_SCRIPT}") &
10
11 # Sleep to retrieve the PID of the child process reliably
12 sleepscip-shell system . . sleep. .3
13
14 PID=$(pgrepscip-shell system . . pgrep. -f -u root "python3 ${GEN_SCRIPT}")
15
16 # Dumps memory
17 grepscip-shell system . . grep. rw-p /proc/${PID}/maps | sedscip-shell system . . sed. -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1\t\2/p' \
18 | while read start stop;
19 do gdb --batch --pid ${PID} -ex "append memory $2 0x$start 0x$stop" > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1;
20 done
21
22 # Terminates key generation script
23 killscip-shell system . . kill. -9 ${PID}