cfg/.zsh/config.sh.d/portknock.sh
Knut Ahlers b7fb88cb79
Add port-knock function
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-08-16 13:00:51 +02:00

10 lines
259 B
Bash

# pknock provides a port-knock tool based on ncat
function pknock {
HOST="$1"
# Perform port knocking sequence
echo "Knocking requested port sequence (${HOST} - ${*:2})" >&2
for i in ${*:2}; do
ncat -w 50ms "${HOST}" $i 1>/dev/null 2>&1
done
}