add scannedVia field to know the way of access such as SSH, local or pseudo (#811)

* add sacnned via

* change scannedVia type to const
This commit is contained in:
sadayuki-matsuno
2019-05-15 13:33:09 +09:00
committed by Kota Kanbe
parent 824fbb6368
commit 53aaea9fe2
5 changed files with 96 additions and 82 deletions

View File

@@ -390,6 +390,13 @@ func (l *base) convertToModel() models.ScanResult {
errs = append(errs, fmt.Sprintf("%s", e))
}
scannedVia := scannedViaRemote
if isLocalExec(l.ServerInfo.Port, l.ServerInfo.Host) {
scannedVia = scannedViaLocal
} else if l.ServerInfo.Type == config.ServerTypePseudo {
scannedVia = scannedViaPseudo
}
return models.ScanResult{
JSONVersion: models.JSONVersion,
ServerName: l.ServerInfo.ServerName,
@@ -402,6 +409,7 @@ func (l *base) convertToModel() models.ScanResult {
IPv4Addrs: l.ServerInfo.IPv4Addrs,
IPv6Addrs: l.ServerInfo.IPv6Addrs,
ScannedCves: l.VulnInfos,
ScannedVia: scannedVia,
RunningKernel: l.Kernel,
Packages: l.Packages,
SrcPackages: l.SrcPackages,