change display port scan result on tui
This commit is contained in:
1
go.mod
1
go.mod
@@ -38,6 +38,7 @@ require (
|
||||
github.com/kotakanbe/go-pingscanner v0.1.0
|
||||
github.com/kotakanbe/goval-dictionary v0.2.10
|
||||
github.com/kotakanbe/logrus-prefixed-formatter v0.0.0-20180123152602-928f7356cb96
|
||||
github.com/kyokomi/emoji v2.2.4+incompatible
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/mozqnet/go-exploitdb v0.1.0
|
||||
|
||||
3
go.sum
3
go.sum
@@ -448,6 +448,9 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/kyokomi/emoji v1.5.1 h1:qp9dub1mW7C4MlvoRENH6EAENb9skEFOvIEbp1Waj38=
|
||||
github.com/kyokomi/emoji v2.2.4+incompatible h1:np0woGKwx9LiHAQmwZx79Oc0rHpNw3o+3evou4BEPv4=
|
||||
github.com/kyokomi/emoji v2.2.4+incompatible/go.mod h1:mZ6aGCD7yk8j6QY6KICwnZ2pxoszVseX1DNoGtU2tBA=
|
||||
github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg=
|
||||
github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s=
|
||||
github.com/labstack/gommon v0.2.9/go.mod h1:E8ZTmW9vw5az5/ZyHWCp0Lw4OH2ecsaBP1C/NKavGG4=
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/google/subcommands"
|
||||
"github.com/gosuri/uitable"
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/kyokomi/emoji"
|
||||
)
|
||||
|
||||
var scanResults models.ScanResults
|
||||
@@ -590,6 +591,7 @@ func summaryLines(r models.ScanResult) string {
|
||||
stable := uitable.New()
|
||||
stable.MaxColWidth = 1000
|
||||
stable.Wrap = false
|
||||
eyeEmoji := emoji.Sprint(":eye:")
|
||||
|
||||
if len(r.Errors) != 0 {
|
||||
return "Error: Scan with --debug to view the details"
|
||||
@@ -617,6 +619,19 @@ func summaryLines(r models.ScanResult) string {
|
||||
pkgNames = append(pkgNames, vinfo.WpPackageFixStats.Names()...)
|
||||
pkgNames = append(pkgNames, vinfo.LibraryFixedIns.Names()...)
|
||||
|
||||
av := vinfo.AttackVector()
|
||||
loop:
|
||||
for _, pname := range vinfo.AffectedPackages.Names() {
|
||||
for _, ap := range r.Packages[pname].AffectedProcs {
|
||||
for _, lp := range ap.ListenPorts {
|
||||
if len(lp.PortScanSuccessOn) > 0 {
|
||||
av = fmt.Sprintf("%s %s", av, eyeEmoji)
|
||||
break loop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exploits := ""
|
||||
if 0 < len(vinfo.Exploits) || 0 < len(vinfo.Metasploits) {
|
||||
exploits = "POC"
|
||||
@@ -627,7 +642,7 @@ func summaryLines(r models.ScanResult) string {
|
||||
fmt.Sprintf(indexFormat, i+1),
|
||||
vinfo.CveID,
|
||||
cvssScore + " |",
|
||||
fmt.Sprintf("%4s |", vinfo.AttackVector()),
|
||||
fmt.Sprintf("%-8s|", av),
|
||||
fmt.Sprintf("%3s |", exploits),
|
||||
fmt.Sprintf("%6s |", vinfo.AlertDict.FormatSource()),
|
||||
fmt.Sprintf("%7s |", vinfo.PatchStatus(r.Packages)),
|
||||
@@ -639,6 +654,7 @@ func summaryLines(r models.ScanResult) string {
|
||||
}
|
||||
stable.AddRow(icols...)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s", stable)
|
||||
}
|
||||
|
||||
@@ -695,6 +711,7 @@ func setChangelogLayout(g *gocui.Gui) error {
|
||||
currentVinfo = cy + oy
|
||||
vinfo := vinfos[currentVinfo]
|
||||
vinfo.AffectedPackages.Sort()
|
||||
scanEmoji := emoji.Sprint(":eye:")
|
||||
for _, affected := range vinfo.AffectedPackages {
|
||||
// packages detected by OVAL may not be actually installed
|
||||
if pack, ok := currentScanResult.Packages[affected.Name]; ok {
|
||||
@@ -717,7 +734,7 @@ func setChangelogLayout(g *gocui.Gui) error {
|
||||
|
||||
var ports []string
|
||||
for _, pp := range p.ListenPorts {
|
||||
ports = append(ports, fmt.Sprintf("%s:%s", pp.Address, pp.Port))
|
||||
ports = append(ports, fmt.Sprintf("%s:%s(Scannable%s:%s)", pp.Address, pp.Port, scanEmoji, pp.PortScanSuccessOn))
|
||||
}
|
||||
|
||||
lines = append(lines, fmt.Sprintf(" * PID: %s %s Port: %s",
|
||||
|
||||
Reference in New Issue
Block a user