Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions pkg/port/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,22 @@ func (p *Port) StringWithDetails() string {
}

type Service struct {
DeviceType string `json:"device_type,omitempty"`
ExtraInfo string `json:"extra_info,omitempty"`
HighVersion string `json:"high_version,omitempty"`
Hostname string `json:"hostname,omitempty"`
LowVersion string `json:"low_version,omitempty"`
Method string `json:"method,omitempty"`
Name string `json:"name,omitempty"`
OSType string `json:"os_type,omitempty"`
Product string `json:"product,omitempty"`
Proto string `json:"proto,omitempty"`
RPCNum string `json:"rpc_num,omitempty"`
ServiceFP string `json:"service_fp,omitempty"`
Tunnel string `json:"tunnel,omitempty"`
Version string `json:"version,omitempty"`
Confidence int `json:"confidence,omitempty"`
DeviceType string `json:"device_type,omitempty"`
ExtraInfo string `json:"extra_info,omitempty"`
HighVersion string `json:"high_version,omitempty"`
Hostname string `json:"hostname,omitempty"`
LowVersion string `json:"low_version,omitempty"`
Method string `json:"method,omitempty"`
Name string `json:"name,omitempty"`
OSType string `json:"os_type,omitempty"`
Product string `json:"product,omitempty"`
Proto string `json:"proto,omitempty"`
RPCNum string `json:"rpc_num,omitempty"`
ServiceFP string `json:"service_fp,omitempty"`
Tunnel string `json:"tunnel,omitempty"`
Version string `json:"version,omitempty"`
Confidence int `json:"confidence,omitempty"`
CPEs []string `json:"cpes,omitempty"`
}

func (s *Service) String() string {
Expand Down
7 changes: 7 additions & 0 deletions pkg/runner/nmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ func (r *Runner) convertNmapPortToNaabuPort(nmapPort nmap.Port) *port.Port {

// Convert service information if available
if nmapPort.Service.Name != "" {
// Convert CPEs from nmap.CPE to []string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Convert CPEs from nmap.CPE to []string

cpes := make([]string, 0, len(nmapPort.Service.CPEs))
for _, cpe := range nmapPort.Service.CPEs {
cpes = append(cpes, string(cpe))
}

naabuPort.Service = &port.Service{
Name: nmapPort.Service.Name,
Product: nmapPort.Service.Product,
Expand All @@ -282,6 +288,7 @@ func (r *Runner) convertNmapPortToNaabuPort(nmapPort nmap.Port) *port.Port {
Tunnel: nmapPort.Service.Tunnel,
LowVersion: nmapPort.Service.LowVersion,
HighVersion: nmapPort.Service.HighVersion,
CPEs: cpes,
}
}

Expand Down
Loading