/usr/bin/rebind is in websockify 0.8.0+dfsg1-9.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/usr/bin/env bash
mydir="$(readlink -f "$(dirname "${0}")")"
mylib="${mydir}/../lib/websockify/rebind.so"
[ -e "${mylib}" ] || { echo "${mylib} not found" >&2; exit 1; }
usage() {
echo "Usage: $(basename $0) OLD_PORT NEW_PORT COMMAND_LINE"
echo
echo "Launch COMMAND_LINE, but intercept system calls to bind"
echo "to OLD_PORT and instead bind them to localhost:NEW_PORT"
exit 2
}
# Parameter defaults
export REBIND_PORT_OLD="${1}"
export REBIND_PORT_NEW="${2}"
shift 2
LD_PRELOAD="${mylib}" exec "${@}"
|