From 4bdc73cb3cc6cf767f1e8cc5f8564061ba192e81 Mon Sep 17 00:00:00 2001 From: Ullaakut Date: Sat, 6 Apr 2019 13:14:56 +0200 Subject: [PATCH] Update to disgo 0.3.0 --- cmd/summary.go | 34 +++++++++++++++------------------- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/cmd/summary.go b/cmd/summary.go index 5fe4ed0..09ed8c6 100644 --- a/cmd/summary.go +++ b/cmd/summary.go @@ -2,46 +2,42 @@ package main import ( "fmt" - "os" - "github.com/ullaakut/disgo/logger" - "github.com/ullaakut/disgo/symbol" + "github.com/ullaakut/disgo" + "github.com/ullaakut/disgo/style" ) func printSummary(targets []vulnerableDockerAPI) { - log, err := logger.New(os.Stdout) - if err != nil { - fmt.Fprintln(os.Stderr, "Unable to create logger:", err) - } + term := disgo.NewTerminal() if len(targets) == 0 { - log.Errorln(logger.Failure(symbol.Cross), "No vulnerable Docker containers were found. Please make sure that your target is on an accessible network.") + term.Errorln(style.Failure(style.SymbolCross), "No vulnerable Docker containers were found. Please make sure that your target is on an accessible network.") return } for _, target := range targets { - log.Infoln(logger.Success(symbol.RightTriangle), "Vulnerable docker API found:") - log.Infof(" Endpoint address:\t%s\n", logger.Link(target.Host)) - log.Infof(" Endpoint API port:\t%v\n", target.Port) - log.Infof(" Docker version:\t%s\n", target.DockerVersion) + term.Infoln(style.Success(style.SymbolRightTriangle), "Vulnerable docker API found:") + term.Infof(" Endpoint address:\t%s\n", style.Link(target.Host)) + term.Infof(" Endpoint API port:\t%v\n", target.Port) + term.Infof(" Docker version:\t%s\n", target.DockerVersion) if target.SocketError != nil { - log.Infof(" Docker API was unreachable:\t%s\n", logger.Failure(target.SocketError)) + term.Infof(" Docker API was unreachable:\t%s\n", style.Failure(target.SocketError)) } else { - log.Infof(" Operating system:\t%s\n", target.Info.OS) + term.Infof(" Operating system:\t%s\n", target.Info.OS) if len(target.Containers) > 0 { - log.Infof("\n %s running containers:\n", logger.Success(len(target.Containers))) + term.Infof("\n %s running containers:\n", style.Success(len(target.Containers))) for _, container := range target.Containers { - log.Infof(" %s %+v\n", container.Image, container.Ports) + term.Infof(" %s %+v\n", container.Image, container.Ports) } } else { fmt.Println(" No running containers") } if len(target.Images) > 0 { - log.Infof("\n %s available images:\n", logger.Success(len(target.Images))) + term.Infof("\n %s available images:\n", style.Success(len(target.Images))) for _, image := range target.Images { - log.Infof(" %s\n", image) + term.Infof(" %s\n", image) } } else { fmt.Println(" No available images") @@ -56,5 +52,5 @@ func printSummary(targets []vulnerableDockerAPI) { summaryStr = "\n%s Successful attack: %s devices were accessed" } - log.Infof(summaryStr, logger.Success(symbol.Check), logger.Success(len(targets))) + term.Infof(summaryStr, style.Success(style.SymbolCheck), style.Success(len(targets))) } diff --git a/go.mod b/go.mod index 25bf0bf..7ccbdad 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/spf13/cobra v0.0.3 github.com/spf13/pflag v1.0.3 github.com/spf13/viper v1.3.1 - github.com/ullaakut/disgo v0.0.0-20190310161027-e17c43d71b3d + github.com/ullaakut/disgo v0.3.0 github.com/ullaakut/nmap v0.0.0-20190123211045-b27e203871ee // indirect golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 // indirect gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c // indirect diff --git a/go.sum b/go.sum index 6242948..a369aff 100644 --- a/go.sum +++ b/go.sum @@ -94,6 +94,8 @@ github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYv github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ullaakut/disgo v0.0.0-20190310161027-e17c43d71b3d h1:tObr2ILgSQwrhpQRiVUKHtXF+0V5gYnnd/zBQGAmfuQ= github.com/ullaakut/disgo v0.0.0-20190310161027-e17c43d71b3d/go.mod h1:UOgLVyqihzJ7yihrHjYZikivT+AHb9NhT3r1OyPCJqg= +github.com/ullaakut/disgo v0.3.0 h1:2zrEyNBfPRgDVDgzM/qLXZ4Yqt3Lxz7ERvZUSmqSY2M= +github.com/ullaakut/disgo v0.3.0/go.mod h1:UOgLVyqihzJ7yihrHjYZikivT+AHb9NhT3r1OyPCJqg= github.com/ullaakut/nmap v0.0.0-20190123211045-b27e203871ee h1:Dwi6Pta3aNPhEW7XNJpfTqNj/KoD0HfGB90b+uhygHM= github.com/ullaakut/nmap v0.0.0-20190123211045-b27e203871ee/go.mod h1:4CQy4PqZA4Snk3+MS26+1oAkJ8dCY8kGH6+kF42yajw= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=