From 77e55499a480908b68eb7cb899163ce6b1fb53e7 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Sat, 6 Nov 2021 12:34:41 +0800 Subject: [PATCH] refact: change repo name --- .drone.yml | 2 +- Dockerfile | 6 +++--- README.md | 18 +++++++++--------- {breacher => breach}/commands.go | 10 +++++----- {breacher => breach}/forward.go | 8 ++++---- {breacher => breach}/proxy.go | 6 +++--- {breacher => breach}/ssh.go | 8 ++++---- go.mod | 2 +- main.go | 10 +++++----- release.sh | 2 +- 10 files changed, 36 insertions(+), 36 deletions(-) rename {breacher => breach}/commands.go (78%) rename {breacher => breach}/forward.go (97%) rename {breacher => breach}/proxy.go (92%) rename {breacher => breach}/ssh.go (96%) diff --git a/.drone.yml b/.drone.yml index e699a62..f152f3a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,7 @@ steps: # auto_tag: true mtu: 1000 # purge: true - repo: hub.kumoly.io/tools/breacher + repo: hub.kumoly.io/tools/breach registry: hub.kumoly.io trigger: event: tag \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e853c41..16a02fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,10 +8,10 @@ COPY . . RUN VERSION=$(git describe --tags --abbrev=0) BUILD=$(git rev-parse --short HEAD) && \ GOOS=linux GOARCH=amd64 \ go build -ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD} -w" \ - -o /go/bin/breacher + -o /go/bin/breach FROM alpine:3.14 ENV PATH="/go/bin:${PATH}" COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo -COPY --from=builder /go/bin/breacher /go/bin/breacher -ENTRYPOINT ["/go/bin/breacher"] \ No newline at end of file +COPY --from=builder /go/bin/breach /go/bin/breach +ENTRYPOINT ["/go/bin/breach"] \ No newline at end of file diff --git a/README.md b/README.md index 7909e1f..e1b8135 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Breacher +# Breach common ways to breach network. Including proxy, port forward, ssh tunnel, and backconnect in a single executable ## Install ``` -sudo rm -f /usr/local/bin/breacher +sudo rm -f /usr/local/bin/breach sudo sh -c "curl -fsSL RELEASE_URL | tar -C /usr/local/bin/ -xz" ``` @@ -13,31 +13,31 @@ sudo sh -c "curl -fsSL RELEASE_URL | tar -C /usr/local/bin/ -xz" ```shell Usage: - breacher [command] + breach [command] Available Commands: forward port forwarding for UDP->UDP / TCP->TCP help Help about any command proxy reverse proxy to url tunnel ssh tunneling to access remote services - version Print the version number of breacher + version Print the version number of breach Flags: - -h, --help help for breacher + -h, --help help for breach -s, --silent silent log output - -v, --version version for breacher + -v, --version version for breach -Use "breacher [command] --help" for more information about a command. +Use "breach [command] --help" for more information about a command. ``` ## Systemd ```conf [Unit] -Description=Breacher +Description=Breach [Service] -ExecStart=/usr/local/bin/breacher tunnel :8080 :80 user@example.com -i ~/.ssh/id_rsa +ExecStart=/usr/local/bin/breach tunnel :8080 :80 user@example.com -i ~/.ssh/id_rsa Restart=always [Install] diff --git a/breacher/commands.go b/breach/commands.go similarity index 78% rename from breacher/commands.go rename to breach/commands.go index a68cd2a..f504af1 100644 --- a/breacher/commands.go +++ b/breach/commands.go @@ -1,4 +1,4 @@ -package breacher +package breach import ( "fmt" @@ -10,8 +10,8 @@ import ( ) var Cmd = &cobra.Command{ - Use: "breacher", - Short: "Breacher is a tool to breach network protections", + Use: "breach", + Short: "breach is a tool to breach network protections", Long: "", PersistentPreRun: func(cmd *cobra.Command, args []string) { if rsilent { @@ -45,8 +45,8 @@ var ( ) var versionCmd = &cobra.Command{ Use: "version", - Short: "Print the version number of breacher", + Short: "Print the version number of breach", Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("breacher version %s - %s\n", Version, Build) + fmt.Printf("breach version %s - %s\n", Version, Build) }, } diff --git a/breacher/forward.go b/breach/forward.go similarity index 97% rename from breacher/forward.go rename to breach/forward.go index 49cd8f3..3e10bdc 100644 --- a/breacher/forward.go +++ b/breach/forward.go @@ -1,4 +1,4 @@ -package breacher +package breach import ( "io" @@ -19,9 +19,9 @@ var forwardCmd = &cobra.Command{ Short: "port forwarding for UDP->UDP / TCP->TCP", Long: `port forwarding, defaults to use tcp if no flags given ex. -breacher forward :8080 kumoly.io:5080 -breacher forward :8080 :8000 -breacher forward --udp :8080 192.168.51.211:53 +breach forward :8080 kumoly.io:5080 +breach forward :8080 :8000 +breach forward --udp :8080 192.168.51.211:53 `, Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { diff --git a/breacher/proxy.go b/breach/proxy.go similarity index 92% rename from breacher/proxy.go rename to breach/proxy.go index 1896ea8..240250d 100644 --- a/breacher/proxy.go +++ b/breach/proxy.go @@ -1,4 +1,4 @@ -package breacher +package breach import ( "log" @@ -14,8 +14,8 @@ var proxyCmd = &cobra.Command{ Short: "reverse proxy to url", Long: `reverse proxy, ex. -* breacher reverse_proxy :8080 http://vpn.kumoly.io/ -* breacher reverse_proxy :8080 https://kumoly.io/`, +* breach reverse_proxy :8080 http://vpn.kumoly.io/ +* breach reverse_proxy :8080 https://kumoly.io/`, Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { targetUrl, err := url.Parse(args[1]) diff --git a/breacher/ssh.go b/breach/ssh.go similarity index 96% rename from breacher/ssh.go rename to breach/ssh.go index c8572db..2a4dfad 100644 --- a/breacher/ssh.go +++ b/breach/ssh.go @@ -1,4 +1,4 @@ -package breacher +package breach import ( "fmt" @@ -30,9 +30,9 @@ var sshCmd = &cobra.Command{ Short: "ssh tunneling to access remote services", Long: `ssh tunneling to access remote services ex. -breacher tunnel :8080 host:80 user@example.com -p paswd -breacher tunnel :8080 :80 user@example.com -i ~/.ssh/id_rsa -breacher tunnel :8080 kumoly.io:443 user@example.com +breach tunnel :8080 host:80 user@example.com -p paswd +breach tunnel :8080 :80 user@example.com -i ~/.ssh/id_rsa +breach tunnel :8080 kumoly.io:443 user@example.com `, Args: cobra.ExactArgs(3), Run: func(cmd *cobra.Command, args []string) { diff --git a/go.mod b/go.mod index 77116e3..8a72341 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module kumoly.io/tools/breacher +module kumoly.io/tools/breach go 1.17 diff --git a/main.go b/main.go index 58ea5c6..0a6d9a1 100644 --- a/main.go +++ b/main.go @@ -1,15 +1,15 @@ package main -import "kumoly.io/tools/breacher/breacher" +import "kumoly.io/tools/breach/breach" var Version = "v0.0.0" var Build = "alpha" func init() { - breacher.Version = Version - breacher.Build = Build - breacher.Cmd.Version = Version + breach.Version = Version + breach.Build = Build + breach.Cmd.Version = Version } func main() { - breacher.Execute() + breach.Execute() } diff --git a/release.sh b/release.sh index 9d4d306..b8f7060 100755 --- a/release.sh +++ b/release.sh @@ -3,7 +3,7 @@ if [ $? -ne 0 ]; then VERSION=$DRONE_TAG; fi BUILD=$(git rev-parse --short HEAD) if [ $? -ne 0 ]; then BUILD=${DRONE_COMMIT:0:7}; fi -PROJ=breacher +PROJ=breach HUB=hub.kumoly.io HUB_PROJECT=tools DIST=dist