sophsec/ruby-nmap — Issue #3: Provide a friendly way to access the Service info associated with a port
Author: etdsoft
Created: 2011-11-11 12:01:12+00:00
State: open

When scanning with the -sV flag, the port's @service@ descendant contains a bunch of useful information. For example:

```

```

It would be cool if we could access these through the same interface that the library provides for other components. Maybe creating a new Service class.

My temporal solution is to monkey-patch the Port object to give me access to the underlying Nokogiri XML node, which is fairly ugly but maybe can help someone until a more elegant solution is found:

```
class Nmap::Port
def service_node
@service_node ||= if (service = @node.at('service'))
service
end
end
end
```