Skip to content

Commit

Permalink
Merge pull request #58 from bilalcaliskan/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
bilalcaliskan authored Sep 25, 2022
2 parents d86232f + d832812 commit b0968ea
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.39.0
uses: anothrNick/github-tag-action@1.46.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
Expand Down
6 changes: 3 additions & 3 deletions build/ci/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: end-of-file-fixer
# - id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
args: ['--maxkb=1024']
Expand All @@ -26,5 +26,5 @@ repos:
- id: go-cyclo
args: [-over=15]
- id: no-go-testing
- id: golangci-lint
# - id: golangci-lint
- id: go-build
23 changes: 6 additions & 17 deletions build/ci/banner.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
__ _ _
___ _ _ _ __ / _| | | ___ ___ __| |
/ __| | | | | | '_ \ _____ | |_ | | / _ \ / _ \ / _` |
\__ \ | |_| | | | | | |_____| | _| | | | (_) | | (_) | | (_| |
|___/ \__, | |_| |_| |_| |_| \___/ \___/ \__,_|
|___/

GoVersion: {{ .GoVersion }}
GOOS: {{ .GOOS }}
GOARCH: {{ .GOARCH }}
NumCPU: {{ .NumCPU }}
GOPATH: {{ .GOPATH }}
GOROOT: {{ .GOROOT }}
Compiler: {{ .Compiler }}
ENV: {{ .Env "GOPATH" }}
Now: {{ .Now "Monday, 2 Jan 2006" }}
BannerGeneratedAt: https://devops.datenkollektiv.de/banner.txt/index.html
__ _ _
___ _ _ _ __ / _|| | ___ ___ __| |
/ __|| | | || '_ \ _____ | |_ | | / _ \ / _ \ / _` |
\__ \| |_| || | | ||_____|| _|| || (_) || (_) || (_| |
|___/ \__, ||_| |_| |_| |_| \___/ \___/ \__,_|
|___/

26 changes: 19 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ package cmd

import (
"fmt"
"github.com/bilalcaliskan/syn-flood/internal/logging"
"os"
"strings"
"time"

"github.com/bilalcaliskan/syn-flood/internal/options"

"github.com/bilalcaliskan/syn-flood/internal/logging"
"github.com/bilalcaliskan/syn-flood/internal/raw"
"github.com/bilalcaliskan/syn-flood/internal/version"
"github.com/dimiro1/banner"
"github.com/spf13/cobra"
"go.uber.org/zap"
"os"
"strings"
"time"
)

var (
Expand Down Expand Up @@ -58,6 +60,19 @@ Please do not use that tool with devil needs.
logging.Atomic.SetLevel(zap.DebugLevel)
}

if _, err := os.Stat(opts.BannerFilePath); err == nil {
bannerBytes, _ := os.ReadFile(opts.BannerFilePath)
banner.Init(os.Stdout, true, false, strings.NewReader(string(bannerBytes)))
}

logging.GetLogger().Info("syn-flood is started",
zap.String("appVersion", ver.GitVersion),
zap.String("goVersion", ver.GoVersion),
zap.String("goOS", ver.GoOs),
zap.String("goArch", ver.GoArch),
zap.String("gitCommit", ver.GitCommit),
zap.String("buildDate", ver.BuildDate))

shouldStop := make(chan bool)
go func() {
if err = raw.StartFlooding(shouldStop, opts.Host, opts.Port, opts.PayloadLength, opts.FloodType); err != nil {
Expand Down Expand Up @@ -92,9 +107,6 @@ Please do not use that tool with devil needs.
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
bannerBytes, _ := os.ReadFile("banner.txt")
banner.Init(os.Stdout, true, false, strings.NewReader(string(bannerBytes)))

err := rootCmd.Execute()
if err != nil {
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/dimiro1/banner v1.1.0
github.com/google/gopacket v1.1.19
github.com/pkg/errors v0.9.1
github.com/schollz/progressbar/v3 v3.10.1
github.com/schollz/progressbar/v3 v3.11.0
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
go.uber.org/automaxprocs v1.5.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
github.com/rivo/uniseg v0.3.4 h1:3Z3Eu6FGHZWSfNKJTOUiPatWwfc7DzJRU04jFUqJODw=
github.com/rivo/uniseg v0.3.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/schollz/progressbar/v3 v3.10.1 h1:6A8v8TIcCJL4yemlUJS9gdcpZ++Gy6toOh1JzKQkz+U=
github.com/schollz/progressbar/v3 v3.10.1/go.mod h1:R2djRgv58sn00AGysc4fN0ip4piOGd3z88K+zVBjczs=
github.com/schollz/progressbar/v3 v3.11.0 h1:3nIBUF1Zw/pGUaRHP7PZWmARP7ZQbWQ6vL6hwoQiIvU=
github.com/schollz/progressbar/v3 v3.11.0/go.mod h1:R2djRgv58sn00AGysc4fN0ip4piOGd3z88K+zVBjczs=
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand Down
9 changes: 5 additions & 4 deletions internal/raw/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package raw

import (
"fmt"
"math/rand"
"net"
"time"

"github.com/bilalcaliskan/syn-flood/internal/logging"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/pkg/errors"
"github.com/schollz/progressbar/v3"
progressbar "github.com/schollz/progressbar/v3"
"go.uber.org/zap"
"golang.org/x/net/ipv4"
"math/rand"
"net"
"time"
)

var logger *zap.Logger
Expand Down

0 comments on commit b0968ea

Please sign in to comment.