From 1c845d2b3cd2fc5ef36e84c64b2cfc930bd21861 Mon Sep 17 00:00:00 2001 From: Brendan LE GLAUNEC Date: Mon, 9 Oct 2017 14:23:57 +0200 Subject: [PATCH] Improve UX - Add spinner and messages Improve UX - Add number of streams being attacked --- Dockerfile | 1 + cameraccess/main.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Dockerfile b/Dockerfile index 036224a..34e988d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN go get github.com/pkg/errors RUN go get gopkg.in/go-playground/validator.v9 RUN go get github.com/jessevdk/go-flags RUN go get github.com/fatih/color +RUN go get github.com/gernest/wow RUN go install diff --git a/cameraccess/main.go b/cameraccess/main.go index 7a76904..cf98d0d 100644 --- a/cameraccess/main.go +++ b/cameraccess/main.go @@ -18,6 +18,9 @@ import ( "time" "github.com/EtixLabs/cameradar" + "github.com/gernest/wow" + "github.com/gernest/wow/spin" + "github.com/fatih/color" "github.com/jessevdk/go-flags" ) @@ -40,6 +43,9 @@ func main() { os.Exit(0) } + w := wow.New(os.Stdout, spin.Get(spin.Dots), " Loading dictionaries...") + w.Start() + credentials, err := cmrdr.LoadCredentials(options.Credentials) if err != nil { color.Red("Invalid credentials dictionary: %s", err.Error()) @@ -52,21 +58,27 @@ func main() { return } + w.Text(" Scanning the network...") streams, _ := cmrdr.Discover(options.Target, options.Ports, options.OutputFile, options.Speed, options.EnableLogs) // Most cameras will be accessed successfully with these two attacks + w.Text(" Found " + fmt.Sprint(len(streams)) + " streams. Attacking their routes...") streams, _ = cmrdr.AttackRoute(streams, routes, time.Duration(options.Timeout)*time.Millisecond, options.EnableLogs) + + w.Text(" Found " + fmt.Sprint(len(streams)) + " streams. Attacking their credentials...") streams, _ = cmrdr.AttackCredentials(streams, credentials, time.Duration(options.Timeout)*time.Millisecond, options.EnableLogs) // But some cameras run GST RTSP Server which prioritizes 401 over 404 contrary to most cameras. // For these cameras, running another route attack will solve the problem. for _, stream := range streams { if stream.RouteFound == false || stream.CredentialsFound == false { + w.Text(" Found " + fmt.Sprint(len(streams)) + " streams. Final attack...") streams, _ = cmrdr.AttackRoute(streams, routes, time.Duration(options.Timeout)*time.Millisecond, options.EnableLogs) break } } + clearOutput(w) prettyPrint(streams) } @@ -115,3 +127,11 @@ func prettyPrint(streams []cmrdr.Stream) { fmt.Printf("%s No streams were found. Please make sure that your target is on an accessible network.", red("\xE2\x9C\x96")) } } + +// HACK: Waiting for a fix to issue +// https://github.com/gernest/wow/issues/5 +func clearOutput(w *wow.Wow) { + w.Text("\b") + time.Sleep(80 * time.Millisecond) + w.Stop() +}