Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Integrate Disgo for user interface (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullaakut committed Mar 10, 2019
1 parent 6beaeca commit a41fb1b
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 209 deletions.
1 change: 0 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"

"github.com/Ullaakut/nmap"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
Expand Down
35 changes: 19 additions & 16 deletions cmd/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,46 @@ package main

import (
"fmt"
"os"

"github.com/fatih/color"
"github.com/ullaakut/disgo/logger"
"github.com/ullaakut/disgo/symbol"
)

func printSummary(targets []vulnerableDockerAPI) {
blue := color.New(color.FgBlue, color.Underline).SprintFunc()
green := color.New(color.FgGreen, color.Bold).SprintFunc()
red := color.New(color.FgRed, color.Bold).SprintFunc()
log, err := logger.New(os.Stdout)
if err != nil {
fmt.Fprintln(os.Stderr, "Unable to create logger:", err)
}

if len(targets) == 0 {
fmt.Printf("%s No vulnerable Docker containers were found. Please make sure that your target is on an accessible network.\n", red("\xE2\x9C\x96"))
log.Errorln(logger.Failure(symbol.Cross), "No vulnerable Docker containers were found. Please make sure that your target is on an accessible network.")
return
}

for _, target := range targets {
fmt.Printf("%s Vulnerable docker API found:\n", green("\xE2\x96\xB6"))
fmt.Printf(" Endpoint address:\t%s\n", blue(target.Host))
fmt.Printf(" Endpoint API port:\t%s\n", fmt.Sprint(target.Port))
fmt.Printf(" Docker version:\t%s\n", target.DockerVersion)
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)

if target.SocketError != nil {
fmt.Printf(" Docker API was unreachable:\t%s\n", red(target.SocketError))
log.Infof(" Docker API was unreachable:\t%s\n", logger.Failure(target.SocketError))
} else {
fmt.Printf(" Operating system:\t%s\n", target.Info.OS)
log.Infof(" Operating system:\t%s\n", target.Info.OS)
if len(target.Containers) > 0 {
fmt.Printf("\n %s running containers:\n", green(fmt.Sprint(len(target.Containers))))
log.Infof("\n %s running containers:\n", logger.Success(len(target.Containers)))
for _, container := range target.Containers {
fmt.Printf(" %s %+v\n", container.Image, container.Ports)
log.Infof(" %s %+v\n", container.Image, container.Ports)
}
} else {
fmt.Println(" No running containers")
}

if len(target.Images) > 0 {
fmt.Printf("\n %s available images:\n", green(len(target.Images)))
log.Infof("\n %s available images:\n", logger.Success(len(target.Images)))
for _, image := range target.Images {
fmt.Printf(" %s\n", image)
log.Infof(" %s\n", image)
}
} else {
fmt.Println(" No available images")
Expand All @@ -53,5 +56,5 @@ func printSummary(targets []vulnerableDockerAPI) {
summaryStr = "\n%s Successful attack: %s devices were accessed"
}

fmt.Printf(summaryStr, green("\xE2\x9C\x94"), green(len(targets)))
log.Infof(summaryStr, logger.Success(symbol.Check), logger.Success(len(targets)))
}
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/docker/docker v0.7.3-0.20190208221036-832ce62cb26d
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.3.3 // indirect
github.com/fatih/color v1.7.0
github.com/fatih/color v1.7.0 // indirect
github.com/gernest/wow v0.1.0
github.com/gogo/protobuf v1.2.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
Expand All @@ -21,6 +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/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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9 h1:vY5WqiEon0ZSTGM3ayVVi+twaHKHDFUVloaQ/wug9/c=
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYvZ+fpjMXqs+XEriussHjSYqeXVnAdSV1tkMYk=
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/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=
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/Ullaakut/disgo/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions vendor/github.com/Ullaakut/disgo/logger/format.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 125 additions & 0 deletions vendor/github.com/Ullaakut/disgo/logger/logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions vendor/github.com/Ullaakut/disgo/symbol/symbol.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a41fb1b

Please sign in to comment.