Skip to content

Commit

Permalink
Update xml.go
Browse files Browse the repository at this point in the history
XML output cannot be parsed. Double "product" element and in case shodan fails to deliver a service the port tag is not closed.
  • Loading branch information
yakmannski authored Apr 21, 2022
1 parent 3914555 commit ca23038
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/output/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ func portToXML(port g.Port, result g.Output) string {
if port.Version != "" {
thisString += fmt.Sprintf(` version="%s"`, port.Version)
}
if port.Product != "" {
thisString += fmt.Sprintf(` product="%s"`, port.Product)
}
if result.OS.Port == port.Port {
thisString += fmt.Sprintf(` ostype="%s" method="probed" conf="8">`, result.OS.Name)
} else if strings.HasSuffix(port.Service, "?") {
Expand All @@ -57,8 +54,9 @@ func portToXML(port g.Port, result g.Output) string {
for _, cpe := range port.Cpes {
thisString += fmt.Sprintf(`<cpe>%s</cpe>`, cpe)
}
thisString += "</service></port>\n"
thisString += "</service>"
}
thisString += "</port>\n"
return thisString
}

Expand Down

0 comments on commit ca23038

Please sign in to comment.