Skip to content

Latest commit

 

History

History
28 lines (25 loc) · 1.26 KB

README.md

File metadata and controls

28 lines (25 loc) · 1.26 KB

Port knocker script for bash

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!

Usage

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 :-)

Parameters

  • [--]host|-h hostname or IP address to knock. Mandatory argument.
  • [--]ports|-p comma-separated list of ports to knock, can be used multiple times. Mandatory argument.
    Example: -p tcp:123,udp:321,tcp:433 or -p tcp:123 -p udp:321,tcp:433 etc
  • [--]delay|-d delay between knocks. Optional argument. Default: 0.1s
  • [--]help show help message.