Skip to content

Instantly share code, notes, and snippets.

@haqpl
Last active December 12, 2021 20:26
Show Gist options
  • Save haqpl/f6f41a3ff7cbc9ed1f27c4a1457103f8 to your computer and use it in GitHub Desktop.
Save haqpl/f6f41a3ff7cbc9ed1f27c4a1457103f8 to your computer and use it in GitHub Desktop.
Setup Java RMI registry and parse RMI calls.
#!/bin/bash
# haqpl
# https://aweirdimagination.net/2020/06/28/kill-child-jobs-on-script-exit/
cleanup() {
# kill all processes whose parent is this process
pkill -P $$
}
for sig in INT QUIT HUP TERM; do
trap "
cleanup
trap - $sig EXIT
kill -s $sig "'"$$"' "$sig"
done
trap cleanup EXIT
rmiregistry 1098 &
socat TCP4-LISTEN:$1,fork TCP6:[::1]:1098 | sudo tshark -i $2 -T fields -Y "rmi.outputstream.message == 0x50" -e "rmi.serialization_data" > rmi_calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment