use of com.xebia.vulnmanager.models.nmap.objects.ServiceDetails in project vulnmanager by xebia-research.
the class HostsParserHelper method getPort.
private HostPorts.Port getPort(Node currentNode) {
NamedNodeMap portAttributesNode = currentNode.getAttributes();
String protocol = portAttributesNode.getNamedItem(NMapConstants.PARSER_LITERAL_PROTOCOL).getNodeValue();
String portId = portAttributesNode.getNamedItem(NMapConstants.PARSER_LITERAL_PORTID).getNodeValue();
StateDetails stateDetails = null;
ServiceDetails serviceDetails = null;
NodeList portChildNodes = currentNode.getChildNodes();
for (int i = 0; i < portChildNodes.getLength(); i++) {
Node currentChildNode = portChildNodes.item(i);
NamedNodeMap portAttributes = currentChildNode.getAttributes();
if (currentChildNode.getNodeName().equals(NMapConstants.PARSER_LITERAL_STATE)) {
stateDetails = getStateDetails(portAttributes);
} else if (currentChildNode.getNodeName().equals(NMapConstants.PARSER_LITERAL_SERVICE)) {
serviceDetails = getServiceDetails(portAttributes);
}
}
return new HostPorts.Port(protocol, portId, stateDetails, serviceDetails);
}
Aggregations