experimental: add smart(fast, minimum ports, silently) TCP port scanner (#1060)
* add struct ListenPorts
* change parse to models.ListenPorts from string
* change support models.ListenPorts in TUI
* add scanPort template , detectScanDest
* add Test_detectScanDest
* change impl scanPorts template
* fix build error
* change collect scan success address
* add Test_matchListenPorts
* add Test_updatePortStatus
* change display port scan result on tui
* change display scan emoji on report
* Revert "change display scan emoji on report"
This reverts commit e281882cc6.
* add continue
* change display format
* change no use loop label
* remove comment code
* change display
* fix padding
* change refactoring var , fn name
* fix var name
* fix var name
* change eye icon
* change icon
* delete unuse mod
This commit is contained in:
@@ -617,6 +617,14 @@ func summaryLines(r models.ScanResult) string {
|
||||
pkgNames = append(pkgNames, vinfo.WpPackageFixStats.Names()...)
|
||||
pkgNames = append(pkgNames, vinfo.LibraryFixedIns.Names()...)
|
||||
|
||||
av := vinfo.AttackVector()
|
||||
for _, pname := range vinfo.AffectedPackages.Names() {
|
||||
if r.Packages[pname].HasPortScanSuccessOn() {
|
||||
av = fmt.Sprintf("%s ◉", av)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
exploits := ""
|
||||
if 0 < len(vinfo.Exploits) || 0 < len(vinfo.Metasploits) {
|
||||
exploits = "POC"
|
||||
@@ -627,7 +635,7 @@ func summaryLines(r models.ScanResult) string {
|
||||
fmt.Sprintf(indexFormat, i+1),
|
||||
vinfo.CveID,
|
||||
cvssScore + " |",
|
||||
fmt.Sprintf("%4s |", vinfo.AttackVector()),
|
||||
fmt.Sprintf("%-6s |", av),
|
||||
fmt.Sprintf("%3s |", exploits),
|
||||
fmt.Sprintf("%6s |", vinfo.AlertDict.FormatSource()),
|
||||
fmt.Sprintf("%7s |", vinfo.PatchStatus(r.Packages)),
|
||||
@@ -639,6 +647,7 @@ func summaryLines(r models.ScanResult) string {
|
||||
}
|
||||
stable.AddRow(icols...)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s", stable)
|
||||
}
|
||||
|
||||
@@ -710,8 +719,23 @@ func setChangelogLayout(g *gocui.Gui) error {
|
||||
|
||||
if len(pack.AffectedProcs) != 0 {
|
||||
for _, p := range pack.AffectedProcs {
|
||||
if len(p.ListenPorts) == 0 {
|
||||
lines = append(lines, fmt.Sprintf(" * PID: %s %s Port: []",
|
||||
p.PID, p.Name))
|
||||
continue
|
||||
}
|
||||
|
||||
var ports []string
|
||||
for _, pp := range p.ListenPorts {
|
||||
if len(pp.PortScanSuccessOn) == 0 {
|
||||
ports = append(ports, fmt.Sprintf("%s:%s", pp.Address, pp.Port))
|
||||
} else {
|
||||
ports = append(ports, fmt.Sprintf("%s:%s(◉ Scannable: %s)", pp.Address, pp.Port, pp.PortScanSuccessOn))
|
||||
}
|
||||
}
|
||||
|
||||
lines = append(lines, fmt.Sprintf(" * PID: %s %s Port: %s",
|
||||
p.PID, p.Name, p.ListenPorts))
|
||||
p.PID, p.Name, ports))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,8 +261,22 @@ No CVE-IDs are found in updatable packages.
|
||||
|
||||
if len(pack.AffectedProcs) != 0 {
|
||||
for _, p := range pack.AffectedProcs {
|
||||
if len(p.ListenPorts) == 0 {
|
||||
data = append(data, []string{"",
|
||||
fmt.Sprintf(" - PID: %s %s, Port: []", p.PID, p.Name)})
|
||||
}
|
||||
|
||||
var ports []string
|
||||
for _, pp := range p.ListenPorts {
|
||||
if len(pp.PortScanSuccessOn) == 0 {
|
||||
ports = append(ports, fmt.Sprintf("%s:%s", pp.Address, pp.Port))
|
||||
} else {
|
||||
ports = append(ports, fmt.Sprintf("%s:%s(◉ Scannable: %s)", pp.Address, pp.Port, pp.PortScanSuccessOn))
|
||||
}
|
||||
}
|
||||
|
||||
data = append(data, []string{"",
|
||||
fmt.Sprintf(" - PID: %s %s, Port: %s", p.PID, p.Name, p.ListenPorts)})
|
||||
fmt.Sprintf(" - PID: %s %s, Port: %s", p.PID, p.Name, ports)})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user