Skip to content

Instantly share code, notes, and snippets.

@minkione
Forked from haqpl/rmi_dump.sh
Created December 12, 2021 20:26
Show Gist options
  • Save minkione/f255e2cb81036ba5f146b2421edf046d to your computer and use it in GitHub Desktop.
Save minkione/f255e2cb81036ba5f146b2421edf046d 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