knockr

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

knockr

knockr is a port-knocking utility potentially more convenient to use than a general purpose tool like nmap or netcat. Written in Go, the utility is a single binary, installable on any platform Go supports including Linux, BSD/Unix, Windows and Mac.

Installation

Via the Go tool chain
go install github.com/solutionroute/knockr@v0.2.0

Linux without glibc: The Go net package includes CGO bindings; Linux distributions not based on glibc such as Alpine Linux or Void Linux (musl variant only) can install a statically linked version with:

CGO_ENABLED=0 go install github.com/solutionroute/knockr@v0.2.0
Other Install Options

Pre-built binary for Linux:

The releases page provides a link to a non CGO-based binary that will run on various Linux distributions.

From local sources:

git clone https://github.com/solutionroute/knockr.git
cd knockr
go install 

Usage

The conservative default timeout and delay durations should be sufficient for most use cases.

Usage: knockr [OPTIONS] address port1,port2...

-d duration
        delay between knocks (default 100ms)
-n string
        network protocol (default "tcp")
-s	silent: suppress all but error output
-t duration
        timeout for each knock (default 1.5s)

Example:

# knock on three ports using the default protocol (tcp) and delays
knockr my.host.name 1234,8923,1233

Tip: Include the port(s) you expect to be unlocked as the first and last port in the chain to observe status before and after. For example, if intending to unlock port 22 (ssh) on a specific host:

knockr my.host.name 22,1234,18923,1233,22

What is port-knocking?

Port-knocking is a network access method that opens ports normally left closed to the outside world, but only when the right sequence of ports has been visited and within time frames determined by your network access configuration. That sequence of ports acts as a key.

knockr is just the remote side of the solution; a network access device like a router must be configured.

Port-knocking can be configured on hosts and many routers including some low-cost, high functionality devices accessible to technical consumers such as Mikrotik RouterOS devices.

Typically the solution will be configured such that the target port (not necessarily specified in the port-knocking requests) are only opened to the IP address issuing the correct knock sequence, further improving security and resiliency to exploit, and reducing port-scanning log burden.

See also: Wikipedia - port-knocking.

Documentation

Overview

Package main implements knockr, a port-knocking utility.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL