README.md
Rendering markdown...
#!/bin/bash
# calibrate.sh — resolve runtime addresses and write profile.json.
set -euo pipefail
LAB_ROOT=${LAB_ROOT:-/opt/zmq-curve-rce}
PID=$(pgrep -x server-curve | head -1)
[ -n "$PID" ] || { echo "[!] server-curve not running" >&2; exit 1; }
echo "[*] server PID: $PID" >&2
python3 -c "
import json
build = json.load(open('$LAB_ROOT/build_offsets.json'))
profile = {
'trampoline_addr': build['trampoline_addr'],
'offset_to_ret': build['offset_to_ret'],
'system_off': build['system_off'],
}
with open('$LAB_ROOT/profile.json', 'w') as f:
json.dump(profile, f, indent=2)
print(json.dumps({k: (hex(v) if v > 0xffff else v) for k, v in profile.items()}, indent=2))
"
echo "" >&2
echo "[OK] profile written to $LAB_ROOT/profile.json" >&2