Add port-knock function

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-08-16 13:00:04 +02:00
parent 3d33b8d73b
commit b7fb88cb79
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View file

@ -0,0 +1,10 @@
# 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
}