Skip to content

Commit

Permalink
handle interruption
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRoute committed Feb 13, 2024
1 parent 9630305 commit 90ccbf0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/bruter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ import (
"os"
"strings"
"sync"
"syscall"
"time"

"os/signal"

"github.com/CyberRoute/bruter/pkg/config"
"github.com/CyberRoute/bruter/pkg/fuzzer"
"github.com/CyberRoute/bruter/pkg/handlers"
"github.com/CyberRoute/bruter/pkg/network"
"github.com/CyberRoute/bruter/pkg/render"
"github.com/alexedwards/scs/v2"
"github.com/evilsocket/islazy/async"
"github.com/fatih/color"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
Expand Down Expand Up @@ -49,6 +53,14 @@ func main() {
flag.Usage()
os.Exit(1)
}
r := color.New(color.FgRed)
signals := make(chan os.Signal, 2)
signal.Notify(signals, os.Interrupt, syscall.SIGTERM)
go func() {
<-signals
r.Println("\nINTERRUPTING ...")
os.Exit(0)
}()

logger := log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
app.ZeroLog = &logger
Expand Down

0 comments on commit 90ccbf0

Please sign in to comment.