A simple bash script for knocking on TCP and UDP ports. Accepts unlimited number of ports. Delay between knocks can be adjusted.
Tested on Debian and CentOS, but should run on any OS with bash installed.
No dependencies!
Download the script, make it executable and run it.
curl https://raw.githubusercontent.com/kolbasky/port-knocker/main/knocker.sh > knocker.sh
chmod +x knocker.sh
./knocker.sh --host(-h) sample.server.net --ports(-p) udp:111,tcp:222,... [--delay(-d) 0.1s]
Parameters are accepted in numerous forms.
./knocker.sh -h server -p udp:111,tcp:222 -d 0.2s
./knocker.sh --host=server --ports=udp:111,tcp:222,udp:333
./knocker.sh host server -p udp:111 -p=tcp:222 --p udp:333 --delay=1s
So are the ports:
tcp:111 or 111:tcp or 111tcp or 111/tcp or TCP@111 etc
Any way you want it :-)
[--]host|-hhostname or IP address to knock. Mandatory argument.[--]ports|-pcomma-separated list of ports to knock, can be used multiple times. Mandatory argument.
Example:-p tcp:123,udp:321,tcp:433or-p tcp:123 -p udp:321,tcp:433etc[--]delay|-ddelay between knocks. Optional argument. Default:0.1s[--]helpshow help message.