Skip to content

Commit

Permalink
README, COPYING, fix and precision
Browse files Browse the repository at this point in the history
  • Loading branch information
leblanc-simon committed May 25, 2023
1 parent dd2e0c0 commit 79b704b
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 17 deletions.
13 changes: 13 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
31 changes: 16 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
mkfile_path := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
version := $(git tag -l | tail -n 1)
build_path := $(mkfile_path)build/
version := $$(git tag -l | tail -n 1)

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

debug: ## Build a debug version
@mkdir -p $(mkfile_path)build
@go build main.go -o $(mkfile_path)open-go-knocking
debug: clean-build ## Build a debug version
@mkdir -p $(build_path)
@go build -o $(build_path)open-go-knocking main.go
@echo "Debug release done"

release: clean-build build-linux build-darwin build-windows ## Build the release version

clean-build: ## Clean the build directory
@rm -fr @mkdir -p $(mkfile_path)build/*
@rm -fr $(build_path)/*

build-linux: ## Build release version for GNU/Linux
@mkdir -p $(mkfile_path)build
@GOOS="linux" GOARCH="amd64" go build -ldflags="-X 'main.version=$(version)'" -o $(mkfile_path)open-go-knocking-$(version)-linux-amd64 main.go
@GOOS="linux" GOARCH="arm64" go build -ldflags="-X 'main.version=$(version)'" -o $(mkfile_path)open-go-knocking-$(version)-linux-arm64 main.go
@GOOS="linux" GOARCH="386" go build -ldflags="-X 'main.version=$(version)'" -o $(mkfile_path)open-go-knocking-$(version)-linux-386 main.go
@mkdir -p $(build_path)
@GOOS="linux" GOARCH="amd64" go build -ldflags="-X 'main.version=$(version)'" -o $(build_path)open-go-knocking-$(version)-linux-amd64 main.go
@GOOS="linux" GOARCH="arm64" go build -ldflags="-X 'main.version=$(version)'" -o $(build_path)open-go-knocking-$(version)-linux-arm64 main.go
@GOOS="linux" GOARCH="386" go build -ldflags="-X 'main.version=$(version)'" -o $(build_path)open-go-knocking-$(version)-linux-386 main.go

build-darwin: ## Build release version for MacOS
@mkdir -p $(mkfile_path)build
@GOOS="darwin" GOARCH="amd64" go build -ldflags="-X 'main.version=$(version)'" -o $(mkfile_path)open-go-knocking-$(version)-darwin-amd64 main.go
@GOOS="darwin" GOARCH="arm64" go build -ldflags="-X 'main.version=v0.0.1'" -o $(mkfile_path)open-go-knocking-$(version)-darwin-arm64 main.go
@mkdir -p $(build_path)
@GOOS="darwin" GOARCH="amd64" go build -ldflags="-X 'main.version=$(version)'" -o $(build_path)open-go-knocking-$(version)-darwin-amd64 main.go
@GOOS="darwin" GOARCH="arm64" go build -ldflags="-X 'main.version=v0.0.1'" -o $(build_path)open-go-knocking-$(version)-darwin-arm64 main.go

build-windows: ## Build release version for Windows
@mkdir -p $(mkfile_path)build
@GOOS="windows" GOARCH="amd64" go build -ldflags="-X 'main.version=$(version)'" -o $(mkfile_path)open-go-knocking-$(version)-windows-amd64.exe main.go
@GOOS="windows" GOARCH="386" go build -ldflags="-X 'main.version=$(version)'" -o $(mkfile_path)open-go-knocking-$(version)-windows-386.exe main.go
@mkdir -p $(build_path)
@GOOS="windows" GOARCH="amd64" go build -ldflags="-X 'main.version=$(version)'" -o $(build_path)open-go-knocking-$(version)-windows-amd64.exe main.go
@GOOS="windows" GOARCH="386" go build -ldflags="-X 'main.version=$(version)'" -o $(build_path)open-go-knocking-$(version)-windows-386.exe main.go
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# OpenGoKnocking

Simple and cross-platform port knocking client written in GoLang.

<p align="center">
<img src="https://raw.githubusercontent.com/leblanc-simon/open-go-knocking/main/assets/open-go-knocking.png">
</p>

## Installation

To install OpenGoKnocking in your $GOPATH:

```bash
git clone https://github.com/leblanc-simon/open-go-knocking.git
cd open-go-knocking
go install
```

alternatively, you can download binary from [releases](https://github.com/leblanc-simon/open-go-knocking/releases).
Binaries are availables for GNU/Linux, MacOS and Windows

## Usage

```bash
# Knock to the server example.com at port 1337 (tcp), then 1338 (UDP) and finally 1339 (TCP)
open-go-knocking example.com 1337:tcp 1338:udp 1339:tcp

# If the majority of ports are TCP ports, you can use the following syntax (ports without protocol will be in TCP)
open-go-knocking --tcp example.com 1337 1338:udp 1339

# If the majority of ports are UDP ports, you can use the following syntax (ports without protocol will be in UDP)
open-go-knocking --udp example.com 1337 1338:tcp 1339
```

## Options

* `--tcp`:
* `--udp`:
* `--delay` (in ms):
* `--version`: Show the current version
* `--help`: Show the help

## Errors

Possible exit codes :

* 0: all is fine :)
* 1: Not enough arguments (host and port are required)
* 2: Host is not a valid hostname or IP (v4 or v6)
* 3: Problems with ports or protocols (check if you use `--tcp` or `--udp` that the option is located before the host)

## Author

* Simon Leblanc <contact@leblanc-simon.eu>

## License

[WTFPL](http://www.wtfpl.net/)

## Logo

Original Logo from [Takuya Ueda](https://twitter.com/tenntenn), you can find source [in the repository](https://github.com/golang-samples/gopher-vector). Licensed under the Creative Commons 3.0 Attributions license.

Modified by Simon Leblanc.
Binary file added assets/open-go-knocking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions assets/open-go-knocking.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (
versionFlag = flag.Bool("version", false, "Show version")
tcpFlag = flag.Bool("tcp", false, "Send all packets to TCP")
udpFlag = flag.Bool("udp", false, "Send all packets to UDP")
delayFlag = flag.Int("delay", 5, "Delay between each packet")
delayFlag = flag.Int("delay", 5, "Delay between each packet (in milliseconds)")

version = "develop"
appName = "OpenGoKnocking"
Expand Down Expand Up @@ -146,7 +146,7 @@ func main() {
}

if flag.CommandLine.NArg() < 2 {
exitWithError(1, "Arguments missing !", true)
exitWithError(ExitCodeBadArg, "Arguments missing !", true)
}

host := getHostAndVerify()
Expand Down

0 comments on commit 79b704b

Please sign in to comment.