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

Commit

Permalink
Update to disgo 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ullaakut committed Apr 6, 2019
1 parent a41fb1b commit 4bdc73c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
34 changes: 15 additions & 19 deletions cmd/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)))
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 4bdc73c

Please sign in to comment.